From c179bebb706b5357c64d573b5fa5980a217c9397 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 6 Aug 2024 15:31:40 +0200 Subject: [PATCH] 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: --- src/wayland/meta-wayland-popup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-popup.c b/src/wayland/meta-wayland-popup.c index dfd757990..5037e44cb 100644 --- a/src/wayland/meta-wayland-popup.c +++ b/src/wayland/meta-wayland-popup.c @@ -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; }