Bug 596250 - Gdkcursor-quartz.c doesn't implement GDK_BLANK_CURSOR

Support GDK_BLANK_CURSOR.  Patch by John Ralls.
This commit is contained in:
Kristian Rietveld 2009-09-25 18:16:06 +02:00
parent cdec2caaf3
commit 785e55f87d

View File

@ -45,6 +45,21 @@ gdk_quartz_cursor_new_from_nscursor (NSCursor *nscursor,
return cursor;
}
static GdkCursor *
create_blank_cursor (void)
{
NSCursor *nscursor;
NSImage *nsimage;
NSSize size = { 1.0, 1.0 };
nsimage = [[NSImage alloc] initWithSize:size];
nscursor = [[NSCursor alloc] initWithImage:nsimage
hotSpot:NSMakePoint(0.0, 0.0)];
[nsimage release];
return gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_BLANK_CURSOR);
}
static gboolean
get_bit (const guchar *data,
gint width,
@ -79,7 +94,7 @@ create_builtin_cursor (GdkCursorType cursor_type)
NSImage *image;
NSCursor *nscursor;
if (cursor_type >= G_N_ELEMENTS (xcursors))
if (cursor_type >= G_N_ELEMENTS (xcursors) || cursor_type < 0)
return NULL;
cursor = cached_xcursors[cursor_type];
@ -210,6 +225,10 @@ gdk_cursor_new_for_display (GdkDisplay *display,
case GDK_HAND2:
nscursor = [NSCursor pointingHandCursor];
break;
case GDK_CURSOR_IS_PIXMAP:
return NULL;
case GDK_BLANK_CURSOR:
return create_blank_cursor ();
default:
return gdk_cursor_ref (create_builtin_cursor (cursor_type));
}