21#import <AppKit/NSCursor.h>
22#import <AppKit/NSImage.h>
35 cursor_t *cursor =
safe_calloc(1,
sizeof (*cursor));
41 ASSERT(filename_png != NULL);
42 path = [NSString stringWithUTF8String: filename_png];
43 img = [[NSImage alloc] initWithContentsOfFile: path];
45 logMsg(
"Can't open image %s: %s", filename_png,
50 rep = [[img representations] objectAtIndex: 0];
52 p = NSMakePoint([rep pixelsWide] / 2, [rep pixelsHigh] / 2);
53 cursor->crs = [[NSCursor alloc] initWithImage: img hotSpot: p];
54 ASSERT(cursor->crs != NULL);
64 ASSERT(cursor->crs != NULL);
65 [cursor->crs release];
73 ASSERT(cursor->crs != NULL);
void cursor_make_current(cursor_t *cursor)
cursor_t * cursor_read_from_file(const char *filename_png)
void cursor_free(cursor_t *cursor)
static void * safe_calloc(size_t nmemb, size_t size)