events: Bypass windows with modal transients

The expected behavior for modal dialogs is that the user
cannot interact with the parent window. However toolkits
like GTK and Qt can only implement that behavior for windows
within the same process.

Address this by enforcing that behavior in the compositor to
get "foreign" windows and other toolkits behave consistently.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4825

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2123>
This commit is contained in:
Florian Müllner 2021-11-30 18:04:56 +01:00
parent ccf6bbc673
commit 3643e0ba1e

View File

@ -420,10 +420,15 @@ meta_display_handle_event (MetaDisplay *display,
* See: https://gitlab.gnome.org/GNOME/mutter/issues/88 * See: https://gitlab.gnome.org/GNOME/mutter/issues/88
*/ */
if (meta_window_handle_ui_frame_event (window, event)) if (meta_window_handle_ui_frame_event (window, event))
{
bypass_wayland = (event->type == CLUTTER_BUTTON_PRESS || bypass_wayland = (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN); event->type == CLUTTER_TOUCH_BEGIN);
}
else else
{
bypass_wayland = meta_window_has_modals (window);
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
* event, and if it doesn't, replay the event to release our * event, and if it doesn't, replay the event to release our