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
This commit is contained in:
parent
094669baee
commit
5b61f2d642
@ -1153,8 +1153,8 @@ const WindowManager = new Lang.Class({
|
|||||||
this._tilePreview.hide();
|
this._tilePreview.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_showWindowMenu: function(shellwm, window, menu, x, y) {
|
_showWindowMenu: function(shellwm, window, menu, rect) {
|
||||||
this._windowMenuManager.showWindowMenuForWindow(window, menu, x, y);
|
this._windowMenuManager.showWindowMenuForWindow(window, menu, rect);
|
||||||
},
|
},
|
||||||
|
|
||||||
_startAppSwitcher : function(display, screen, window, binding) {
|
_startAppSwitcher : function(display, screen, window, binding) {
|
||||||
|
@ -151,7 +151,7 @@ const WindowMenuManager = new Lang.Class({
|
|||||||
this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor });
|
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)
|
let menu = (type == Meta.WindowMenuType.WM) ? new WindowMenu(window)
|
||||||
: new AppMenu(window);
|
: new AppMenu(window);
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ const WindowMenuManager = new Lang.Class({
|
|||||||
window.check_alive(global.get_current_time());
|
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.open(BoxPointer.PopupAnimation.NONE);
|
||||||
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
menu.connect('open-state-changed', Lang.bind(this, function(menu_, isOpen) {
|
menu.connect('open-state-changed', Lang.bind(this, function(menu_, isOpen) {
|
||||||
|
@ -78,6 +78,10 @@ static void gnome_shell_plugin_show_window_menu (MetaPlugin *plugin,
|
|||||||
MetaWindowMenuType menu,
|
MetaWindowMenuType menu,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
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,
|
static gboolean gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
|
||||||
XEvent *event);
|
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->show_tile_preview = gnome_shell_plugin_show_tile_preview;
|
||||||
plugin_class->hide_tile_preview = gnome_shell_plugin_hide_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 = 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->xevent_filter = gnome_shell_plugin_xevent_filter;
|
||||||
plugin_class->keybinding_filter = gnome_shell_plugin_keybinding_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);
|
_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
|
static gboolean
|
||||||
gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
|
gnome_shell_plugin_xevent_filter (MetaPlugin *plugin,
|
||||||
XEvent *xev)
|
XEvent *xev)
|
||||||
|
@ -45,6 +45,10 @@ void _shell_wm_show_window_menu (ShellWM *wm,
|
|||||||
MetaWindowMenuType menu,
|
MetaWindowMenuType menu,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
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,
|
gboolean _shell_wm_filter_keybinding (ShellWM *wm,
|
||||||
MetaKeyBinding *binding);
|
MetaKeyBinding *binding);
|
||||||
|
@ -141,8 +141,8 @@ shell_wm_class_init (ShellWMClass *klass)
|
|||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0, NULL, NULL, NULL,
|
0, NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 4,
|
G_TYPE_NONE, 3,
|
||||||
META_TYPE_WINDOW, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
|
META_TYPE_WINDOW, G_TYPE_INT, META_TYPE_RECTANGLE);
|
||||||
shell_wm_signals[FILTER_KEYBINDING] =
|
shell_wm_signals[FILTER_KEYBINDING] =
|
||||||
g_signal_new ("filter-keybinding",
|
g_signal_new ("filter-keybinding",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
@ -303,7 +303,22 @@ _shell_wm_show_window_menu (ShellWM *wm,
|
|||||||
int x,
|
int x,
|
||||||
int y)
|
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
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user