diff --git a/ChangeLog b/ChangeLog index 79693e120..02961d429 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-02-15 Fred Kiefer + + * Headers/Additions/GNUstepGUI/GSDisplayServer.h, + * Source/GSDisplayServer.m (-recolorcursor:::, -recolorcursor:::) + (-setcursor:, -freecursor:): New backend methods replacing + -setcursorcolor:::. + * Source/NSCursor.m, + * Source/GSDragView.m: Use new cursor methods. + 2011-02-15 Fred Kiefer * Source/NSWindow.m (-setContentView:): Revert Wolfgangs change diff --git a/Headers/Additions/GNUstepGUI/GSDisplayServer.h b/Headers/Additions/GNUstepGUI/GSDisplayServer.h index 23ec8f65f..1b36e0164 100644 --- a/Headers/Additions/GNUstepGUI/GSDisplayServer.h +++ b/Headers/Additions/GNUstepGUI/GSDisplayServer.h @@ -168,6 +168,9 @@ APPKIT_EXPORT NSString *GSScreenNumber; - (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors : (const unsigned char *) image : (void**)cid; - (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*)cid; +- (void) recolorcursor: (NSColor *)fg : (NSColor *)bg : (void*) cid; +- (void) setcursor: (void*) cid; +- (void) freecursor: (void*) cid; - (void) setParentWindow: (int)parentWin forChildWindow: (int)childWin; diff --git a/Source/GSDisplayServer.m b/Source/GSDisplayServer.m index b5f4fa1fe..8e643b240 100644 --- a/Source/GSDisplayServer.m +++ b/Source/GSDisplayServer.m @@ -902,6 +902,28 @@ GSCurrentServer(void) background color bg. To keep the default color for the cursor, pass nil for fg and bg. */ - (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid +{ + NSLog(@"Call to obsolete method -setcursorcolor:::"); + [self recolorcursor: fg : bg : cid]; + [self setcursor: cid]; +} + +/** Recolour the cursor given by the cid representation into having + a foreground color fg and a background color bg. */ +- (void) recolorcursor: (NSColor *)fg : (NSColor *)bg : (void*) cid +{ + [self subclassResponsibility: _cmd]; +} + +/** Set the cursor given by the cid representation as being the + current cursor. */ +- (void) setcursor: (void*) cid +{ + [self subclassResponsibility: _cmd]; +} + +/** Free the cursor given by the cid representation. */ +- (void) freecursor: (void*) cid { [self subclassResponsibility: _cmd]; } diff --git a/Source/GSDragView.m b/Source/GSDragView.m index ec04f9ff8..c1c8ef85d 100644 --- a/Source/GSDragView.m +++ b/Source/GSDragView.m @@ -553,20 +553,20 @@ static GSDragView *sharedDragView = nil; } } - [newCursor set]; - if ((targetWindowRef != 0) && mask != NSDragOperationNone) { - [GSCurrentServer() setcursorcolor: [NSColor greenColor] + [GSCurrentServer() recolorcursor: [NSColor greenColor] : [NSColor blackColor] : [newCursor _cid]]; } else { - [GSCurrentServer() setcursorcolor: [NSColor blackColor] + [GSCurrentServer() recolorcursor: [NSColor blackColor] : [NSColor whiteColor] : [newCursor _cid]]; } + + [newCursor set]; } - (void) _sendLocalEvent: (GSAppKitSubtype)subtype diff --git a/Source/NSCursor.m b/Source/NSCursor.m index dc97b9afb..6f06b7e56 100644 --- a/Source/NSCursor.m +++ b/Source/NSCursor.m @@ -296,9 +296,8 @@ NSCursor *getStandardCursor(NSString *name, int style) cursor = [[NSCursor_class alloc] initWithImage: nil]; [GSCurrentServer() standardcursor: GSArrowCursor : &c]; - // FIXME: This make the cursor active - [GSCurrentServer() setcursorcolor: [NSColor greenColor] - : [NSColor blackColor] : c]; + [GSCurrentServer() recolorcursor: [NSColor greenColor] + : [NSColor blackColor] : c]; [cursor _setCid: c]; [cursorDict setObject: cursor forKey: name]; RELEASE(cursor); @@ -357,14 +356,17 @@ backgroundColorHint:(NSColor *)bg fg = [NSColor blackColor]; bg = [bg colorUsingColorSpaceName: NSDeviceRGBColorSpace]; fg = [fg colorUsingColorSpaceName: NSDeviceRGBColorSpace]; - // FIXME: This make the cursor active - [GSCurrentServer() setcursorcolor: fg : bg : _cid]; + [GSCurrentServer() recolorcursor: fg : bg : _cid]; } return self; } - (void) dealloc { RELEASE (_cursor_image); + if (_cid) + { + [GSCurrentServer() freecursor: _cid]; + } [super dealloc]; } @@ -494,7 +496,7 @@ backgroundColorHint:(NSColor *)bg gnustep_gui_current_cursor = self; if (_cid) { - [GSCurrentServer() setcursorcolor: nil : nil : _cid]; + [GSCurrentServer() setcursor: _cid]; } }