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
This commit is contained in:
Alexander Larsson 2011-03-09 13:06:21 +01:00
parent 74b97dcd14
commit 637cce0f91

View File

@ -7666,34 +7666,41 @@ meta_window_show_menu (MetaWindow *window,
window->type != META_WINDOW_DESKTOP) window->type != META_WINDOW_DESKTOP)
ops |= META_MENU_OP_RECOVER; ops |= META_MENU_OP_RECOVER;
n_workspaces = meta_screen_get_n_workspaces (window->screen); if (!meta_prefs_get_workspaces_only_on_primary () ||
meta_window_is_on_primary_monitor (window))
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; n_workspaces = meta_screen_get_n_workspaces (window->screen);
if (layout.current_col > 0) if (n_workspaces > 1)
ops |= ltr ? META_MENU_OP_MOVE_LEFT : META_MENU_OP_MOVE_RIGHT; ops |= META_MENU_OP_WORKSPACES;
if ((layout.current_col < layout.cols - 1) &&
(layout.current_row * layout.cols + (layout.current_col + 1) < n_workspaces)) meta_screen_calc_workspace_layout (window->screen,
ops |= ltr ? META_MENU_OP_MOVE_RIGHT : META_MENU_OP_MOVE_LEFT; n_workspaces,
if (layout.current_row > 0) meta_workspace_index ( window->screen->active_workspace),
ops |= META_MENU_OP_MOVE_UP; &layout);
if ((layout.current_row < layout.rows - 1) &&
((layout.current_row + 1) * layout.cols + layout.current_col < n_workspaces)) if (!window->on_all_workspaces)
ops |= META_MENU_OP_MOVE_DOWN; {
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)) if (META_WINDOW_MAXIMIZED (window))
ops |= META_MENU_OP_UNMAXIMIZE; ops |= META_MENU_OP_UNMAXIMIZE;
else else
@ -7706,9 +7713,6 @@ meta_window_show_menu (MetaWindow *window,
ops |= META_MENU_OP_SHADE; ops |= META_MENU_OP_SHADE;
#endif #endif
ops |= META_MENU_OP_UNSTICK;
ops |= META_MENU_OP_STICK;
if (window->wm_state_above) if (window->wm_state_above)
ops |= META_MENU_OP_UNABOVE; ops |= META_MENU_OP_UNABOVE;
else else