summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2014-06-02 21:47:24 +0200
committerFlorian Müllner <fmuellner@gnome.org>2014-06-02 23:48:53 +0200
commit5b61f2d64263bd987a9b55a806b0b8be1a148eb2 (patch)
tree27175358592ab042ef8367643e48aa9a95cc8f53
parent094669baee661086ac639e1813e704c0eff10149 (diff)
windowMenu: Implement new show_menu_for_rect() hook
Having the full geometry of the menu's source button (if any) will allow us to address several misbehaviors of window menus, so use that instead of show_menu(). https://bugzilla.gnome.org/show_bug.cgi?id=731058
-rw-r--r--js/ui/windowManager.js4
-rw-r--r--js/ui/windowMenu.js4
-rw-r--r--src/gnome-shell-plugin.c14
-rw-r--r--src/shell-wm-private.h4
-rw-r--r--src/shell-wm.c21
5 files changed, 40 insertions, 7 deletions
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 623619db..0b77916b 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1153,8 +1153,8 @@ const WindowManager = new Lang.Class({
this._tilePreview.hide();
},
- _showWindowMenu: function(shellwm, window, menu, x, y) {
- this._windowMenuManager.showWindowMenuForWindow(window, menu, x, y);
+ _showWindowMenu: function(shellwm, window, menu, rect) {
+ this._windowMenuManager.showWindowMenuForWindow(window, menu, rect);
},
_startAppSwitcher : function(display, screen, window, binding) {
diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js
index cca5504a..f993e15a 100644
--- a/js/ui/windowMenu.js
+++ b/js/ui/windowMenu.js
@@ -151,7 +151,7 @@ const WindowMenuManager = new Lang.Class({
this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor });
},
- showWindowMenuForWindow: function(window, type, x, y) {
+ showWindowMenuForWindow: function(window, type, rect) {
let menu = (type == Meta.WindowMenuType.WM) ? new WindowMenu(window)
: new AppMenu(window);
@@ -161,7 +161,7 @@ const WindowMenuManager = new Lang.Class({
window.check_alive(global.get_current_time());
});
- Main.layoutManager.setDummyCursorGeometry(x, y, 0, 0);
+ Main.layoutManager.setDummyCursorGeometry(rect.x, rect.y, 0, 0);
menu.open(BoxPointer.PopupAnimation.NONE);
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
menu.connect('open-state-changed', Lang.bind(this, function(menu_, isOpen) {
diff --git a/src/gnome-shell-plugin.c b/src/gnome-shell-plugin.c
index 4b78870f..3c99c75d 100644
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -78,6 +78,10 @@ static void gnome_shell_plugin_show_window_menu (MetaPlugin *plugin,
MetaWindowMenuType menu,
int x,
int y);
+static void gnome_shell_plugin_show_window_menu_for_rect (MetaPlugin *plugin,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ MetaRectangle *rect);
static gboolean gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
XEvent *event);
@@ -145,6 +149,7 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
plugin_class->show_tile_preview = gnome_shell_plugin_show_tile_preview;
plugin_class->hide_tile_preview = gnome_shell_plugin_hide_tile_preview;
plugin_class->show_window_menu = gnome_shell_plugin_show_window_menu;
+ plugin_class->show_window_menu_for_rect = gnome_shell_plugin_show_window_menu_for_rect;
plugin_class->xevent_filter = gnome_shell_plugin_xevent_filter;
plugin_class->keybinding_filter = gnome_shell_plugin_keybinding_filter;
@@ -318,6 +323,15 @@ gnome_shell_plugin_show_window_menu (MetaPlugin *plugin,
_shell_wm_show_window_menu (get_shell_wm (), window, menu, x, y);
}
+static void
+gnome_shell_plugin_show_window_menu_for_rect (MetaPlugin *plugin,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ MetaRectangle *rect)
+{
+ _shell_wm_show_window_menu_for_rect (get_shell_wm (), window, menu, rect);
+}
+
static gboolean
gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
XEvent *xev)
diff --git a/src/shell-wm-private.h b/src/shell-wm-private.h
index c7068efa..9e44b331 100644
--- a/src/shell-wm-private.h
+++ b/src/shell-wm-private.h
@@ -45,6 +45,10 @@ void _shell_wm_show_window_menu (ShellWM *wm,
MetaWindowMenuType menu,
int x,
int y);
+void _shell_wm_show_window_menu_for_rect (ShellWM *wm,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ MetaRectangle *rect);
gboolean _shell_wm_filter_keybinding (ShellWM *wm,
MetaKeyBinding *binding);
diff --git a/src/shell-wm.c b/src/shell-wm.c
index 928f5f10..67d03b8c 100644
--- a/src/shell-wm.c
+++ b/src/shell-wm.c
@@ -141,8 +141,8 @@ shell_wm_class_init (ShellWMClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
- G_TYPE_NONE, 4,
- META_TYPE_WINDOW, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
+ G_TYPE_NONE, 3,
+ META_TYPE_WINDOW, G_TYPE_INT, META_TYPE_RECTANGLE);
shell_wm_signals[FILTER_KEYBINDING] =
g_signal_new ("filter-keybinding",
G_TYPE_FROM_CLASS (klass),
@@ -303,7 +303,22 @@ _shell_wm_show_window_menu (ShellWM *wm,
int x,
int y)
{
- g_signal_emit (wm, shell_wm_signals[SHOW_WINDOW_MENU], 0, window, menu, x, y);
+ MetaRectangle rect;
+
+ rect.x = x;
+ rect.y = y;
+ rect.width = rect.height = 0;
+
+ _shell_wm_show_window_menu_for_rect (wm, window, menu, &rect);
+}
+
+void
+_shell_wm_show_window_menu_for_rect (ShellWM *wm,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ MetaRectangle *rect)
+{
+ g_signal_emit (wm, shell_wm_signals[SHOW_WINDOW_MENU], 0, window, menu, rect);
}
void