Define new cursor backend methods replacing -setcursorcolor:::. And use

these.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32179 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2011-02-15 22:54:23 +00:00
parent f2c7420e36
commit 003ea0982a
5 changed files with 46 additions and 10 deletions

View file

@ -1,3 +1,12 @@
2011-02-15 Fred Kiefer <FredKiefer@gmx.de>
* 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 <FredKiefer@gmx.de> 2011-02-15 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m (-setContentView:): Revert Wolfgangs change * Source/NSWindow.m (-setContentView:): Revert Wolfgangs change

View file

@ -168,6 +168,9 @@ APPKIT_EXPORT NSString *GSScreenNumber;
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors - (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors
: (const unsigned char *) image : (void**)cid; : (const unsigned char *) image : (void**)cid;
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (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 - (void) setParentWindow: (int)parentWin
forChildWindow: (int)childWin; forChildWindow: (int)childWin;

View file

@ -902,6 +902,28 @@ GSCurrentServer(void)
background color bg. To keep the default color for the cursor, pass background color bg. To keep the default color for the cursor, pass
nil for fg and bg. */ nil for fg and bg. */
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid - (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]; [self subclassResponsibility: _cmd];
} }

View file

@ -553,20 +553,20 @@ static GSDragView *sharedDragView = nil;
} }
} }
[newCursor set];
if ((targetWindowRef != 0) && mask != NSDragOperationNone) if ((targetWindowRef != 0) && mask != NSDragOperationNone)
{ {
[GSCurrentServer() setcursorcolor: [NSColor greenColor] [GSCurrentServer() recolorcursor: [NSColor greenColor]
: [NSColor blackColor] : [NSColor blackColor]
: [newCursor _cid]]; : [newCursor _cid]];
} }
else else
{ {
[GSCurrentServer() setcursorcolor: [NSColor blackColor] [GSCurrentServer() recolorcursor: [NSColor blackColor]
: [NSColor whiteColor] : [NSColor whiteColor]
: [newCursor _cid]]; : [newCursor _cid]];
} }
[newCursor set];
} }
- (void) _sendLocalEvent: (GSAppKitSubtype)subtype - (void) _sendLocalEvent: (GSAppKitSubtype)subtype

View file

@ -296,9 +296,8 @@ NSCursor *getStandardCursor(NSString *name, int style)
cursor = [[NSCursor_class alloc] initWithImage: nil]; cursor = [[NSCursor_class alloc] initWithImage: nil];
[GSCurrentServer() standardcursor: GSArrowCursor : &c]; [GSCurrentServer() standardcursor: GSArrowCursor : &c];
// FIXME: This make the cursor active [GSCurrentServer() recolorcursor: [NSColor greenColor]
[GSCurrentServer() setcursorcolor: [NSColor greenColor] : [NSColor blackColor] : c];
: [NSColor blackColor] : c];
[cursor _setCid: c]; [cursor _setCid: c];
[cursorDict setObject: cursor forKey: name]; [cursorDict setObject: cursor forKey: name];
RELEASE(cursor); RELEASE(cursor);
@ -357,14 +356,17 @@ backgroundColorHint:(NSColor *)bg
fg = [NSColor blackColor]; fg = [NSColor blackColor];
bg = [bg colorUsingColorSpaceName: NSDeviceRGBColorSpace]; bg = [bg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
fg = [fg colorUsingColorSpaceName: NSDeviceRGBColorSpace]; fg = [fg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
// FIXME: This make the cursor active [GSCurrentServer() recolorcursor: fg : bg : _cid];
[GSCurrentServer() setcursorcolor: fg : bg : _cid];
} }
return self; return self;
} }
- (void) dealloc - (void) dealloc
{ {
RELEASE (_cursor_image); RELEASE (_cursor_image);
if (_cid)
{
[GSCurrentServer() freecursor: _cid];
}
[super dealloc]; [super dealloc];
} }
@ -494,7 +496,7 @@ backgroundColorHint:(NSColor *)bg
gnustep_gui_current_cursor = self; gnustep_gui_current_cursor = self;
if (_cid) if (_cid)
{ {
[GSCurrentServer() setcursorcolor: nil : nil : _cid]; [GSCurrentServer() setcursor: _cid];
} }
} }