diff --git a/ChangeLog b/ChangeLog index e9b79884b..9fad6db50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2004-08-07 Rob Adams + + 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 * src/screen.c (meta_screen_set_cursor): add XFlush() after diff --git a/src/menu.c b/src/menu.c index 8f8f2b535..9520576ae 100644 --- a/src/menu.c +++ b/src/menu.c @@ -62,7 +62,7 @@ static MenuItem menuitems[] = { { META_MENU_OP_RESIZE, NULL, FALSE, N_("_Resize") }, { 0, NULL, FALSE, NULL }, /* separator */ { 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_UNSTICK, NULL, FALSE, N_("Only on _This Workspace") }, { 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; MetaVirtualModifier mods; - if (menuitems[i].op == 0) + if (menuitems[i].label == NULL) { mi = gtk_separator_menu_item_new (); } diff --git a/src/window.c b/src/window.c index 904ba038c..ae22da9ec 100644 --- a/src/window.c +++ b/src/window.c @@ -5898,6 +5898,7 @@ meta_window_show_menu (MetaWindow *window, MetaMenuOp insensitive; MetaWindowMenu *menu; MetaWorkspaceLayout layout; + int n_workspaces; if (window->display->window_menu) { @@ -5909,22 +5910,30 @@ meta_window_show_menu (MetaWindow *window, ops = 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_get_n_workspaces (window->screen), + n_workspaces, meta_workspace_index ( window->screen->active_workspace), &layout); if (!window->on_all_workspaces) { + if (layout.current_col > 0) 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; if (layout.current_row > 0) 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; }