mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
2007-04-15 Elijah Newren <newren gmail com> Remove incorrect usage of window.h from menu.c. See #426791 & #382962. * src/menu.c (enum MetaMenuItemType, variable menuitems, meta_menu_item_new): cleanup: add a MENU_ITEM_RADIOBUTTON for the sticky stuff * src/menu.c (variable menuitems): * src/core.c (meta_core_get_menu_accelerator): * src/window.c (menu_callback, meta_window_show_menu): * src/common.h (enum MetaMenuOp): reinstate META_MENU_OP_UNABOVE * src/menu.c (meta_window_menu_new): remove hacks (using inappropriate data) for STICK/UNSTICK/ABOVE and clean it up while just setting STICK/UNSTICK activeness as necessary * src/menu.[ch] (meta_window_menu_new): * src/ui.[ch] (meta_ui_window_menu_new): make the active_workspace parameter an unsigned long 2007-04-15 Bruno Boaventura <brunobol@gnome.org> * src/menu.c (meta_window_menu_new): don't show the current workspace as a possible workspace to switch to. Fixes #426791. svn path=/trunk/; revision=3196
This commit is contained in:
parent
6fa4dee13e
commit
6de7271ab6
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
||||
2007-04-15 Elijah Newren <newren gmail com>
|
||||
|
||||
Remove incorrect usage of window.h from menu.c. See #426791 &
|
||||
#382962.
|
||||
|
||||
* src/menu.c (enum MetaMenuItemType, variable menuitems,
|
||||
meta_menu_item_new):
|
||||
cleanup: add a MENU_ITEM_RADIOBUTTON for the sticky stuff
|
||||
|
||||
* src/menu.c (variable menuitems):
|
||||
* src/core.c (meta_core_get_menu_accelerator):
|
||||
* src/window.c (menu_callback, meta_window_show_menu):
|
||||
* src/common.h (enum MetaMenuOp):
|
||||
reinstate META_MENU_OP_UNABOVE
|
||||
|
||||
* src/menu.c (meta_window_menu_new):
|
||||
remove hacks (using inappropriate data) for STICK/UNSTICK/ABOVE
|
||||
and clean it up while just setting STICK/UNSTICK activeness as
|
||||
necessary
|
||||
|
||||
* src/menu.[ch] (meta_window_menu_new):
|
||||
* src/ui.[ch] (meta_ui_window_menu_new):
|
||||
make the active_workspace parameter an unsigned long
|
||||
|
||||
2007-04-15 Bruno Boaventura <brunobol@gnome.org>
|
||||
|
||||
* src/menu.c (meta_window_menu_new): don't show the current
|
||||
workspace as a possible workspace to switch to. Fixes #426791.
|
||||
|
||||
2007-04-12 Elijah Newren <newren gmail com>
|
||||
|
||||
* src/place.c (meta_window_place): do not auto-maximize windows
|
||||
|
11
src/common.h
11
src/common.h
@ -64,11 +64,12 @@ typedef enum
|
||||
META_MENU_OP_MOVE = 1 << 9,
|
||||
META_MENU_OP_RESIZE = 1 << 10,
|
||||
META_MENU_OP_ABOVE = 1 << 11,
|
||||
META_MENU_OP_MOVE_LEFT = 1 << 12,
|
||||
META_MENU_OP_MOVE_RIGHT = 1 << 13,
|
||||
META_MENU_OP_MOVE_UP = 1 << 14,
|
||||
META_MENU_OP_MOVE_DOWN = 1 << 15,
|
||||
META_MENU_OP_RECOVER = 1 << 16
|
||||
META_MENU_OP_UNABOVE = 1 << 12,
|
||||
META_MENU_OP_MOVE_LEFT = 1 << 13,
|
||||
META_MENU_OP_MOVE_RIGHT = 1 << 14,
|
||||
META_MENU_OP_MOVE_UP = 1 << 15,
|
||||
META_MENU_OP_MOVE_DOWN = 1 << 16,
|
||||
META_MENU_OP_RECOVER = 1 << 17
|
||||
} MetaMenuOp;
|
||||
|
||||
typedef struct _MetaWindowMenu MetaWindowMenu;
|
||||
|
@ -531,6 +531,7 @@ meta_core_get_menu_accelerator (MetaMenuOp menu_op,
|
||||
name = META_KEYBINDING_TOGGLE_STICKY;
|
||||
break;
|
||||
case META_MENU_OP_ABOVE:
|
||||
case META_MENU_OP_UNABOVE:
|
||||
name = META_KEYBINDING_TOGGLE_ABOVE;
|
||||
break;
|
||||
case META_MENU_OP_WORKSPACES:
|
||||
|
69
src/menu.c
69
src/menu.c
@ -32,7 +32,6 @@
|
||||
#include "core.h"
|
||||
#include "themewidget.h"
|
||||
#include "metaaccellabel.h"
|
||||
#include "window.h"
|
||||
|
||||
typedef struct _MenuItem MenuItem;
|
||||
typedef struct _MenuData MenuData;
|
||||
@ -43,6 +42,7 @@ typedef enum
|
||||
MENU_ITEM_NORMAL,
|
||||
MENU_ITEM_IMAGE,
|
||||
MENU_ITEM_CHECKBOX,
|
||||
MENU_ITEM_RADIOBUTTON,
|
||||
} MetaMenuItemType;
|
||||
|
||||
struct _MenuItem
|
||||
@ -87,9 +87,11 @@ static MenuItem menuitems[] = {
|
||||
/* Translators: Translate this string the same way as you do in libwnck! */
|
||||
{ META_MENU_OP_ABOVE, MENU_ITEM_CHECKBOX, NULL, FALSE, N_("Always on _Top") },
|
||||
/* Translators: Translate this string the same way as you do in libwnck! */
|
||||
{ META_MENU_OP_STICK, MENU_ITEM_CHECKBOX, NULL, FALSE, N_("_Always on Visible Workspace") },
|
||||
{ META_MENU_OP_UNABOVE, MENU_ITEM_CHECKBOX, NULL, TRUE, N_("Always on _Top") },
|
||||
/* Translators: Translate this string the same way as you do in libwnck! */
|
||||
{ META_MENU_OP_UNSTICK, MENU_ITEM_CHECKBOX, NULL, FALSE, N_("_Only on This Workspace") },
|
||||
{ META_MENU_OP_STICK, MENU_ITEM_RADIOBUTTON, NULL, FALSE, N_("_Always on Visible Workspace") },
|
||||
/* Translators: Translate this string the same way as you do in libwnck! */
|
||||
{ META_MENU_OP_UNSTICK, MENU_ITEM_RADIOBUTTON, NULL, FALSE, N_("_Only on This Workspace") },
|
||||
/* Translators: Translate this string the same way as you do in libwnck! */
|
||||
{ META_MENU_OP_MOVE_LEFT, MENU_ITEM_NORMAL, NULL, FALSE, N_("Move to Workspace _Left") },
|
||||
/* Translators: Translate this string the same way as you do in libwnck! */
|
||||
@ -274,14 +276,18 @@ menu_item_new (MenuItem *menuitem, int workspace_id)
|
||||
{
|
||||
mi = gtk_check_menu_item_new ();
|
||||
|
||||
if (menuitem->op == META_MENU_OP_STICK || menuitem->op == META_MENU_OP_UNSTICK)
|
||||
{
|
||||
gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (mi),
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), menuitem->checked);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi),
|
||||
menuitem->checked);
|
||||
}
|
||||
else if (menuitem->type == MENU_ITEM_RADIOBUTTON)
|
||||
{
|
||||
mi = gtk_check_menu_item_new ();
|
||||
|
||||
gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (mi),
|
||||
TRUE);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi),
|
||||
menuitem->checked);
|
||||
}
|
||||
else
|
||||
return gtk_separator_menu_item_new ();
|
||||
|
||||
@ -305,7 +311,7 @@ meta_window_menu_new (MetaFrames *frames,
|
||||
MetaMenuOp ops,
|
||||
MetaMenuOp insensitive,
|
||||
Window client_xwindow,
|
||||
int active_workspace,
|
||||
unsigned long active_workspace,
|
||||
int n_workspaces,
|
||||
MetaWindowMenuFunc func,
|
||||
gpointer data)
|
||||
@ -313,6 +319,7 @@ meta_window_menu_new (MetaFrames *frames,
|
||||
int i;
|
||||
MetaWindowMenu *menu;
|
||||
|
||||
/* FIXME: Modifications to 'ops' should happen in meta_window_show_menu */
|
||||
if (n_workspaces < 2)
|
||||
ops &= ~(META_MENU_OP_STICK | META_MENU_OP_UNSTICK | META_MENU_OP_WORKSPACES);
|
||||
else if (n_workspaces == 2)
|
||||
@ -344,26 +351,19 @@ meta_window_menu_new (MetaFrames *frames,
|
||||
|
||||
mi = menu_item_new (&menuitem, -1);
|
||||
|
||||
if ((menuitem.op == META_MENU_OP_STICK) ||
|
||||
(menuitem.op == META_MENU_OP_UNSTICK) ||
|
||||
(menuitem.op == META_MENU_OP_ABOVE))
|
||||
/* Set the activeness of radiobuttons. */
|
||||
switch (menuitem.op)
|
||||
{
|
||||
Display *xdisplay;
|
||||
MetaDisplay *display;
|
||||
MetaWindow *window;
|
||||
|
||||
xdisplay = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (frames)->window);
|
||||
display = meta_display_for_x_display (xdisplay);
|
||||
window = meta_display_lookup_x_window (display, client_xwindow);
|
||||
|
||||
if (menuitem.op == META_MENU_OP_STICK)
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), window->on_all_workspaces);
|
||||
else
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), !window->on_all_workspaces);
|
||||
|
||||
if (menuitem.op == META_MENU_OP_ABOVE)
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi), window->wm_state_above);
|
||||
|
||||
case META_MENU_OP_STICK:
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi),
|
||||
active_workspace == 0xFFFFFFFF);
|
||||
break;
|
||||
case META_MENU_OP_UNSTICK:
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi),
|
||||
active_workspace != 0xFFFFFFFF);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (menuitem.type != MENU_ITEM_SEPARATOR)
|
||||
@ -407,7 +407,7 @@ meta_window_menu_new (MetaFrames *frames,
|
||||
N_("Move to Another _Workspace")
|
||||
};
|
||||
|
||||
meta_verbose ("Creating %d-workspace menu current space %d\n",
|
||||
meta_verbose ("Creating %d-workspace menu current space %lu\n",
|
||||
n_workspaces, active_workspace);
|
||||
|
||||
display = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (frames)->window);
|
||||
@ -443,12 +443,9 @@ meta_window_menu_new (MetaFrames *frames,
|
||||
|
||||
g_free (label);
|
||||
|
||||
if (!(ops & META_MENU_OP_UNSTICK) &&
|
||||
(active_workspace == i ||
|
||||
insensitive & META_MENU_OP_WORKSPACES))
|
||||
gtk_widget_set_sensitive (mi, FALSE);
|
||||
else if (insensitive & META_MENU_OP_WORKSPACES)
|
||||
if ((active_workspace == (unsigned)i) && (ops & META_MENU_OP_UNSTICK))
|
||||
gtk_widget_set_sensitive (mi, FALSE);
|
||||
|
||||
md = g_new (MenuData, 1);
|
||||
|
||||
md->menu = menu;
|
||||
|
@ -47,7 +47,7 @@ MetaWindowMenu* meta_window_menu_new (MetaFrames *frames,
|
||||
MetaMenuOp ops,
|
||||
MetaMenuOp insensitive,
|
||||
Window client_xwindow,
|
||||
int active_workspace,
|
||||
unsigned long active_workspace,
|
||||
int n_workspaces,
|
||||
MetaWindowMenuFunc func,
|
||||
gpointer data);
|
||||
|
2
src/ui.c
2
src/ui.c
@ -319,7 +319,7 @@ meta_ui_window_menu_new (MetaUI *ui,
|
||||
Window client_xwindow,
|
||||
MetaMenuOp ops,
|
||||
MetaMenuOp insensitive,
|
||||
int active_workspace,
|
||||
unsigned long active_workspace,
|
||||
int n_workspaces,
|
||||
MetaWindowMenuFunc func,
|
||||
gpointer data)
|
||||
|
2
src/ui.h
2
src/ui.h
@ -116,7 +116,7 @@ MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui,
|
||||
Window client_xwindow,
|
||||
MetaMenuOp ops,
|
||||
MetaMenuOp insensitive,
|
||||
int active_workspace,
|
||||
unsigned long active_workspace,
|
||||
int n_workspaces,
|
||||
MetaWindowMenuFunc func,
|
||||
gpointer data);
|
||||
|
@ -6408,6 +6408,7 @@ menu_callback (MetaWindowMenu *menu,
|
||||
break;
|
||||
|
||||
case META_MENU_OP_ABOVE:
|
||||
case META_MENU_OP_UNABOVE:
|
||||
if (window->wm_state_above == FALSE)
|
||||
meta_window_make_above (window);
|
||||
else
|
||||
@ -6537,7 +6538,10 @@ meta_window_show_menu (MetaWindow *window,
|
||||
ops |= META_MENU_OP_UNSTICK;
|
||||
ops |= META_MENU_OP_STICK;
|
||||
|
||||
ops |= META_MENU_OP_ABOVE;
|
||||
if (window->wm_state_above)
|
||||
ops |= META_MENU_OP_UNABOVE;
|
||||
else
|
||||
ops |= META_MENU_OP_ABOVE;
|
||||
|
||||
if (!window->has_maximize_func)
|
||||
insensitive |= META_MENU_OP_UNMAXIMIZE | META_MENU_OP_MAXIMIZE;
|
||||
@ -6563,7 +6567,7 @@ meta_window_show_menu (MetaWindow *window,
|
||||
if ((window->type == META_WINDOW_DESKTOP) ||
|
||||
(window->type == META_WINDOW_DOCK) ||
|
||||
(window->type == META_WINDOW_SPLASHSCREEN))
|
||||
insensitive |= META_MENU_OP_ABOVE;
|
||||
insensitive |= META_MENU_OP_ABOVE | META_MENU_OP_UNABOVE;
|
||||
|
||||
/* If all operations are disabled, just quit without showing the menu.
|
||||
* This is the case, for example, with META_WINDOW_DESKTOP windows.
|
||||
|
Loading…
Reference in New Issue
Block a user