mirror of
https://github.com/fltk/fltk.git
synced 2026-08-17 16:43:10 +08:00
Simplify Fl_Cocoa_Window_Driver::set_cursor() for macOS version 10.6 or more - cont'd
This commit is contained in:
+2
-13
@@ -3765,16 +3765,6 @@ int Fl_Cocoa_Window_Driver::set_cursor(Fl_Cursor c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@interface FLCustomCursor : NSCursor
|
||||
-(void)dealloc;
|
||||
@end
|
||||
@implementation FLCustomCursor
|
||||
-(void)dealloc {
|
||||
[[self image] release];
|
||||
[super dealloc];
|
||||
}
|
||||
@end
|
||||
|
||||
int Fl_Cocoa_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
|
||||
if (cursor) {
|
||||
[(NSCursor*)cursor release];
|
||||
@@ -3799,9 +3789,8 @@ int Fl_Cocoa_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int
|
||||
}
|
||||
NSImage *nsimage = [[NSImage alloc] initWithCGImage:*cgimg // 10.6
|
||||
size:NSMakeSize(image->w(), image->h())];
|
||||
cursor = [[FLCustomCursor alloc]
|
||||
initWithImage:nsimage
|
||||
hotSpot:NSMakePoint(hotx, hoty)];
|
||||
cursor = [[NSCursor alloc] initWithImage:nsimage hotSpot:NSMakePoint(hotx, hoty)];
|
||||
[nsimage release];
|
||||
[fl_xid(pWindow) invalidateCursorRectsForView:[fl_xid(pWindow) contentView]];
|
||||
|
||||
if (image->as_svg_image()) delete image;
|
||||
|
||||
Reference in New Issue
Block a user