From 637cce0f915afe0f7e5db32ad24b78e267108927 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 9 Mar 2011 13:06:21 +0100 Subject: [PATCH] Only show workspace and stick/unstick in menu item for primary monitor If workspaces_only_on_primary then it makes no sense to have these menu items on the monitors where workspaces don't take any effect. https://bugzilla.gnome.org/show_bug.cgi?id=609258 --- src/core/window.c | 58 +++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index f61b97d5b..a0f1f479b 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7666,34 +7666,41 @@ meta_window_show_menu (MetaWindow *window, window->type != META_WINDOW_DESKTOP) ops |= META_MENU_OP_RECOVER; - 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, - n_workspaces, - meta_workspace_index ( window->screen->active_workspace), - &layout); - - if (!window->on_all_workspaces) + if (!meta_prefs_get_workspaces_only_on_primary () || + meta_window_is_on_primary_monitor (window)) { - ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR; + n_workspaces = meta_screen_get_n_workspaces (window->screen); - if (layout.current_col > 0) - ops |= ltr ? META_MENU_OP_MOVE_LEFT : META_MENU_OP_MOVE_RIGHT; - if ((layout.current_col < layout.cols - 1) && - (layout.current_row * layout.cols + (layout.current_col + 1) < n_workspaces)) - ops |= ltr ? META_MENU_OP_MOVE_RIGHT : META_MENU_OP_MOVE_LEFT; - if (layout.current_row > 0) - ops |= META_MENU_OP_MOVE_UP; - if ((layout.current_row < layout.rows - 1) && - ((layout.current_row + 1) * layout.cols + layout.current_col < n_workspaces)) - ops |= META_MENU_OP_MOVE_DOWN; + if (n_workspaces > 1) + ops |= META_MENU_OP_WORKSPACES; + + meta_screen_calc_workspace_layout (window->screen, + n_workspaces, + meta_workspace_index ( window->screen->active_workspace), + &layout); + + if (!window->on_all_workspaces) + { + ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR; + + if (layout.current_col > 0) + ops |= ltr ? META_MENU_OP_MOVE_LEFT : META_MENU_OP_MOVE_RIGHT; + if ((layout.current_col < layout.cols - 1) && + (layout.current_row * layout.cols + (layout.current_col + 1) < n_workspaces)) + ops |= ltr ? META_MENU_OP_MOVE_RIGHT : META_MENU_OP_MOVE_LEFT; + if (layout.current_row > 0) + ops |= META_MENU_OP_MOVE_UP; + if ((layout.current_row < layout.rows - 1) && + ((layout.current_row + 1) * layout.cols + layout.current_col < n_workspaces)) + ops |= META_MENU_OP_MOVE_DOWN; + } + + meta_screen_free_workspace_layout (&layout); + + ops |= META_MENU_OP_UNSTICK; + ops |= META_MENU_OP_STICK; } - meta_screen_free_workspace_layout (&layout); - if (META_WINDOW_MAXIMIZED (window)) ops |= META_MENU_OP_UNMAXIMIZE; else @@ -7706,9 +7713,6 @@ meta_window_show_menu (MetaWindow *window, ops |= META_MENU_OP_SHADE; #endif - ops |= META_MENU_OP_UNSTICK; - ops |= META_MENU_OP_STICK; - if (window->wm_state_above) ops |= META_MENU_OP_UNABOVE; else