From f37a172dc78cf4a473defa3dc20effc6d1558aa6 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 25 Jul 2019 09:39:07 +0200 Subject: [PATCH] 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 --- src/core/events.c | 16 +++++++++++++++- src/core/window.c | 3 --- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/events.c b/src/core/events.c index 699b5b4b7..8a046b398 100644 --- a/src/core/events.c +++ b/src/core/events.c @@ -352,7 +352,21 @@ meta_display_handle_event (MetaDisplay *display, */ bypass_clutter = !IS_GESTURE_EVENT (event); - meta_window_handle_ungrabbed_event (window, 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); /* This might start a grab op. If it does, then filter out the * event, and if it doesn't, replay the event to release our diff --git a/src/core/window.c b/src/core/window.c index 80588c7e9..caf447fbf 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -8266,9 +8266,6 @@ meta_window_handle_ungrabbed_event (MetaWindow *window, gfloat x, y; guint button; - if (meta_window_handle_ui_frame_event (window, event)) - return; - if (event->type != CLUTTER_BUTTON_PRESS && event->type != CLUTTER_TOUCH_BEGIN) return;