core: Avoid grab transfer shenanigans with non-X11 backend

This explicit ungrab is made to ensure the other X11 display connection
is able to start an active grab immediately on the device without receiving
AlreadyGrabbed.

This is just relevant if there's two X11 display connections to transfer
grabs across, which may just happen on X11 windowing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
This commit is contained in:
Carlos Garnacho 2018-12-30 13:15:36 +01:00 committed by Jonas Ådahl
parent ef074ea510
commit 103c469cc9

View File

@ -1677,14 +1677,17 @@ meta_display_begin_grab_op (MetaDisplay *display,
if (pointer_already_grabbed) if (pointer_already_grabbed)
display->grab_have_pointer = TRUE; display->grab_have_pointer = TRUE;
/* Since grab operations often happen as a result of implicit if (META_IS_BACKEND_X11 (meta_get_backend ()) && display->x11_display)
* pointer operations on the display X11 connection, we need {
* to ungrab here to ensure that the backend's X11 can take /* Since grab operations often happen as a result of implicit
* the device grab. */ * pointer operations on the display X11 connection, we need
XIUngrabDevice (display->x11_display->xdisplay, * to ungrab here to ensure that the backend's X11 can take
META_VIRTUAL_CORE_POINTER_ID, * the device grab. */
timestamp); XIUngrabDevice (display->x11_display->xdisplay,
XSync (display->x11_display->xdisplay, False); META_VIRTUAL_CORE_POINTER_ID,
timestamp);
XSync (display->x11_display->xdisplay, False);
}
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp)) if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
display->grab_have_pointer = TRUE; display->grab_have_pointer = TRUE;