mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Change the way the image for the cursor gets passed on to the backend.
The old way could only work for 8 bit data. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32491 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0456c89f56
commit
d4d795bdb2
4 changed files with 11 additions and 34 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-03-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* gui/Headers/Additions/GNUstepGUI/GSDisplayServer.h
|
||||
* gui/Source/GSDisplayServer.m
|
||||
* gui/Source/NSCursor.m: Change the way the image for the cursor
|
||||
gets passed on to the backend. The old way could only work for 8
|
||||
bit data.
|
||||
|
||||
2011-03-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSKeyValueBinding.h
|
||||
|
|
|
@ -165,8 +165,7 @@ APPKIT_EXPORT NSString *GSScreenNumber;
|
|||
- (void) hidecursor;
|
||||
- (void) showcursor;
|
||||
- (void) standardcursor: (int) style : (void**)cid;
|
||||
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors
|
||||
: (const unsigned char *) image : (void**)cid;
|
||||
- (void) imagecursor: (NSPoint)hotp : (NSImage *) image : (void**)cid;
|
||||
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*)cid;
|
||||
- (void) recolorcursor: (NSColor *)fg : (NSColor *)bg : (void*) cid;
|
||||
- (void) setcursor: (void*) cid;
|
||||
|
|
|
@ -891,8 +891,7 @@ GSCurrentServer(void)
|
|||
/** Create a cursor from an image. Returns a pointer to the internal
|
||||
device representation that can be used later to make this cursor
|
||||
the current one */
|
||||
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors
|
||||
: (const unsigned char *) image : (void**) cid
|
||||
- (void) imagecursor: (NSPoint)hotp : (NSImage *) image : (void**) cid
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
|
|
@ -83,7 +83,6 @@ static NSMutableDictionary *cursorDict = nil;
|
|||
- (void) _computeCid
|
||||
{
|
||||
void *c;
|
||||
NSBitmapImageRep *rep;
|
||||
|
||||
if (_cursor_image == nil)
|
||||
{
|
||||
|
@ -91,35 +90,7 @@ static NSMutableDictionary *cursorDict = nil;
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
We should rather convert the image to a bitmap representation here via
|
||||
the following code, but this is currently not supported by the libart backend
|
||||
|
||||
{
|
||||
NSSize size = [_cursor_image size];
|
||||
|
||||
[_cursor_image lockFocus];
|
||||
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:
|
||||
NSMakeRect(0, 0, size.width, size.height)];
|
||||
AUTORELEASE(rep);
|
||||
[_cursor_image unlockFocus];
|
||||
}
|
||||
*/
|
||||
rep = (NSBitmapImageRep *)[_cursor_image bestRepresentationForDevice: nil];
|
||||
if (!rep || ![rep respondsToSelector: @selector(samplesPerPixel)])
|
||||
{
|
||||
NSLog(@"NSCursor can only handle NSBitmapImageReps for now");
|
||||
return;
|
||||
}
|
||||
if (_hot_spot.x >= [rep pixelsWide])
|
||||
_hot_spot.x = [rep pixelsWide]-1;
|
||||
|
||||
if (_hot_spot.y >= [rep pixelsHigh])
|
||||
_hot_spot.y = [rep pixelsHigh]-1;
|
||||
|
||||
[GSCurrentServer() imagecursor: _hot_spot
|
||||
: [rep pixelsWide] : [rep pixelsHigh]
|
||||
: [rep samplesPerPixel] : [rep bitmapData] : &c];
|
||||
[GSCurrentServer() imagecursor: _hot_spot : _cursor_image : &c];
|
||||
_cid = c;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue