[mutter] wayland: Update pointer confinement on surface actor relocations



commit 01de04d8c91b1be142e06b2203589bfcd9b52e93
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 9 14:49:10 2017 +0200

    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

 src/wayland/meta-pointer-confinement-wayland.c |   28 ++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-pointer-confinement-wayland.c b/src/wayland/meta-pointer-confinement-wayland.c
index 8f41db5..65a85c4 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);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]