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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
This commit is contained in:
Carlos Garnacho 2024-02-26 11:14:54 +01:00 committed by Marge Bot
parent 1d5676bc9a
commit 4fa2706b9b

View File

@ -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))