[mutter/wayland] cursor: Refactor out code that loads from XcursorImage



commit 0f810a4e21e099927e47a9ac4260c95b11e435a7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 31 16:09:32 2014 -0400

    cursor: Refactor out code that loads from XcursorImage

 src/core/meta-cursor.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/src/core/meta-cursor.c b/src/core/meta-cursor.c
index bc1d140..94cf341 100644
--- a/src/core/meta-cursor.c
+++ b/src/core/meta-cursor.c
@@ -181,11 +181,10 @@ load_cursor_on_client (MetaDisplay *display,
   return image;
 }
 
-MetaCursorReference *
-meta_cursor_reference_from_theme (MetaCursorTracker  *tracker,
-                                  MetaCursor          cursor)
+static MetaCursorReference *
+meta_cursor_reference_from_xcursor_image (MetaCursorTracker  *tracker,
+                                          XcursorImage       *image)
 {
-  XcursorImage *image;
   int width, height, rowstride;
   CoglPixelFormat cogl_format;
   uint32_t gbm_format;
@@ -193,10 +192,6 @@ meta_cursor_reference_from_theme (MetaCursorTracker  *tracker,
   CoglContext *cogl_context;
   MetaCursorReference *self;
 
-  image = load_cursor_on_client (tracker->screen->display, cursor);
-  if (!image)
-    return NULL;
-
   width           = image->width;
   height          = image->height;
   rowstride       = width * 4;
@@ -250,8 +245,23 @@ meta_cursor_reference_from_theme (MetaCursorTracker  *tracker,
     }
 
  out:
-  XcursorImageDestroy (image);
+  return self;
+}
+
+MetaCursorReference *
+meta_cursor_reference_from_theme (MetaCursorTracker  *tracker,
+                                  MetaCursor          cursor)
+{
+  MetaCursorReference *self;
+  XcursorImage *image;
 
+  image = load_cursor_on_client (tracker->screen->display, cursor);
+  if (!image)
+    return NULL;
+
+  self = meta_cursor_reference_from_xcursor_image (tracker, image);
+
+  XcursorImageDestroy (image);
   return self;
 }
 


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