[mutter/wayland] cursor-tracker: Rearrange code



commit b64d14ff4ac1a125a56a8df77cd41f1504f1d3bf
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 31 14:26:28 2014 -0400

    cursor-tracker: Rearrange code
    
    Move take_texture closer to where it's used, and add hot_x / hot_y args.

 src/core/meta-cursor-tracker.c |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c
index 84ccbf9..b2a619f 100644
--- a/src/core/meta-cursor-tracker.c
+++ b/src/core/meta-cursor-tracker.c
@@ -342,19 +342,6 @@ meta_cursor_reference_from_theme (MetaCursorTracker  *tracker,
 }
 
 static MetaCursorReference *
-meta_cursor_reference_take_texture (CoglTexture2D *texture)
-{
-  MetaCursorReference *self;
-
-  self = g_slice_new0 (MetaCursorReference);
-  self->ref_count = 1;
-
-  self->texture = texture;
-
-  return self;
-}
-
-static MetaCursorReference *
 meta_cursor_reference_from_buffer (MetaCursorTracker  *tracker,
                                    struct wl_resource *buffer,
                                    int                 hot_x,
@@ -659,6 +646,22 @@ meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
   return TRUE;
 }
 
+static MetaCursorReference *
+meta_cursor_reference_take_texture (CoglTexture2D *texture,
+                                    int            hot_x,
+                                    int            hot_y)
+{
+  MetaCursorReference *self;
+
+  self = g_slice_new0 (MetaCursorReference);
+  self->ref_count = 1;
+  self->texture = texture;
+  self->hot_x = hot_x;
+  self->hot_y = hot_y;
+
+  return self;
+}
+
 static void
 ensure_xfixes_cursor (MetaCursorTracker *tracker)
 {
@@ -715,10 +718,9 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
 
   if (sprite != NULL)
     {
-      MetaCursorReference *cursor = meta_cursor_reference_take_texture (sprite);
-      cursor->hot_x = cursor_image->xhot;
-      cursor->hot_y = cursor_image->yhot;
-
+      MetaCursorReference *cursor = meta_cursor_reference_take_texture (sprite,
+                                                                        cursor_image->xhot,
+                                                                        cursor_image->yhot);
       set_window_cursor (tracker, TRUE, cursor);
     }
   XFree (cursor_image);


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