core: Ensure passive key grabs are only set up on X11

We don't strictly need it for wayland compositors, yet there are
paths where we try to trigger those passive grabs there. Just
skip those on the high level code (where "is it x11" decisions
are taken) like we do with passive button grabs.
This commit is contained in:
Carlos Garnacho 2019-05-24 19:40:07 +02:00
parent 9367cd2d66
commit 835a97a66c

View File

@ -1526,6 +1526,8 @@ meta_window_grab_keys (MetaWindow *window)
MetaDisplay *display = window->display;
MetaKeyBindingManager *keys = &display->key_binding_manager;
if (!meta_is_wayland_compositor ())
return;
if (window->all_keys_grabbed)
return;
@ -1560,7 +1562,7 @@ meta_window_grab_keys (MetaWindow *window)
void
meta_window_ungrab_keys (MetaWindow *window)
{
if (window->keys_grabbed)
if (!meta_is_wayland_compositor () && window->keys_grabbed)
{
MetaDisplay *display = window->display;
MetaKeyBindingManager *keys = &display->key_binding_manager;
@ -1619,7 +1621,11 @@ meta_display_grab_accelerator (MetaDisplay *display,
return META_KEYBINDING_ACTION_NONE;
}
meta_change_keygrab (keys, display->x11_display->xroot, TRUE, &resolved_combo);
if (!meta_is_wayland_compositor ())
{
meta_change_keygrab (keys, display->x11_display->xroot,
TRUE, &resolved_combo);
}
grab = g_new0 (MetaKeyGrab, 1);
grab->action = next_dynamic_keybinding_action ();
@ -1665,8 +1671,11 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
{
int i;
if (!meta_is_wayland_compositor ())
{
meta_change_keygrab (keys, display->x11_display->xroot,
FALSE, &binding->resolved_combo);
}
for (i = 0; i < binding->resolved_combo.len; i++)
{
@ -1744,7 +1753,7 @@ meta_window_grab_all_keys (MetaWindow *window,
guint32 timestamp)
{
Window grabwindow;
gboolean retval;
gboolean retval = TRUE;
if (window->all_keys_grabbed)
return FALSE;
@ -1760,6 +1769,8 @@ meta_window_grab_all_keys (MetaWindow *window,
window->desc);
meta_window_focus (window, timestamp);
if (!meta_is_wayland_compositor ())
{
grabwindow = meta_window_x11_get_toplevel_xwindow (window);
meta_topic (META_DEBUG_KEYBINDINGS,
@ -1771,14 +1782,16 @@ meta_window_grab_all_keys (MetaWindow *window,
window->all_keys_grabbed = TRUE;
window->grab_on_frame = window->frame != NULL;
}
}
return retval;
}
void
meta_window_ungrab_all_keys (MetaWindow *window, guint32 timestamp)
meta_window_ungrab_all_keys (MetaWindow *window,
guint32 timestamp)
{
if (window->all_keys_grabbed)
if (!meta_is_wayland_compositor () && window->all_keys_grabbed)
{
ungrab_keyboard (timestamp);