[mutter] pointer: Fix the behavior of the pointer under DND



commit 607730e96c887919132f03c9dfa17ed4086c3302
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Oct 6 15:41:13 2014 -0700

    pointer: Fix the behavior of the pointer under DND
    
    When grabbing with DND, we need to leave the pointer alone and
    under the client's control. The code here was a bit messy before about
    when it unset the window cursor -- it did it whenever there was no
    current surface after repicking, which is a bit wrong, since it will
    fire during a drag grab.
    
    Move the check for this to update_cursor_surface, which is our standard
    "sync" API for this, and then call update_cursor_surface after we set
    the focus.

 src/wayland/meta-wayland-pointer.c |   38 ++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index a38a35f..40ec1ab 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -305,9 +305,6 @@ repick_for_event (MetaWaylandPointer *pointer,
   else
     pointer->current = NULL;
 
-  if (pointer->cursor_tracker && pointer->current == NULL)
-    meta_cursor_tracker_unset_window_cursor (pointer->cursor_tracker);
-
   sync_focus_surface (pointer);
 }
 
@@ -542,6 +539,8 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
             }
         }
     }
+
+  meta_wayland_pointer_update_cursor_surface (pointer);
 }
 
 void
@@ -750,25 +749,32 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
 void
 meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer)
 {
-  MetaCursorReference *cursor;
-
   if (pointer->cursor_tracker == NULL)
     return;
 
-  if (pointer->cursor_surface && pointer->cursor_surface->buffer)
+  if (pointer->current)
     {
-      struct wl_resource *buffer = pointer->cursor_surface->buffer->resource;
-      cursor = meta_cursor_reference_from_buffer (buffer,
-                                                  pointer->hotspot_x,
-                                                  pointer->hotspot_y);
-    }
-  else
-    cursor = NULL;
+      MetaCursorReference *cursor;
 
-  meta_cursor_tracker_set_window_cursor (pointer->cursor_tracker, cursor);
+      if (pointer->cursor_surface && pointer->cursor_surface->buffer)
+        {
+          struct wl_resource *buffer = pointer->cursor_surface->buffer->resource;
+          cursor = meta_cursor_reference_from_buffer (buffer,
+                                                      pointer->hotspot_x,
+                                                      pointer->hotspot_y);
+        }
+      else
+        cursor = NULL;
 
-  if (cursor)
-    meta_cursor_reference_unref (cursor);
+      meta_cursor_tracker_set_window_cursor (pointer->cursor_tracker, cursor);
+
+      if (cursor)
+        meta_cursor_reference_unref (cursor);
+    }
+  else
+    {
+      meta_cursor_tracker_unset_window_cursor (pointer->cursor_tracker);
+    }
 }
 
 static void


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