[gtk+] Implement gdk_display_get_cursor_for_surface in quartz



commit dfbd0c2b98e9c2ef9113e5c525f8a8931ba4ebdb
Author: John Ralls <jralls ceridwen us>
Date:   Sun Aug 11 10:43:35 2013 -0700

    Implement gdk_display_get_cursor_for_surface in quartz
    
    Left out of b2113b7, breaking quartz build

 gdk/quartz/gdkcursor-quartz.c  |   17 ++++++++++-------
 gdk/quartz/gdkdisplay-quartz.c |    2 +-
 gdk/quartz/gdkprivate-quartz.h |   16 ++++++++--------
 3 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/gdk/quartz/gdkcursor-quartz.c b/gdk/quartz/gdkcursor-quartz.c
index 1b1ed3e..dfcb860 100644
--- a/gdk/quartz/gdkcursor-quartz.c
+++ b/gdk/quartz/gdkcursor-quartz.c
@@ -250,25 +250,28 @@ _gdk_quartz_display_get_cursor_for_type (GdkDisplay    *display,
 
 
 GdkCursor *
-_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display,
-                                           GdkPixbuf  *pixbuf,
-                                           gint        x,
-                                           gint        y)
+_gdk_quartz_display_get_cursor_for_surface (GdkDisplay      *display,
+                                           cairo_surface_t *surface,
+                                           gdouble          x,
+                                           gdouble          y)
 {
   NSImage *image;
   NSCursor *nscursor;
   GdkCursor *cursor;
-  gboolean has_alpha;
+  GdkPixbuf *pixbuf;
 
   GDK_QUARTZ_ALLOC_POOL;
 
-  has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
-
+  pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
+                                       cairo_image_surface_get_width (surface),
+                                       cairo_image_surface_get_height (surface));
   image = gdk_quartz_pixbuf_to_ns_image_libgtk_only (pixbuf);
   nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
 
   cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
 
+  g_object_unref (pixbuf);
+
   GDK_QUARTZ_RELEASE_POOL;
 
   return cursor;
diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c
index b78bac9..6b4afc8 100644
--- a/gdk/quartz/gdkdisplay-quartz.c
+++ b/gdk/quartz/gdkdisplay-quartz.c
@@ -316,7 +316,7 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
   display_class->list_devices = gdk_quartz_display_list_devices;
   display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type;
   display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name;
-  display_class->get_cursor_for_pixbuf = _gdk_quartz_display_get_cursor_for_pixbuf;
+  display_class->get_cursor_for_surface = _gdk_quartz_display_get_cursor_for_surface;
   display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;
   display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
   display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index ff857c1..2f9059b 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -96,14 +96,14 @@ void       _gdk_quartz_display_event_data_free (GdkDisplay     *display,
                                                 GdkEvent       *event);
 
 /* Display methods - cursor */
-GdkCursor *_gdk_quartz_display_get_cursor_for_type     (GdkDisplay    *display,
-                                                        GdkCursorType  type);
-GdkCursor *_gdk_quartz_display_get_cursor_for_name     (GdkDisplay    *display,
-                                                        const gchar   *name);
-GdkCursor *_gdk_quartz_display_get_cursor_for_pixbuf   (GdkDisplay    *display,
-                                                        GdkPixbuf     *pixbuf,
-                                                        gint           x,
-                                                        gint           y);
+GdkCursor *_gdk_quartz_display_get_cursor_for_type     (GdkDisplay      *display,
+                                                        GdkCursorType    type);
+GdkCursor *_gdk_quartz_display_get_cursor_for_name     (GdkDisplay      *display,
+                                                        const gchar     *name);
+GdkCursor *_gdk_quartz_display_get_cursor_for_surface  (GdkDisplay      *display,
+                                                        cairo_surface_t *surface,
+                                                        gdouble          x,
+                                                        gdouble          y);
 gboolean   _gdk_quartz_display_supports_cursor_alpha   (GdkDisplay    *display);
 gboolean   _gdk_quartz_display_supports_cursor_color   (GdkDisplay    *display);
 void       _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,


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