Implement gdk_display_get_cursor_for_surface in quartz

Left out of b2113b7, breaking quartz build
This commit is contained in:
John Ralls 2013-08-11 10:43:35 -07:00
parent 31c2e95cbd
commit dfbd0c2b98
3 changed files with 19 additions and 16 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,