[mutter/wayland] wayland-seat: Don't send pointer enter/leave events during a GRAB_OP



commit 89685010313c2c902d4a0f2856138507112c1559
Author: Rui Matos <tiagomatos gmail com>
Date:   Sun Mar 16 20:32:52 2014 +0100

    wayland-seat: Don't send pointer enter/leave events during a GRAB_OP
    
    meta_wayland_seat_repick() can be called in various cases while mutter
    has a GRAB_OP ongoing which means we could be sending wrong pointer
    enter/leave events.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726123

 src/wayland/meta-wayland-pointer.c |   13 +++++++++++++
 src/wayland/meta-wayland-pointer.h |    4 ++++
 src/wayland/meta-wayland-seat.c    |   15 ++++++++-------
 3 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 336cea0..9e423a4 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -583,3 +583,16 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
   *sx = wl_fixed_from_double (xf);
   *sy = wl_fixed_from_double (yf);
 }
+
+void
+meta_wayland_pointer_update_current_focus (MetaWaylandPointer *pointer,
+                                           MetaWaylandSurface *surface)
+{
+  pointer->current = surface;
+  if (surface != pointer->focus_surface)
+    {
+      const MetaWaylandPointerGrabInterface *interface =
+        pointer->grab->interface;
+      interface->focus (pointer->grab, surface);
+    }
+}
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index 5eb6756..d5e3038 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -94,4 +94,8 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
                                               wl_fixed_t         *x,
                                               wl_fixed_t         *y);
 
+void
+meta_wayland_pointer_update_current_focus (MetaWaylandPointer *pointer,
+                                           MetaWaylandSurface *surface);
+
 #endif /* __META_WAYLAND_POINTER_H__ */
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 85c244b..4b08e4a 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -434,6 +434,13 @@ meta_wayland_seat_repick (MetaWaylandSeat    *seat,
   ClutterActor       *actor   = NULL;
   MetaWaylandPointer *pointer = &seat->pointer;
   MetaWaylandSurface *surface = NULL;
+  MetaDisplay        *display = meta_get_display ();
+
+  if (display->grab_op != META_GRAB_OP_NONE)
+    {
+      meta_wayland_pointer_update_current_focus (pointer, NULL);
+      return;
+    }
 
   if (for_event)
     {
@@ -456,13 +463,7 @@ meta_wayland_seat_repick (MetaWaylandSeat    *seat,
   if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
     surface = meta_surface_actor_wayland_get_surface (META_SURFACE_ACTOR_WAYLAND (actor));
 
-  pointer->current = surface;
-  if (surface != pointer->focus_surface)
-    {
-      const MetaWaylandPointerGrabInterface *interface =
-        pointer->grab->interface;
-      interface->focus (pointer->grab, surface);
-    }
+  meta_wayland_pointer_update_current_focus (pointer, surface);
 }
 
 void


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