core: Create passive button grab on topmost Window

With the frames client, we do no longer handle events for the
frame window inside Mutter. This means we do not get events
"for free" to handle focus on a just clicked frame window.
This results in a background window not ending up focused if
clicked on its frame.

In order to fix this, make the passive button grab extend to
the frame window if a window has one. This brings back
focus-on-click behavior, while treating windows further as
a unitary surface.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2727
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2954>
This commit is contained in:
Carlos Garnacho 2023-04-12 10:23:49 +02:00
parent a42bc34e4d
commit f744acefee

View File

@ -1205,7 +1205,10 @@ meta_change_button_grab (MetaKeyBindingManager *keys,
meta_clutter_x11_trap_x_errors ();
xwindow = window->xwindow;
if (window->frame)
xwindow = window->frame->xwindow;
else
xwindow = window->xwindow;
/* GrabModeSync means freeze until XAllowEvents */
if (grab)