wayland: Bypass popup grab focus if other handlers are in effect

If other handlers (e.g. DnD) are on top of the popup grab focus, we
may want it to move outside same-client surfaces as the popup grab
specifies.

Check that it is the current handler before making same-client checks,
so that these handlers on top have an opportunity to find other
surfaces, e.g. during DnD from a popup.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1681
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3937>
This commit is contained in:
Carlos Garnacho 2024-08-06 15:31:40 +02:00 committed by Marge Bot
parent 22362378ea
commit c179bebb70

View File

@ -116,12 +116,15 @@ popup_grab_get_focus_surface (MetaWaylandEventHandler *handler,
}
else
{
MetaWaylandInput *input = meta_wayland_seat_get_input (popup_grab->seat);
surface = meta_wayland_event_handler_chain_up_get_focus_surface (handler,
device,
sequence);
if (surface && surface->resource &&
wl_resource_get_client (surface->resource) == popup_grab->grab_client)
if (!meta_wayland_input_is_current_handler (input, handler) ||
(surface && surface->resource &&
wl_resource_get_client (surface->resource) == popup_grab->grab_client))
return surface;
}