[mutter] cursor: Retrieve the GBM device from the MetaBackend



commit d27e26738265e7773d9d3e3aa19ea03777a3c46d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Apr 22 15:23:45 2014 -0400

    cursor: Retrieve the GBM device from the MetaBackend
    
    Not the MetaCursorTracker.

 src/backends/meta-cursor-tracker-private.h |    2 --
 src/backends/meta-cursor-tracker.c         |    6 ------
 src/backends/meta-cursor.c                 |   19 ++++++++++++++-----
 3 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/src/backends/meta-cursor-tracker-private.h b/src/backends/meta-cursor-tracker-private.h
index fa743c6..1819be3 100644
--- a/src/backends/meta-cursor-tracker-private.h
+++ b/src/backends/meta-cursor-tracker-private.h
@@ -85,6 +85,4 @@ void     meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
 
 void     meta_cursor_tracker_force_update (MetaCursorTracker *tracker);
 
-struct gbm_device * meta_cursor_tracker_get_gbm_device (MetaCursorTracker *tracker);
-
 #endif
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index 12fe21c..2a1b1bd 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -488,9 +488,3 @@ meta_cursor_tracker_force_update (MetaCursorTracker *tracker)
 
   meta_cursor_renderer_force_update (tracker->renderer);
 }
-
-struct gbm_device *
-meta_cursor_tracker_get_gbm_device (MetaCursorTracker *tracker)
-{
-  return meta_cursor_renderer_get_gbm_device (tracker->renderer);
-}
diff --git a/src/backends/meta-cursor.c b/src/backends/meta-cursor.c
index 232bf67..6df9a39 100644
--- a/src/backends/meta-cursor.c
+++ b/src/backends/meta-cursor.c
@@ -27,6 +27,7 @@
 
 #include "display-private.h"
 #include "screen-private.h"
+#include "meta-backend.h"
 #include "meta-cursor-tracker-private.h"
 
 #include <string.h>
@@ -175,6 +176,14 @@ meta_cursor_image_load_gbm_buffer (struct gbm_device *gbm,
     meta_warning ("HW cursor for format %d not supported\n", gbm_format);
 }
 
+static struct gbm_device *
+get_gbm_device (void)
+{
+  MetaBackend *meta_backend = meta_get_backend ();
+  MetaCursorRenderer *renderer = meta_backend_get_cursor_renderer (meta_backend);
+  return meta_cursor_renderer_get_gbm_device (renderer);
+}
+
 static void
 meta_cursor_image_load_from_xcursor_image (MetaCursorTracker *tracker,
                                            MetaCursorImage   *image,
@@ -210,7 +219,7 @@ meta_cursor_image_load_from_xcursor_image (MetaCursorTracker *tracker,
                                                   (uint8_t *) xc_image->pixels,
                                                   NULL);
 
-  gbm = meta_cursor_tracker_get_gbm_device (tracker);
+  gbm = get_gbm_device ();
   if (gbm)
     meta_cursor_image_load_gbm_buffer (gbm,
                                        image,
@@ -239,18 +248,18 @@ meta_cursor_reference_from_theme (MetaCursorTracker  *tracker,
 }
 
 static void
-meta_cursor_image_load_from_buffer (MetaCursorTracker  *tracker,
-                                    MetaCursorImage    *image,
+meta_cursor_image_load_from_buffer (MetaCursorImage    *image,
                                     struct wl_resource *buffer,
                                     int                 hot_x,
                                     int                 hot_y)
 {
+  struct gbm_device *gbm = get_gbm_device ();
+
   ClutterBackend *backend;
   CoglContext *cogl_context;
   struct wl_shm_buffer *shm_buffer;
   uint32_t gbm_format;
   int width, height;
-  struct gbm_device *gbm = meta_cursor_tracker_get_gbm_device (tracker);
 
   image->hot_x = hot_x;
   image->hot_y = hot_y;
@@ -333,7 +342,7 @@ meta_cursor_reference_from_buffer (MetaCursorTracker  *tracker,
 
   self = g_slice_new0 (MetaCursorReference);
   self->ref_count = 1;
-  meta_cursor_image_load_from_buffer (tracker, &self->image, buffer, hot_x, hot_y);
+  meta_cursor_image_load_from_buffer (&self->image, buffer, hot_x, hot_y);
 
   return self;
 }


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