[mutter] keybindings: Fix <Super> key crash
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] keybindings: Fix <Super> key crash
- Date: Wed, 7 May 2014 13:30:45 +0000 (UTC)
commit 413e39ecbb59107248249dd11341f23021ab764b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed May 7 09:27:42 2014 -0400
keybindings: Fix <Super> key crash
If we exit early as not handled, then the normal process_event
handler will fire, and trigger the overlay-key binding. As that's
a special binding that doesn't have a handler, trying to trigger
that handler will crash mutter.
Instead of returning early, just check for xdisplay every time
we try to drive the X grab state machine. We really need a better
solution for this on the Wayland side.
src/core/keybindings.c | 45 ++++++++++++++++++++++++++-------------------
1 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index b0a6bbd..d0b542c 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1598,11 +1598,12 @@ process_overlay_key (MetaDisplay *display,
MetaWindow *window)
{
MetaBackend *backend = meta_get_backend ();
+ Display *xdisplay;
- if (!META_IS_BACKEND_X11 (backend))
- return FALSE;
-
- Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ if (META_IS_BACKEND_X11 (backend))
+ xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
+ else
+ xdisplay = NULL;
if (display->overlay_key_only_pressed)
{
@@ -1628,17 +1629,20 @@ process_overlay_key (MetaDisplay *display,
* binding, we unfreeze the keyboard but keep the grab
* (this is important for something like cycling
* windows */
- XIAllowEvents (xdisplay,
- clutter_input_device_get_device_id (event->device),
- XIAsyncDevice, event->time);
+
+ if (xdisplay)
+ XIAllowEvents (xdisplay,
+ clutter_input_device_get_device_id (event->device),
+ XIAsyncDevice, event->time);
}
else
{
/* Replay the event so it gets delivered to our
* per-window key bindings or to the application */
- XIAllowEvents (xdisplay,
- clutter_input_device_get_device_id (event->device),
- XIReplayDevice, event->time);
+ if (xdisplay)
+ XIAllowEvents (xdisplay,
+ clutter_input_device_get_device_id (event->device),
+ XIReplayDevice, event->time);
}
}
else if (event->type == CLUTTER_KEY_RELEASE)
@@ -1649,9 +1653,10 @@ process_overlay_key (MetaDisplay *display,
/* We want to unfreeze events, but keep the grab so that if the user
* starts typing into the overlay we get all the keys */
- XIAllowEvents (xdisplay,
- clutter_input_device_get_device_id (event->device),
- XIAsyncDevice, event->time);
+ if (xdisplay)
+ XIAllowEvents (xdisplay,
+ clutter_input_device_get_device_id (event->device),
+ XIAsyncDevice, event->time);
binding = display_get_keybinding (display,
display->overlay_key_combo.keycode,
@@ -1675,9 +1680,10 @@ process_overlay_key (MetaDisplay *display,
*
* https://bugzilla.gnome.org/show_bug.cgi?id=666101
*/
- XIAllowEvents (xdisplay,
- clutter_input_device_get_device_id (event->device),
- XIAsyncDevice, event->time);
+ if (xdisplay)
+ XIAllowEvents (xdisplay,
+ clutter_input_device_get_device_id (event->device),
+ XIAsyncDevice, event->time);
}
return TRUE;
@@ -1688,9 +1694,10 @@ process_overlay_key (MetaDisplay *display,
display->overlay_key_only_pressed = TRUE;
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
* on the next event if it's not the release of the overlay key */
- XIAllowEvents (xdisplay,
- clutter_input_device_get_device_id (event->device),
- XISyncDevice, event->time);
+ if (xdisplay)
+ XIAllowEvents (xdisplay,
+ clutter_input_device_get_device_id (event->device),
+ XISyncDevice, event->time);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]