Commit 083cd79a authored by Samuel Thibault's avatar Samuel Thibault
Browse files

gdk: switch focus to contextual menu

in addition to taking a grab, to make sure that it is considered active
and not other toplevels, notably by the accessibility layer.

01455399 ("gdk: do not deactivate surface on keyboard grabs") disabled
deactivating surfaces when a grab is ongoing, to avoid noise when using
desktop keyboard shortcuts. When the application itself is grabbing the
keyboard from another toplevel, very notably for contextual menus, we
however do want to deactivate the current surface, so that the grabbing
toplevel shows up as having the focus.

This also fixes a bug in gdk_x11_surface_focus: when the surface is
temporary, the window manager does not handle it and will ignore any wm
hint, so we need to directly use XSetInputFocus.

Fixes #85
parent 48e88c6e
Pipeline #43094 passed with stages
in 20 minutes and 12 seconds
......@@ -1650,7 +1650,8 @@ gdk_x11_surface_focus (GdkSurface *surface,
display = GDK_SURFACE_DISPLAY (surface);
if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_TEMP &&
gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
g_intern_static_string ("_NET_ACTIVE_WINDOW")))
{
XClientMessageEvent xclient;
......
......@@ -1686,6 +1686,8 @@ gtk_menu_popup_internal (GtkMenu *menu,
_gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
_gtk_menu_shell_update_mnemonics (menu_shell);
gtk_window_present (GTK_WINDOW (priv->toplevel));
}
static GdkDevice *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment