From 4fa2706b9b45874cfd7e48d686e993fc173eabc2 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 26 Feb 2024 11:14:54 +0100 Subject: [PATCH] wayland: Look up pointer logical focus when enabling constraints Pointer constraints obey to logical pointer focus changes, and looking up the current surface in order to maybe enable them is getting ahead of itself, since the pointer focus might differ from the current surface due to other factors (e.g. grabs). Change the code checking whether constraints should be enabled to again check the pointer logical focus, this will be influenced by the MetaWaylandEventInterface mechanism, and correctly reflect the logical state accounting for those factors. Fixes: 125ba92169 ("wayland: Port pointer constraints to using MetaWaylandEventInterface") Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3303 Part-of: --- src/wayland/meta-wayland-pointer-constraints.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c index 178197d7e..4f8cc3196 100644 --- a/src/wayland/meta-wayland-pointer-constraints.c +++ b/src/wayland/meta-wayland-pointer-constraints.c @@ -482,7 +482,8 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint) if (window->unmanaging) return FALSE; - if (constraint->seat->pointer->current != constraint->surface) + if (constraint->surface != + meta_wayland_pointer_get_focus_surface (constraint->seat->pointer)) return FALSE; if (meta_wayland_surface_is_xwayland (constraint->surface))