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.
This commit is contained in:
parent
2ca2c18c2a
commit
413e39ecbb
@ -1598,11 +1598,12 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
Display *xdisplay;
|
||||||
|
|
||||||
if (!META_IS_BACKEND_X11 (backend))
|
if (META_IS_BACKEND_X11 (backend))
|
||||||
return FALSE;
|
xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
||||||
|
else
|
||||||
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
|
xdisplay = NULL;
|
||||||
|
|
||||||
if (display->overlay_key_only_pressed)
|
if (display->overlay_key_only_pressed)
|
||||||
{
|
{
|
||||||
@ -1628,6 +1629,8 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
* binding, we unfreeze the keyboard but keep the grab
|
* binding, we unfreeze the keyboard but keep the grab
|
||||||
* (this is important for something like cycling
|
* (this is important for something like cycling
|
||||||
* windows */
|
* windows */
|
||||||
|
|
||||||
|
if (xdisplay)
|
||||||
XIAllowEvents (xdisplay,
|
XIAllowEvents (xdisplay,
|
||||||
clutter_input_device_get_device_id (event->device),
|
clutter_input_device_get_device_id (event->device),
|
||||||
XIAsyncDevice, event->time);
|
XIAsyncDevice, event->time);
|
||||||
@ -1636,6 +1639,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
{
|
{
|
||||||
/* Replay the event so it gets delivered to our
|
/* Replay the event so it gets delivered to our
|
||||||
* per-window key bindings or to the application */
|
* per-window key bindings or to the application */
|
||||||
|
if (xdisplay)
|
||||||
XIAllowEvents (xdisplay,
|
XIAllowEvents (xdisplay,
|
||||||
clutter_input_device_get_device_id (event->device),
|
clutter_input_device_get_device_id (event->device),
|
||||||
XIReplayDevice, event->time);
|
XIReplayDevice, event->time);
|
||||||
@ -1649,6 +1653,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
|
|
||||||
/* We want to unfreeze events, but keep the grab so that if the user
|
/* We want to unfreeze events, but keep the grab so that if the user
|
||||||
* starts typing into the overlay we get all the keys */
|
* starts typing into the overlay we get all the keys */
|
||||||
|
if (xdisplay)
|
||||||
XIAllowEvents (xdisplay,
|
XIAllowEvents (xdisplay,
|
||||||
clutter_input_device_get_device_id (event->device),
|
clutter_input_device_get_device_id (event->device),
|
||||||
XIAsyncDevice, event->time);
|
XIAsyncDevice, event->time);
|
||||||
@ -1675,6 +1680,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
*
|
*
|
||||||
* https://bugzilla.gnome.org/show_bug.cgi?id=666101
|
* https://bugzilla.gnome.org/show_bug.cgi?id=666101
|
||||||
*/
|
*/
|
||||||
|
if (xdisplay)
|
||||||
XIAllowEvents (xdisplay,
|
XIAllowEvents (xdisplay,
|
||||||
clutter_input_device_get_device_id (event->device),
|
clutter_input_device_get_device_id (event->device),
|
||||||
XIAsyncDevice, event->time);
|
XIAsyncDevice, event->time);
|
||||||
@ -1688,6 +1694,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
display->overlay_key_only_pressed = TRUE;
|
display->overlay_key_only_pressed = TRUE;
|
||||||
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
|
/* 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 */
|
* on the next event if it's not the release of the overlay key */
|
||||||
|
if (xdisplay)
|
||||||
XIAllowEvents (xdisplay,
|
XIAllowEvents (xdisplay,
|
||||||
clutter_input_device_get_device_id (event->device),
|
clutter_input_device_get_device_id (event->device),
|
||||||
XISyncDevice, event->time);
|
XISyncDevice, event->time);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user