1
0
Fork 0

events: Clean up event replay code

This commit is contained in:
Jasper St. Pierre 2014-05-08 15:09:20 -04:00
parent a7ea54bd7d
commit d9b72b0f43

View file

@ -1931,6 +1931,7 @@ meta_display_handle_event (MetaDisplay *display,
ClutterModifierType grab_mask;
gboolean unmodified;
gboolean fully_modified;
gboolean handled = FALSE;
grab_mask = display->window_grab_modifiers;
if (g_getenv ("MUTTER_DEBUG_BUTTON_GRABS"))
@ -1985,18 +1986,7 @@ meta_display_handle_event (MetaDisplay *display,
*/
display->allow_terminal_deactivation = TRUE;
meta_verbose ("Allowing events time %u\n",
(unsigned int)event->button.time);
{
MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_X11 (backend))
{
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XIAllowEvents (xdisplay, clutter_input_device_get_device_id (event->button.device),
XIReplayDevice, event->button.time);
}
}
/* Don't handle the event so it's sent back to clients. */
}
else if (fully_modified && (int) event->button.button == meta_prefs_get_mouse_button_resize ())
{
@ -2046,7 +2036,7 @@ meta_display_handle_event (MetaDisplay *display,
event->button.x,
event->button.y);
}
bypass_wayland = TRUE;
handled = TRUE;
}
else if (fully_modified && (int) event->button.button == meta_prefs_get_mouse_button_menu ())
{
@ -2057,7 +2047,7 @@ meta_display_handle_event (MetaDisplay *display,
event->button.y,
event->button.button,
event->any.time);
bypass_wayland = TRUE;
handled = TRUE;
}
else if (fully_modified && (int) event->button.button == 1)
{
@ -2075,8 +2065,31 @@ meta_display_handle_event (MetaDisplay *display,
event->button.x,
event->button.y);
}
handled = TRUE;
}
/* Under X11, we have a Sync grab and in order to send it back to
* clients, we have to explicitly replay it.
*
* Under Wayland, we retrieve all events and we have to make sure
* to filter them out from Wayland clients.
*/
if (handled)
{
bypass_wayland = TRUE;
}
else
{
MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_X11 (backend))
{
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
meta_verbose ("Allowing events time %u\n",
(unsigned int)event->button.time);
XIAllowEvents (xdisplay, clutter_event_get_device_id (event),
XIReplayDevice, event->button.time);
}
}
}
out: