events: No UI frame button press events for Wayland

When double clicking to un-maximize an X11 window under Wayland, there
is a race between X11 and Wayland protocols and the X11 XConfigureWindow
may be processed by Xwayland before the button press event is forwarded
via the Wayland protocol.

As a result, the second click may reach another X11 window placed right
underneath in the X11 stack.

Make sure we do not forward the button press event to Wayland if it was
handled by the frame UI.

https://gitlab.gnome.org/GNOME/mutter/issues/88
This commit is contained in:
Olivier Fourdan 2019-07-25 09:39:07 +02:00
parent ad62a659eb
commit f37a172dc7
2 changed files with 15 additions and 4 deletions

View File

@ -352,6 +352,20 @@ meta_display_handle_event (MetaDisplay *display,
*/ */
bypass_clutter = !IS_GESTURE_EVENT (event); bypass_clutter = !IS_GESTURE_EVENT (event);
/* When double clicking to un-maximize an X11 window under Wayland,
* there is a race between X11 and Wayland protocols and the X11
* XConfigureWindow may be processed by Xwayland before the button
* press event is forwarded via the Wayland protocol.
* As a result, the second click may reach another X11 window placed
* immediately underneath in the X11 stack.
* The following is to make sure we do not forward the button press
* event to Wayland if it was handled by the frame UI.
* See: https://gitlab.gnome.org/GNOME/mutter/issues/88
*/
if (meta_window_handle_ui_frame_event (window, event))
bypass_wayland = (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN);
else
meta_window_handle_ungrabbed_event (window, event); meta_window_handle_ungrabbed_event (window, event);
/* This might start a grab op. If it does, then filter out the /* This might start a grab op. If it does, then filter out the

View File

@ -8266,9 +8266,6 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
gfloat x, y; gfloat x, y;
guint button; guint button;
if (meta_window_handle_ui_frame_event (window, event))
return;
if (event->type != CLUTTER_BUTTON_PRESS && if (event->type != CLUTTER_BUTTON_PRESS &&
event->type != CLUTTER_TOUCH_BEGIN) event->type != CLUTTER_TOUCH_BEGIN)
return; return;