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:
Fred Kiefer 2011-02-15 22:54:23 +00:00
parent 466714c847
commit 03bc4d79d6
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>
* 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
: (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;

View file

@ -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];
}

View file

@ -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

View file

@ -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];
}
}