wayland/pointer-constraints: Warp pointer after destroying resource
e994fbf02
moved warping the pointer to before the destruction of the resource to prevent dereferencing the constraint after destruction. This however meant that the constraint was still active when the motion event caused by the warp is handled, which would constrain the pointer back again to its original position. This moves the warping of the pointer back to after the destruction of the resource and instead just retrieves the seat earlier while the constraint is still valid. Fixes:e994fbf02
("wayland/pointer-constraints: Warp pointer before destroying resource") Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3696 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4098> (cherry picked from commitcb34fafd57
)
This commit is contained in:
parent
7848c15baf
commit
5bcaa7c80b
1 changed files with 4 additions and 3 deletions
|
@ -938,6 +938,7 @@ locked_pointer_destroy (struct wl_client *client,
|
||||||
{
|
{
|
||||||
MetaWaylandPointerConstraint *constraint =
|
MetaWaylandPointerConstraint *constraint =
|
||||||
wl_resource_get_user_data (resource);
|
wl_resource_get_user_data (resource);
|
||||||
|
ClutterSeat *seat;
|
||||||
gboolean warp_pointer = FALSE;
|
gboolean warp_pointer = FALSE;
|
||||||
int warp_x, warp_y;
|
int warp_x, warp_y;
|
||||||
|
|
||||||
|
@ -957,12 +958,12 @@ locked_pointer_destroy (struct wl_client *client,
|
||||||
warp_pointer = TRUE;
|
warp_pointer = TRUE;
|
||||||
warp_x = (int) x;
|
warp_x = (int) x;
|
||||||
warp_y = (int) y;
|
warp_y = (int) y;
|
||||||
|
seat = constraint->seat->clutter_seat;
|
||||||
}
|
}
|
||||||
|
wl_resource_destroy (resource);
|
||||||
|
|
||||||
if (warp_pointer)
|
if (warp_pointer)
|
||||||
clutter_seat_warp_pointer (constraint->seat->clutter_seat, warp_x, warp_y);
|
clutter_seat_warp_pointer (seat, warp_x, warp_y);
|
||||||
|
|
||||||
wl_resource_destroy (resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue