mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 11:41:56 +00:00
Prevent duplicate the cursor with -push.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36848 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
39a773e9e7
commit
c60b6b5c60
3 changed files with 32 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2013-07-07 German A. Arias <german@xelalug.org>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSCursor.h: Add _windowNum and _cursorRect.
|
||||||
|
* Source/NSCursor.m (-init, -push, -pop): Store at cursor object the
|
||||||
|
rect and the window where this is displayed. So the next time the app
|
||||||
|
request push this cursor, it can compare if currently is displayed for
|
||||||
|
that rect in that window. To prevent duplicate the cursor.
|
||||||
|
|
||||||
2013-07-07 Fred Kiefer <FredKiefer@gmx.de>
|
2013-07-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSImageRep.m (-guiDrawInRect:...fraction:): Readd special
|
* Source/NSImageRep.m (-guiDrawInRect:...fraction:): Readd special
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
unsigned int reserved: 25;
|
unsigned int reserved: 25;
|
||||||
} _cursor_flags;
|
} _cursor_flags;
|
||||||
void *_cid;
|
void *_cid;
|
||||||
|
NSInteger _windowNum;
|
||||||
|
NSRect _cursorRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -35,11 +35,13 @@
|
||||||
|
|
||||||
#import "AppKit/NSColor.h"
|
#import "AppKit/NSColor.h"
|
||||||
#import "AppKit/NSCursor.h"
|
#import "AppKit/NSCursor.h"
|
||||||
|
#import "AppKit/NSEvent.h"
|
||||||
#import "AppKit/NSGraphics.h"
|
#import "AppKit/NSGraphics.h"
|
||||||
#import "AppKit/NSImage.h"
|
#import "AppKit/NSImage.h"
|
||||||
#import "AppKit/NSBitmapImageRep.h"
|
#import "AppKit/NSBitmapImageRep.h"
|
||||||
|
|
||||||
#import "GNUstepGUI/GSDisplayServer.h"
|
#import "GNUstepGUI/GSDisplayServer.h"
|
||||||
|
#import "GNUstepGUI/GSTrackingRect.h"
|
||||||
|
|
||||||
// Class variables
|
// Class variables
|
||||||
static NSMutableArray *gnustep_gui_cursor_stack;
|
static NSMutableArray *gnustep_gui_cursor_stack;
|
||||||
|
@ -315,6 +317,8 @@ NSCursor *getStandardCursor(NSString *name, int style)
|
||||||
*/
|
*/
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
|
_windowNum = -1;
|
||||||
|
_cursorRect = NSZeroRect;
|
||||||
return [self initWithImage: nil hotSpot: NSZeroPoint];
|
return [self initWithImage: nil hotSpot: NSZeroPoint];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,11 +444,26 @@ backgroundColorHint:(NSColor *)bg
|
||||||
}
|
}
|
||||||
else if (_cursor_flags.is_set_on_mouse_exited == NO)
|
else if (_cursor_flags.is_set_on_mouse_exited == NO)
|
||||||
{
|
{
|
||||||
|
NSInteger num = [theEvent windowNumber];
|
||||||
|
GSTrackingRect *r =(GSTrackingRect*)[theEvent userData];
|
||||||
/*
|
/*
|
||||||
* Undocumented behavior - if a cursor is not set on exit or entry,
|
* Undocumented behavior - if a cursor is not set on exit or entry,
|
||||||
* we assume a push-pop situation instead.
|
* we assume a push-pop situation instead.
|
||||||
*/
|
*/
|
||||||
[self push];
|
|
||||||
|
/* First check if the cursor rect is currently updated. This prevent
|
||||||
|
* add the same cursor for the same cursor rect. This happen sometimes
|
||||||
|
* when the window become the main/key window, and the cursor is over
|
||||||
|
* a cursor rect.
|
||||||
|
*/
|
||||||
|
if ( !(NSEqualRects(_cursorRect, r->rectangle) &&
|
||||||
|
(_windowNum == num) &&
|
||||||
|
[gnustep_gui_current_cursor isEqual: self]) )
|
||||||
|
{
|
||||||
|
[self push];
|
||||||
|
_windowNum = num;
|
||||||
|
_cursorRect = r->rectangle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,6 +485,8 @@ backgroundColorHint:(NSColor *)bg
|
||||||
* we assume a push-pop situation instead.
|
* we assume a push-pop situation instead.
|
||||||
*/
|
*/
|
||||||
[self pop];
|
[self pop];
|
||||||
|
_windowNum = -1;
|
||||||
|
_cursorRect = NSZeroRect;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue