From b7fc6480dd659d98e046fd23095509991f6bbe9e Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 9 Oct 2017 14:49:10 +0200 Subject: [PATCH] wayland: Update pointer confinement on surface actor relocations In the unlikely case that a surface is moved by the compositor while holding a pointer confinement, we also need to update the pointer position when the surface actor gets moved. https://bugzilla.gnome.org/show_bug.cgi?id=782344 --- .../meta-pointer-confinement-wayland.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/wayland/meta-pointer-confinement-wayland.c b/src/wayland/meta-pointer-confinement-wayland.c index 8f41db5ba..65a85c47b 100644 --- a/src/wayland/meta-pointer-confinement-wayland.c +++ b/src/wayland/meta-pointer-confinement-wayland.c @@ -671,6 +671,21 @@ surface_actor_allocation_notify (MetaSurfaceActorWayland *surface_actor, meta_pointer_confinement_wayland_maybe_warp (self); } +static void +surface_actor_position_notify (MetaSurfaceActorWayland *surface_actor, + GParamSpec *pspec, + MetaPointerConfinementWayland *self) +{ + meta_pointer_confinement_wayland_maybe_warp (self); +} + +static void +window_position_changed (MetaWindow *window, + MetaPointerConfinementWayland *self) +{ + meta_pointer_confinement_wayland_maybe_warp (self); +} + MetaPointerConstraint * meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint) { @@ -689,6 +704,19 @@ meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint) G_CALLBACK (surface_actor_allocation_notify), confinement, 0); + g_signal_connect_object (surface->surface_actor, + "notify::position", + G_CALLBACK (surface_actor_position_notify), + confinement, + 0); + if (surface->window) + { + g_signal_connect_object (surface->window, + "position-changed", + G_CALLBACK (window_position_changed), + confinement, + 0); + } return META_POINTER_CONSTRAINT (confinement); }