[mutter] display: Replace set_grab_op_cursor with update_cursor



commit 71544fbf4e22d3e0579c3cef817e95fa8f80950d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed May 14 09:16:20 2014 -0400

    display: Replace set_grab_op_cursor with update_cursor
    
    Now that we don't have to regrab to change the cursor, since it's
    simply the cursor on the root window, all we have to do is update
    the cursor on the screen.

 src/core/display-private.h |    4 +---
 src/core/display.c         |   23 +++++++++--------------
 src/core/window.c          |    6 +-----
 3 files changed, 11 insertions(+), 22 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index abc0088..451f94a 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -367,9 +367,7 @@ MetaDisplay* meta_get_display            (void);
 Cursor         meta_display_create_x_cursor (MetaDisplay *display,
                                              MetaCursor   cursor);
 
-void     meta_display_set_grab_op_cursor (MetaDisplay *display,
-                                          MetaGrabOp   op,
-                                          guint32      timestamp);
+void     meta_display_update_cursor (MetaDisplay *display);
 
 void    meta_display_check_threshold_reached (MetaDisplay *display,
                                               int          x,
diff --git a/src/core/display.c b/src/core/display.c
index bb59468..f740779 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1696,17 +1696,9 @@ meta_cursor_for_grab_op (MetaGrabOp op)
 }
 
 void
-meta_display_set_grab_op_cursor (MetaDisplay *display,
-                                 MetaGrabOp   op,
-                                 guint32      timestamp)
+meta_display_update_cursor (MetaDisplay *display)
 {
-  /* Set root cursor */
-  MetaBackend *backend = meta_get_backend ();
-
-  meta_screen_set_cursor (display->screen, meta_cursor_for_grab_op (op));
-
-  if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
-    display->grab_have_pointer = TRUE;
+  meta_screen_set_cursor (display->screen, meta_cursor_for_grab_op (display->grab_op));
 }
 
 static MetaWindow *
@@ -1734,6 +1726,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
                             int          root_x,
                             int          root_y)
 {
+  MetaBackend *backend = meta_get_backend ();
   MetaWindow *grab_window = NULL;
 
   g_assert (window != NULL);
@@ -1788,7 +1781,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
                   timestamp);
   XSync (display->xdisplay, False);
 
-  meta_display_set_grab_op_cursor (display, op, timestamp);
+  if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
+    display->grab_have_pointer = TRUE;
 
   if (!display->grab_have_pointer && !meta_grab_op_is_keyboard (op))
     {
@@ -1803,7 +1797,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
 
       if (!display->grab_have_keyboard)
         {
-          MetaBackend *backend = meta_get_backend ();
           meta_topic (META_DEBUG_WINDOW_OPS, "grabbing all keys failed, ungrabbing pointer\n");
           meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
           display->grab_have_pointer = FALSE;
@@ -1827,6 +1820,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
   display->grab_resize_unmaximize = 0;
   display->grab_timestamp = timestamp;
 
+  meta_display_update_cursor (display);
+
   if (display->grab_resize_timeout_id)
     {
       g_source_remove (display->grab_resize_timeout_id);
@@ -1896,14 +1891,14 @@ meta_display_end_grab_op (MetaDisplay *display,
       meta_window_ungrab_all_keys (display->grab_window, timestamp);
     }
 
-  meta_screen_set_cursor (display->screen, META_CURSOR_DEFAULT);
-
   display->grab_timestamp = 0;
   display->grab_window = NULL;
   display->grab_tile_mode = META_TILE_NONE;
   display->grab_tile_monitor_number = -1;
   display->grab_op = META_GRAB_OP_NONE;
 
+  meta_display_update_cursor (display);
+
   if (display->grab_resize_timeout_id)
     {
       g_source_remove (display->grab_resize_timeout_id);
diff --git a/src/core/window.c b/src/core/window.c
index a08180e..5ead253 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -7057,11 +7057,7 @@ meta_window_update_keyboard_resize (MetaWindow *window,
                      &x, &y);
 
   if (update_cursor)
-    {
-      meta_display_set_grab_op_cursor (window->display,
-                                       window->display->grab_op,
-                                       window->display->grab_timestamp);
-    }
+    meta_display_update_cursor (window->display);
 }
 
 void


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