Remove some extraneous items that could sometimes appear in the window

2004-08-07  Rob Adams  <readams@readams.net>

	Remove some extraneous items that could sometimes appear in the
	window menu.  Fix for #144493.

	* src/menu.c (menuitems): Change the second separator to key on
	whether there are any workspaces.
	(meta_window_menu_new): use NULL label instead of 0 op to identify
	separator

	* src/window.c (meta_window_show_menu): Change the conditions on
	the directions to take into account "holes" in the workspace
	layout and also only set META_MENU_OP_WORKSPACES when there's more
	than one workspace.
This commit is contained in:
Rob Adams 2004-08-07 17:50:40 +00:00 committed by Rob Adams
parent 7bcc485701
commit de4c7a0610
3 changed files with 30 additions and 6 deletions

View File

@ -1,3 +1,18 @@
2004-08-07 Rob Adams <readams@readams.net>
Remove some extraneous items that could sometimes appear in the
window menu. Fix for #144493.
* src/menu.c (menuitems): Change the second separator to key on
whether there are any workspaces.
(meta_window_menu_new): use NULL label instead of 0 op to identify
separator
* src/window.c (meta_window_show_menu): Change the conditions on
the directions to take into account "holes" in the workspace
layout and also only set META_MENU_OP_WORKSPACES when there's more
than one workspace.
2004-08-07 Havoc Pennington <hp@redhat.com> 2004-08-07 Havoc Pennington <hp@redhat.com>
* src/screen.c (meta_screen_set_cursor): add XFlush() after * src/screen.c (meta_screen_set_cursor): add XFlush() after

View File

@ -62,7 +62,7 @@ static MenuItem menuitems[] = {
{ META_MENU_OP_RESIZE, NULL, FALSE, N_("_Resize") }, { META_MENU_OP_RESIZE, NULL, FALSE, N_("_Resize") },
{ 0, NULL, FALSE, NULL }, /* separator */ { 0, NULL, FALSE, NULL }, /* separator */
{ META_MENU_OP_DELETE, METACITY_STOCK_DELETE, FALSE, N_("_Close") }, { META_MENU_OP_DELETE, METACITY_STOCK_DELETE, FALSE, N_("_Close") },
{ 0, NULL, FALSE, NULL }, /* separator */ { META_MENU_OP_WORKSPACES, NULL, FALSE, NULL }, /* separator */
{ META_MENU_OP_STICK, NULL, FALSE, N_("Put on _All Workspaces") }, { META_MENU_OP_STICK, NULL, FALSE, N_("Put on _All Workspaces") },
{ META_MENU_OP_UNSTICK, NULL, FALSE, N_("Only on _This Workspace") }, { META_MENU_OP_UNSTICK, NULL, FALSE, N_("Only on _This Workspace") },
{ META_MENU_OP_MOVE_LEFT, NULL, FALSE, N_("Move to Workspace _Left") }, { META_MENU_OP_MOVE_LEFT, NULL, FALSE, N_("Move to Workspace _Left") },
@ -289,7 +289,7 @@ meta_window_menu_new (MetaFrames *frames,
unsigned int key; unsigned int key;
MetaVirtualModifier mods; MetaVirtualModifier mods;
if (menuitems[i].op == 0) if (menuitems[i].label == NULL)
{ {
mi = gtk_separator_menu_item_new (); mi = gtk_separator_menu_item_new ();
} }

View File

@ -5898,6 +5898,7 @@ meta_window_show_menu (MetaWindow *window,
MetaMenuOp insensitive; MetaMenuOp insensitive;
MetaWindowMenu *menu; MetaWindowMenu *menu;
MetaWorkspaceLayout layout; MetaWorkspaceLayout layout;
int n_workspaces;
if (window->display->window_menu) if (window->display->window_menu)
{ {
@ -5909,22 +5910,30 @@ meta_window_show_menu (MetaWindow *window,
ops = 0; ops = 0;
insensitive = 0; insensitive = 0;
ops |= (META_MENU_OP_DELETE | META_MENU_OP_WORKSPACES | META_MENU_OP_MINIMIZE | META_MENU_OP_MOVE | META_MENU_OP_RESIZE); ops |= (META_MENU_OP_DELETE | META_MENU_OP_MINIMIZE | META_MENU_OP_MOVE | META_MENU_OP_RESIZE);
n_workspaces = meta_screen_get_n_workspaces (window->screen);
if (n_workspaces > 1)
ops |= META_MENU_OP_WORKSPACES;
meta_screen_calc_workspace_layout (window->screen, meta_screen_calc_workspace_layout (window->screen,
meta_screen_get_n_workspaces (window->screen), n_workspaces,
meta_workspace_index ( window->screen->active_workspace), meta_workspace_index ( window->screen->active_workspace),
&layout); &layout);
if (!window->on_all_workspaces) if (!window->on_all_workspaces)
{ {
if (layout.current_col > 0) if (layout.current_col > 0)
ops |= META_MENU_OP_MOVE_LEFT; ops |= META_MENU_OP_MOVE_LEFT;
if (layout.current_col < layout.cols - 1) if ((layout.current_col < layout.cols - 1) &&
(layout.current_row * layout.cols + (layout.current_col + 1) < n_workspaces))
ops |= META_MENU_OP_MOVE_RIGHT; ops |= META_MENU_OP_MOVE_RIGHT;
if (layout.current_row > 0) if (layout.current_row > 0)
ops |= META_MENU_OP_MOVE_UP; ops |= META_MENU_OP_MOVE_UP;
if (layout.current_row < layout.rows - 1) if ((layout.current_row < layout.rows - 1) &&
((layout.current_row + 1) * layout.cols + layout.current_col < n_workspaces))
ops |= META_MENU_OP_MOVE_DOWN; ops |= META_MENU_OP_MOVE_DOWN;
} }