mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
Fixes for cursor updating
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5189 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d59ae9927b
commit
e462f6a88a
11 changed files with 355 additions and 274 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Tracking rectangle class
|
Tracking rectangle class
|
||||||
|
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
@ -38,18 +38,20 @@
|
||||||
NSTrackingRectTag tag;
|
NSTrackingRectTag tag;
|
||||||
id owner;
|
id owner;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
BOOL inside;
|
struct TrackFlagsType {
|
||||||
BOOL isValid;
|
unsigned inside:1;
|
||||||
BOOL ownerRespondsToMouseEntered;
|
unsigned isValid:1;
|
||||||
BOOL ownerRespondsToMouseExited;
|
unsigned checked:1;
|
||||||
|
unsigned ownerRespondsToMouseEntered:1;
|
||||||
|
unsigned ownerRespondsToMouseExited:1;
|
||||||
|
} flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance methods
|
- (id) initWithRect: (NSRect)aRect
|
||||||
- initWithRect: (NSRect)aRect
|
tag: (NSTrackingRectTag)aTag
|
||||||
tag: (NSTrackingRectTag)aTag
|
owner: (id)anObject
|
||||||
owner: anObject
|
userData: (void *)theData
|
||||||
userData: (void *)theData
|
inside: (BOOL)flag;
|
||||||
inside: (BOOL)flag;
|
|
||||||
|
|
||||||
- (NSRect) rectangle;
|
- (NSRect) rectangle;
|
||||||
- (NSTrackingRectTag) tag;
|
- (NSTrackingRectTag) tag;
|
||||||
|
@ -60,12 +62,13 @@
|
||||||
- (BOOL) isValid;
|
- (BOOL) isValid;
|
||||||
- (void) invalidate;
|
- (void) invalidate;
|
||||||
|
|
||||||
//
|
/*
|
||||||
// NSCoding protocol
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // _GNUstep_H_GSTrackingRect
|
#endif /* _GNUstep_H_GSTrackingRect */
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Holds an image to use as a cursor
|
Holds an image to use as a cursor
|
||||||
|
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
@ -36,58 +36,58 @@
|
||||||
|
|
||||||
@interface NSCursor : NSObject <NSCoding>
|
@interface NSCursor : NSObject <NSCoding>
|
||||||
{
|
{
|
||||||
// Attributes
|
NSImage *cursor_image;
|
||||||
NSImage *cursor_image;
|
NSPoint hot_spot;
|
||||||
NSPoint hot_spot;
|
BOOL is_set_on_mouse_entered;
|
||||||
BOOL is_set_on_mouse_entered;
|
BOOL is_set_on_mouse_exited;
|
||||||
BOOL is_set_on_mouse_exited;
|
void *cid;
|
||||||
|
|
||||||
void *cid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Initializing a New NSCursor Object
|
* Initializing a New NSCursor Object
|
||||||
//
|
*/
|
||||||
- (id)initWithImage:(NSImage *)newImage;
|
- (id) initWithImage: (NSImage *)newImage;
|
||||||
|
- (id) initWithImage: (NSImage *)newImage
|
||||||
|
hotSpot: (NSPoint)hotSpot;
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Defining the Cursor
|
* Defining the Cursor
|
||||||
//
|
*/
|
||||||
- (NSPoint)hotSpot;
|
- (NSPoint) hotSpot;
|
||||||
- (NSImage *)image;
|
- (NSImage*) image;
|
||||||
- (void)setHotSpot:(NSPoint)spot;
|
- (void) setHotSpot: (NSPoint)spot;
|
||||||
- (void)setImage:(NSImage *)newImage;
|
- (void) setImage: (NSImage *)newImage;
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Setting the Cursor
|
* Setting the Cursor
|
||||||
//
|
*/
|
||||||
+ (void)hide;
|
+ (void) hide;
|
||||||
+ (void)pop;
|
+ (void) pop;
|
||||||
+ (void)setHiddenUntilMouseMoves:(BOOL)flag;
|
+ (void) setHiddenUntilMouseMoves: (BOOL)flag;
|
||||||
+ (BOOL)isHiddenUntilMouseMoves;
|
+ (BOOL) isHiddenUntilMouseMoves;
|
||||||
+ (void)unhide;
|
+ (void) unhide;
|
||||||
- (BOOL)isSetOnMouseEntered;
|
- (BOOL) isSetOnMouseEntered;
|
||||||
- (BOOL)isSetOnMouseExited;
|
- (BOOL) isSetOnMouseExited;
|
||||||
- (void)mouseEntered:(NSEvent *)theEvent;
|
- (void) mouseEntered: (NSEvent*)theEvent;
|
||||||
- (void)mouseExited:(NSEvent *)theEvent;
|
- (void) mouseExited: (NSEvent*)theEvent;
|
||||||
- (void)pop;
|
- (void) pop;
|
||||||
- (void)push;
|
- (void) push;
|
||||||
- (void)set;
|
- (void) set;
|
||||||
- (void)setOnMouseEntered:(BOOL)flag;
|
- (void) setOnMouseEntered: (BOOL)flag;
|
||||||
- (void)setOnMouseExited:(BOOL)flag;
|
- (void) setOnMouseExited: (BOOL)flag;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Getting the Cursor
|
||||||
|
*/
|
||||||
|
+ (NSCursor*) arrowCursor;
|
||||||
|
+ (NSCursor*) currentCursor;
|
||||||
|
+ (NSCursor*) IBeamCursor;
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Getting the Cursor
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
+ (NSCursor *)arrowCursor;
|
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||||
+ (NSCursor *)currentCursor;
|
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||||
+ (NSCursor *)IBeamCursor;
|
|
||||||
|
|
||||||
//
|
|
||||||
// NSCoding protocol
|
|
||||||
//
|
|
||||||
- (void)encodeWithCoder:aCoder;
|
|
||||||
- initWithCoder:aDecoder;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -97,4 +97,4 @@ typedef enum {
|
||||||
GSIBeamCursor
|
GSIBeamCursor
|
||||||
} GSCursorTypes;
|
} GSCursorTypes;
|
||||||
|
|
||||||
#endif // _GNUstep_H_NSCursor
|
#endif /* _GNUstep_H_NSCursor */
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
unsigned has_trkrects:1; /* This view has tracking rects */
|
unsigned has_trkrects:1; /* This view has tracking rects */
|
||||||
unsigned has_draginfo:1; /* View/window has drag types */
|
unsigned has_draginfo:1; /* View/window has drag types */
|
||||||
unsigned opaque_view:1;
|
unsigned opaque_view:1;
|
||||||
|
unsigned valid_rects:1; /* Some cursor rects are valid */
|
||||||
} _rFlags;
|
} _rFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
// Attributes
|
// Attributes
|
||||||
id _delegate;
|
id _delegate;
|
||||||
SEL _error_action;
|
SEL _error_action;
|
||||||
NSCursor *_text_cursor;
|
|
||||||
NSText *_text_object;
|
NSText *_text_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Tracking rectangle class
|
Tracking rectangle class
|
||||||
|
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
@ -31,9 +31,9 @@
|
||||||
|
|
||||||
@implementation GSTrackingRect
|
@implementation GSTrackingRect
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Class methods
|
* Class methods
|
||||||
//
|
*/
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [GSTrackingRect class])
|
if (self == [GSTrackingRect class])
|
||||||
|
@ -42,39 +42,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
- (id) initWithRect: (NSRect)aRect
|
||||||
// Instance methods
|
tag: (NSTrackingRectTag)aTag
|
||||||
//
|
owner: (id)anObject
|
||||||
//
|
userData: (void *)theData
|
||||||
// Initialization
|
inside: (BOOL)flag
|
||||||
//
|
|
||||||
- initWithRect: (NSRect)aRect
|
|
||||||
tag: (NSTrackingRectTag)aTag
|
|
||||||
owner: anObject
|
|
||||||
userData: (void *)theData
|
|
||||||
inside: (BOOL)flag
|
|
||||||
{
|
{
|
||||||
rectangle = aRect;
|
rectangle = aRect;
|
||||||
tag = aTag;
|
tag = aTag;
|
||||||
owner = anObject;
|
owner = anObject;
|
||||||
if (owner)
|
if (owner != nil)
|
||||||
{
|
{
|
||||||
[owner retain];
|
RETAIN(owner);
|
||||||
if ([owner respondsToSelector: @selector(mouseEntered:)])
|
|
||||||
ownerRespondsToMouseEntered = YES;
|
|
||||||
if ([owner respondsToSelector: @selector(mouseExited:)])
|
|
||||||
ownerRespondsToMouseExited = YES;
|
|
||||||
}
|
}
|
||||||
user_data = theData;
|
user_data = theData;
|
||||||
inside = flag;
|
flags.inside = flag;
|
||||||
isValid = YES;
|
flags.isValid = YES;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (owner)
|
TEST_RELEASE(owner);
|
||||||
[owner release];
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +77,7 @@
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- owner
|
- (id) owner
|
||||||
{
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
@ -100,34 +89,34 @@
|
||||||
|
|
||||||
- (BOOL) inside
|
- (BOOL) inside
|
||||||
{
|
{
|
||||||
return inside;
|
return flags.inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isValid
|
- (BOOL) isValid
|
||||||
{
|
{
|
||||||
return isValid;
|
return flags.isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) invalidate
|
- (void) invalidate
|
||||||
{
|
{
|
||||||
if (isValid)
|
if (flags.isValid)
|
||||||
{
|
{
|
||||||
isValid = NO;
|
flags.isValid = NO;
|
||||||
if (owner)
|
flags.checked = NO;
|
||||||
|
if (owner != nil)
|
||||||
{
|
{
|
||||||
[owner release];
|
DESTROY(owner);
|
||||||
owner = nil;
|
|
||||||
ownerRespondsToMouseEntered = NO;
|
|
||||||
ownerRespondsToMouseExited = NO;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// NSCoding protocol
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
|
BOOL inside = flags.inside;
|
||||||
|
|
||||||
[aCoder encodeRect: rectangle];
|
[aCoder encodeRect: rectangle];
|
||||||
[aCoder encodeValueOfObjCType: @encode(NSTrackingRectTag) at: &tag];
|
[aCoder encodeValueOfObjCType: @encode(NSTrackingRectTag) at: &tag];
|
||||||
[aCoder encodeObject: owner];
|
[aCoder encodeObject: owner];
|
||||||
|
@ -136,10 +125,13 @@
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
|
BOOL inside;
|
||||||
|
|
||||||
rectangle = [aDecoder decodeRect];
|
rectangle = [aDecoder decodeRect];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSTrackingRectTag) at: &tag];
|
[aDecoder decodeValueOfObjCType: @encode(NSTrackingRectTag) at: &tag];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &owner];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &owner];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &inside];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &inside];
|
||||||
|
flags.inside = inside;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <AppKit/NSView.h>
|
#include <AppKit/NSView.h>
|
||||||
#include <AppKit/NSControl.h>
|
#include <AppKit/NSControl.h>
|
||||||
#include <AppKit/NSCell.h>
|
#include <AppKit/NSCell.h>
|
||||||
|
#include <AppKit/NSCursor.h>
|
||||||
#include <AppKit/NSEvent.h>
|
#include <AppKit/NSEvent.h>
|
||||||
#include <AppKit/NSGraphics.h>
|
#include <AppKit/NSGraphics.h>
|
||||||
#include <AppKit/NSColor.h>
|
#include <AppKit/NSColor.h>
|
||||||
|
@ -112,7 +113,7 @@ static NSColor *shadowCol;
|
||||||
/*
|
/*
|
||||||
* Instance methods
|
* Instance methods
|
||||||
*/
|
*/
|
||||||
- _init
|
- (id) _init
|
||||||
{
|
{
|
||||||
cell_type = NSNullCellType;
|
cell_type = NSNullCellType;
|
||||||
cell_image = nil;
|
cell_image = nil;
|
||||||
|
@ -1113,6 +1114,26 @@ static NSColor *shadowCol;
|
||||||
*/
|
*/
|
||||||
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView *)controlView
|
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView *)controlView
|
||||||
{
|
{
|
||||||
|
if (cell_type == NSTextCellType && cell_enabled == YES
|
||||||
|
&& (cell_selectable == YES || cell_editable == YES))
|
||||||
|
{
|
||||||
|
static NSCursor *c = nil;
|
||||||
|
NSRect r;
|
||||||
|
|
||||||
|
if (c == nil)
|
||||||
|
{
|
||||||
|
c = RETAIN([NSCursor IBeamCursor]);
|
||||||
|
}
|
||||||
|
r = NSIntersectionRect(cellFrame, [controlView visibleRect]);
|
||||||
|
/*
|
||||||
|
* Here we depend on an undocumented feature of NSCursor which may or
|
||||||
|
* may not exist in OPENSTEP or MacOS-X ...
|
||||||
|
* If we add a cursor rect to a view and don't set it to be set on
|
||||||
|
* either entry to or exit from the view, we push it on entry and
|
||||||
|
* pop it from the cursor stack on exit.
|
||||||
|
*/
|
||||||
|
[controlView addCursorRect: r cursor: c];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -480,6 +480,11 @@ static Class cellClass;
|
||||||
[self sendAction: [self action] to: [self target]];
|
[self sendAction: [self action] to: [self target]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) resetCursorRects
|
||||||
|
{
|
||||||
|
[cell resetCursorRect: bounds inView: self];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) ignoresMultiClick
|
- (BOOL) ignoresMultiClick
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Holds an image to use as a cursor
|
Holds an image to use as a cursor
|
||||||
|
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
@ -39,10 +39,10 @@ static BOOL gnustep_gui_hidden_until_move;
|
||||||
|
|
||||||
@implementation NSCursor
|
@implementation NSCursor
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Class methods
|
* Class methods
|
||||||
//
|
*/
|
||||||
+ (void)initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSCursor class])
|
if (self == [NSCursor class])
|
||||||
{
|
{
|
||||||
|
@ -52,11 +52,11 @@ static BOOL gnustep_gui_hidden_until_move;
|
||||||
// Initialize class variables
|
// Initialize class variables
|
||||||
gnustep_gui_cursor_stack = [[NSMutableArray alloc] initWithCapacity: 2];
|
gnustep_gui_cursor_stack = [[NSMutableArray alloc] initWithCapacity: 2];
|
||||||
gnustep_gui_hidden_until_move = YES;
|
gnustep_gui_hidden_until_move = YES;
|
||||||
gnustep_gui_current_cursor = [[NSCursor arrowCursor] retain];
|
[[self arrowCursor] push];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void *)_cid
|
- (void *) _cid
|
||||||
{
|
{
|
||||||
return cid;
|
return cid;
|
||||||
}
|
}
|
||||||
|
@ -66,181 +66,207 @@ static BOOL gnustep_gui_hidden_until_move;
|
||||||
cid = id;
|
cid = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Setting the Cursor
|
* Setting the Cursor
|
||||||
//
|
*/
|
||||||
+ (void)hide
|
+ (void) hide
|
||||||
{
|
{
|
||||||
DPShidecursor(GSCurrentContext());
|
DPShidecursor(GSCurrentContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)pop
|
+ (void) pop
|
||||||
{
|
{
|
||||||
// The object we pop is the current cursor
|
/*
|
||||||
if ([gnustep_gui_cursor_stack count]) {
|
* The object we pop is the current cursor
|
||||||
gnustep_gui_current_cursor = [gnustep_gui_cursor_stack lastObject];
|
*/
|
||||||
[gnustep_gui_cursor_stack removeLastObject];
|
if ([gnustep_gui_cursor_stack count] > 1)
|
||||||
}
|
{
|
||||||
|
[gnustep_gui_cursor_stack removeLastObject];
|
||||||
|
gnustep_gui_current_cursor = [gnustep_gui_cursor_stack lastObject];
|
||||||
|
|
||||||
// If the stack isn't empty then get the new current cursor
|
if ([gnustep_gui_current_cursor _cid])
|
||||||
// Otherwise the cursor will stay the same
|
{
|
||||||
if ([gnustep_gui_cursor_stack count])
|
DPSsetcursorcolor(GSCurrentContext(), 0, 0, 0, 1, 1, 1,
|
||||||
gnustep_gui_current_cursor = [gnustep_gui_cursor_stack lastObject];
|
[gnustep_gui_current_cursor _cid]);
|
||||||
|
}
|
||||||
if ([gnustep_gui_current_cursor _cid])
|
}
|
||||||
DPSsetcursorcolor(GSCurrentContext(), 0, 0, 0, 1, 1, 1,
|
|
||||||
[gnustep_gui_current_cursor _cid]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)setHiddenUntilMouseMoves:(BOOL)flag
|
+ (void) setHiddenUntilMouseMoves: (BOOL)flag
|
||||||
{
|
{
|
||||||
gnustep_gui_hidden_until_move = flag;
|
gnustep_gui_hidden_until_move = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)isHiddenUntilMouseMoves
|
+ (BOOL) isHiddenUntilMouseMoves
|
||||||
{
|
{
|
||||||
return gnustep_gui_hidden_until_move;
|
return gnustep_gui_hidden_until_move;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)unhide
|
+ (void) unhide
|
||||||
{
|
{
|
||||||
DPSshowcursor(GSCurrentContext());
|
DPSshowcursor(GSCurrentContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Getting the Cursor
|
* Getting the Cursor
|
||||||
//
|
*/
|
||||||
+ (NSCursor *)arrowCursor
|
+ (NSCursor*) arrowCursor
|
||||||
{
|
{
|
||||||
void *c;
|
void *c;
|
||||||
NSCursor *cur = AUTORELEASE([[NSCursor alloc] initWithImage: nil]);
|
NSCursor *cur = AUTORELEASE([[NSCursor alloc] initWithImage: nil]);
|
||||||
|
|
||||||
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
|
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
|
||||||
[cur _setCid: c];
|
[cur _setCid: c];
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSCursor *)currentCursor
|
+ (NSCursor*) currentCursor
|
||||||
{
|
{
|
||||||
return gnustep_gui_current_cursor;
|
return gnustep_gui_current_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSCursor *)IBeamCursor
|
+ (NSCursor*) IBeamCursor
|
||||||
{
|
{
|
||||||
void *c;
|
void *c;
|
||||||
NSCursor *cur = AUTORELEASE([[NSCursor alloc] initWithImage: nil]);
|
NSCursor *cur = AUTORELEASE([[NSCursor alloc] initWithImage: nil]);
|
||||||
|
|
||||||
DPSstandardcursor(GSCurrentContext(), GSIBeamCursor, &c);
|
DPSstandardcursor(GSCurrentContext(), GSIBeamCursor, &c);
|
||||||
[cur _setCid: c];
|
[cur _setCid: c];
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Instance methods
|
* Initializing a New NSCursor Object
|
||||||
//
|
*/
|
||||||
|
- (id) init
|
||||||
//
|
|
||||||
// Initializing a New NSCursor Object
|
|
||||||
//
|
|
||||||
- init
|
|
||||||
{
|
{
|
||||||
return [self initWithImage: nil];
|
return [self initWithImage: nil hotSpot: NSMakePoint(0,15)];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithImage:(NSImage *)newImage
|
- (id) initWithImage: (NSImage *)newImage
|
||||||
{
|
{
|
||||||
[super init];
|
return [self initWithImage: newImage
|
||||||
|
hotSpot: NSMakePoint(0,15)];
|
||||||
cursor_image = newImage;
|
}
|
||||||
is_set_on_mouse_entered = NO;
|
|
||||||
is_set_on_mouse_exited = NO;
|
|
||||||
|
|
||||||
|
- (id) initWithImage: (NSImage *)newImage hotSpot: (NSPoint)spot
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil)
|
||||||
|
{
|
||||||
|
cursor_image = newImage;
|
||||||
|
hot_spot = spot;
|
||||||
|
is_set_on_mouse_entered = NO;
|
||||||
|
is_set_on_mouse_exited = NO;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Defining the Cursor
|
* Defining the Cursor
|
||||||
//
|
*/
|
||||||
- (NSPoint)hotSpot
|
- (NSPoint) hotSpot
|
||||||
{
|
{
|
||||||
return hot_spot;
|
return hot_spot;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSImage *)image
|
- (NSImage*) image
|
||||||
{
|
{
|
||||||
return cursor_image;
|
return cursor_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setHotSpot:(NSPoint)spot
|
- (void) setHotSpot: (NSPoint)spot
|
||||||
{
|
{
|
||||||
hot_spot = spot;
|
hot_spot = spot;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setImage:(NSImage *)newImage
|
- (void) setImage: (NSImage *)newImage
|
||||||
{
|
{
|
||||||
cursor_image = newImage;
|
cursor_image = newImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Setting the Cursor
|
* Setting the Cursor
|
||||||
//
|
*/
|
||||||
- (BOOL)isSetOnMouseEntered
|
- (BOOL) isSetOnMouseEntered
|
||||||
{
|
{
|
||||||
return is_set_on_mouse_entered;
|
return is_set_on_mouse_entered;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isSetOnMouseExited
|
- (BOOL) isSetOnMouseExited
|
||||||
{
|
{
|
||||||
return is_set_on_mouse_exited;
|
return is_set_on_mouse_exited;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hmm, how is this mouse entered/exited suppose to work?
|
- (void) mouseEntered: (NSEvent*)theEvent
|
||||||
// Is it simply what the doc says?
|
|
||||||
// If the cursor is set when the mouse enters
|
|
||||||
// then how does it get unset when the mouse exits?
|
|
||||||
- (void)mouseEntered:(NSEvent *)theEvent
|
|
||||||
{
|
{
|
||||||
if (is_set_on_mouse_entered)
|
if (is_set_on_mouse_entered == YES)
|
||||||
[self set];
|
{
|
||||||
|
[self set];
|
||||||
|
}
|
||||||
|
else if (is_set_on_mouse_exited == NO)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Undocumented behavior - if a cursor is not set on exit or entry,
|
||||||
|
* we assume a push-pop situation instead.
|
||||||
|
*/
|
||||||
|
[self push];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseExited:(NSEvent *)theEvent
|
- (void) mouseExited: (NSEvent*)theEvent
|
||||||
{
|
{
|
||||||
if (is_set_on_mouse_exited)
|
if (is_set_on_mouse_exited == YES)
|
||||||
[self set];
|
{
|
||||||
|
[self set];
|
||||||
|
}
|
||||||
|
else if (is_set_on_mouse_entered == NO)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Undocumented behavior - if a cursor is not set on exit or entry,
|
||||||
|
* we assume a push-pop situation instead.
|
||||||
|
*/
|
||||||
|
[self pop];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)pop
|
- (void) pop
|
||||||
{
|
{
|
||||||
[NSCursor pop];
|
[NSCursor pop];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)push
|
- (void) push
|
||||||
{
|
{
|
||||||
[gnustep_gui_cursor_stack addObject: self];
|
[gnustep_gui_cursor_stack addObject: self];
|
||||||
gnustep_gui_current_cursor = self;
|
gnustep_gui_current_cursor = self;
|
||||||
if (cid)
|
if (cid)
|
||||||
DPSsetcursorcolor(GSCurrentContext(), 0, 0, 0, 1, 1, 1, cid);
|
{
|
||||||
|
DPSsetcursorcolor(GSCurrentContext(), 0, 0, 0, 1, 1, 1, cid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)set
|
- (void) set
|
||||||
{
|
{
|
||||||
gnustep_gui_current_cursor = self;
|
gnustep_gui_current_cursor = self;
|
||||||
if (cid)
|
if (cid)
|
||||||
DPSsetcursorcolor(GSCurrentContext(), 0, 0, 0, 1, 1, 1, cid);
|
{
|
||||||
|
DPSsetcursorcolor(GSCurrentContext(), 0, 0, 0, 1, 1, 1, cid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setOnMouseEntered:(BOOL)flag
|
- (void) setOnMouseEntered: (BOOL)flag
|
||||||
{
|
{
|
||||||
is_set_on_mouse_entered = flag;
|
is_set_on_mouse_entered = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setOnMouseExited:(BOOL)flag
|
- (void) setOnMouseExited: (BOOL)flag
|
||||||
{
|
{
|
||||||
is_set_on_mouse_exited = flag;
|
is_set_on_mouse_exited = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// NSCoding protocol
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,32 +66,19 @@
|
||||||
[cell setEnabled: YES];
|
[cell setEnabled: YES];
|
||||||
[cell setEditable: YES];
|
[cell setEditable: YES];
|
||||||
[self setDrawsBackground: YES];
|
[self setDrawsBackground: YES];
|
||||||
_text_cursor = [[NSCursor IBeamCursor] retain];
|
|
||||||
_text_object = nil;
|
_text_object = nil;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
[_text_cursor release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Creating copies
|
// Creating copies
|
||||||
//
|
//
|
||||||
- (void) setTextCursor: (NSCursor *)aCursor
|
|
||||||
{
|
|
||||||
ASSIGN(_text_cursor, aCursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone*)zone
|
- (id) copyWithZone: (NSZone*)zone
|
||||||
{
|
{
|
||||||
id c;
|
NSTextField *c;
|
||||||
|
|
||||||
c = [(id)super copyWithZone: zone];
|
c = [super copyWithZone: zone];
|
||||||
[c setTextCursor: [NSCursor IBeamCursor]];
|
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -441,13 +428,6 @@
|
||||||
// In all other cases
|
// In all other cases
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// Manage the cursor
|
|
||||||
//
|
|
||||||
- (void) resetCursorRects
|
|
||||||
{
|
|
||||||
[self addCursorRect: bounds cursor: _text_cursor];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// NSCoding protocol
|
// NSCoding protocol
|
||||||
|
|
|
@ -1792,26 +1792,36 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
*/
|
*/
|
||||||
- (void) addCursorRect: (NSRect)aRect cursor: (NSCursor*)anObject
|
- (void) addCursorRect: (NSRect)aRect cursor: (NSCursor*)anObject
|
||||||
{
|
{
|
||||||
GSTrackingRect *m;
|
if (window != nil)
|
||||||
|
{
|
||||||
|
GSTrackingRect *m;
|
||||||
|
|
||||||
if (window)
|
aRect = [self convertRect: aRect toView: nil];
|
||||||
aRect = [self convertRect: aRect toView: nil];
|
m = [rectClass allocWithZone: NSDefaultMallocZone()];
|
||||||
m = [rectClass allocWithZone: NSDefaultMallocZone()];
|
m = [m initWithRect: aRect
|
||||||
m = [m initWithRect: aRect
|
tag: 0
|
||||||
tag: 0
|
owner: anObject
|
||||||
owner: anObject
|
userData: NULL
|
||||||
userData: NULL
|
inside: YES];
|
||||||
inside: YES];
|
[cursor_rects addObject: m];
|
||||||
[cursor_rects addObject: m];
|
RELEASE(m);
|
||||||
RELEASE(m);
|
_rFlags.has_currects = 1;
|
||||||
_rFlags.has_currects = 1;
|
_rFlags.valid_rects = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) discardCursorRects
|
- (void) discardCursorRects
|
||||||
{
|
{
|
||||||
[cursor_rects makeObjectsPerformSelector: @selector(invalidate)];
|
if (_rFlags.has_currects != 0)
|
||||||
[cursor_rects removeAllObjects];
|
{
|
||||||
_rFlags.has_currects = 0;
|
if (_rFlags.valid_rects != 0)
|
||||||
|
{
|
||||||
|
[cursor_rects makeObjectsPerformSelector: @selector(invalidate)];
|
||||||
|
_rFlags.valid_rects = 0;
|
||||||
|
}
|
||||||
|
[cursor_rects removeAllObjects];
|
||||||
|
_rFlags.has_currects = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeCursorRect: (NSRect)aRect cursor: (NSCursor*)anObject
|
- (void) removeCursorRect: (NSRect)aRect cursor: (NSCursor*)anObject
|
||||||
|
@ -1830,16 +1840,22 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
[o invalidate];
|
[o invalidate];
|
||||||
[cursor_rects removeObject: o];
|
[cursor_rects removeObject: o];
|
||||||
if ([cursor_rects count] == 0)
|
if ([cursor_rects count] == 0)
|
||||||
_rFlags.has_currects = 0;
|
{
|
||||||
|
_rFlags.has_currects = 0;
|
||||||
|
_rFlags.valid_rects = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
o = [e nextObject];
|
{
|
||||||
|
o = [e nextObject];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) resetCursorRects
|
- (void) resetCursorRects
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
{
|
{
|
||||||
|
@ -2530,6 +2546,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
unsigned count;
|
unsigned count;
|
||||||
|
|
||||||
coordinates_valid = NO;
|
coordinates_valid = NO;
|
||||||
|
if (_rFlags.valid_rects != 0)
|
||||||
|
{
|
||||||
|
[window invalidateCursorRectsForView: self];
|
||||||
|
}
|
||||||
if (_rFlags.has_subviews)
|
if (_rFlags.has_subviews)
|
||||||
{
|
{
|
||||||
count = [sub_views count];
|
count = [sub_views count];
|
||||||
|
|
|
@ -1077,31 +1077,39 @@ static NSMapTable* windowmaps = NULL;
|
||||||
cursor_rects_enabled = NO;
|
cursor_rects_enabled = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) discardCursorRectsForView: (NSView *)theView
|
static void
|
||||||
|
discardCursorRectsForView(NSView *theView)
|
||||||
{
|
{
|
||||||
if (((NSViewPtr)theView)->_rFlags.has_currects)
|
if (theView != nil)
|
||||||
[theView discardCursorRects];
|
|
||||||
|
|
||||||
if (((NSViewPtr)theView)->_rFlags.has_subviews)
|
|
||||||
{
|
{
|
||||||
NSArray *s = ((NSViewPtr)theView)->sub_views;
|
if (((NSViewPtr)theView)->_rFlags.has_currects)
|
||||||
unsigned count = [s count];
|
|
||||||
|
|
||||||
if (count)
|
|
||||||
{
|
{
|
||||||
NSView *subs[count];
|
[theView discardCursorRects];
|
||||||
unsigned i;
|
}
|
||||||
|
|
||||||
[s getObjects: subs];
|
if (((NSViewPtr)theView)->_rFlags.has_subviews)
|
||||||
for (i = 0; i < count; i++)
|
{
|
||||||
[self discardCursorRectsForView: subs[i]];
|
NSArray *s = ((NSViewPtr)theView)->sub_views;
|
||||||
|
unsigned count = [s count];
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
|
NSView *subs[count];
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
[s getObjects: subs];
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
discardCursorRectsForView(subs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) discardCursorRects
|
- (void) discardCursorRects
|
||||||
{
|
{
|
||||||
[self discardCursorRectsForView: [content_view superview]];
|
discardCursorRectsForView([content_view superview]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) enableCursorRects
|
- (void) enableCursorRects
|
||||||
|
@ -1111,34 +1119,46 @@ static NSMapTable* windowmaps = NULL;
|
||||||
|
|
||||||
- (void) invalidateCursorRectsForView: (NSView *)aView
|
- (void) invalidateCursorRectsForView: (NSView *)aView
|
||||||
{
|
{
|
||||||
cursor_rects_valid = NO;
|
if (((NSViewPtr)aView)->_rFlags.valid_rects)
|
||||||
|
{
|
||||||
|
[((NSViewPtr)aView)->cursor_rects
|
||||||
|
makeObjectsPerformSelector: @selector(invalidate)];
|
||||||
|
((NSViewPtr)aView)->_rFlags.valid_rects = 0;
|
||||||
|
cursor_rects_valid = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) resetCursorRectsForView: (NSView *)theView
|
static void
|
||||||
|
resetCursorRectsForView(NSView *theView)
|
||||||
{
|
{
|
||||||
if (((NSViewPtr)theView)->_rFlags.has_currects)
|
if (theView != nil)
|
||||||
[theView resetCursorRects];
|
|
||||||
|
|
||||||
if (((NSViewPtr)theView)->_rFlags.has_subviews)
|
|
||||||
{
|
{
|
||||||
NSArray *s = ((NSViewPtr)theView)->sub_views;
|
[theView resetCursorRects];
|
||||||
unsigned count = [s count];
|
|
||||||
|
|
||||||
if (count)
|
if (((NSViewPtr)theView)->_rFlags.has_subviews)
|
||||||
{
|
{
|
||||||
NSView *subs[count];
|
NSArray *s = ((NSViewPtr)theView)->sub_views;
|
||||||
unsigned i;
|
unsigned count = [s count];
|
||||||
|
|
||||||
[s getObjects: subs];
|
if (count)
|
||||||
for (i = 0; i < count; i++)
|
{
|
||||||
[self resetCursorRectsForView: subs[i]];
|
NSView *subs[count];
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
[s getObjects: subs];
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
resetCursorRectsForView(subs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) resetCursorRects
|
- (void) resetCursorRects
|
||||||
{
|
{
|
||||||
[self resetCursorRectsForView: [content_view superview]];
|
[self discardCursorRects];
|
||||||
|
resetCursorRectsForView([content_view superview]);
|
||||||
cursor_rects_valid = YES;
|
cursor_rects_valid = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1463,7 +1483,17 @@ static NSMapTable* windowmaps = NULL;
|
||||||
|
|
||||||
if ((!last) && (now)) // Mouse entered event
|
if ((!last) && (now)) // Mouse entered event
|
||||||
{
|
{
|
||||||
if (r->ownerRespondsToMouseEntered)
|
if (r->flags.checked == NO)
|
||||||
|
{
|
||||||
|
if ([r->owner respondsToSelector:
|
||||||
|
@selector(mouseEntered:)])
|
||||||
|
r->flags.ownerRespondsToMouseEntered = YES;
|
||||||
|
if ([r->owner respondsToSelector:
|
||||||
|
@selector(mouseExited:)])
|
||||||
|
r->flags.ownerRespondsToMouseExited = YES;
|
||||||
|
r->flags.checked = YES;
|
||||||
|
}
|
||||||
|
if (r->flags.ownerRespondsToMouseEntered)
|
||||||
{
|
{
|
||||||
NSEvent *e;
|
NSEvent *e;
|
||||||
|
|
||||||
|
@ -1482,7 +1512,17 @@ static NSMapTable* windowmaps = NULL;
|
||||||
|
|
||||||
if ((last) && (!now)) // Mouse exited event
|
if ((last) && (!now)) // Mouse exited event
|
||||||
{
|
{
|
||||||
if (r->ownerRespondsToMouseExited)
|
if (r->flags.checked == NO)
|
||||||
|
{
|
||||||
|
if ([r->owner respondsToSelector:
|
||||||
|
@selector(mouseEntered:)])
|
||||||
|
r->flags.ownerRespondsToMouseEntered = YES;
|
||||||
|
if ([r->owner respondsToSelector:
|
||||||
|
@selector(mouseExited:)])
|
||||||
|
r->flags.ownerRespondsToMouseExited = YES;
|
||||||
|
r->flags.checked = YES;
|
||||||
|
}
|
||||||
|
if (r->flags.ownerRespondsToMouseExited)
|
||||||
{
|
{
|
||||||
NSEvent *e;
|
NSEvent *e;
|
||||||
|
|
||||||
|
@ -1524,7 +1564,7 @@ static NSMapTable* windowmaps = NULL;
|
||||||
|
|
||||||
- (void) _checkCursorRectangles: (NSView *)theView forEvent: (NSEvent *)theEvent
|
- (void) _checkCursorRectangles: (NSView *)theView forEvent: (NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
if (((NSViewPtr)theView)->_rFlags.has_currects)
|
if (((NSViewPtr)theView)->_rFlags.valid_rects)
|
||||||
{
|
{
|
||||||
NSArray *tr = ((NSViewPtr)theView)->cursor_rects;
|
NSArray *tr = ((NSViewPtr)theView)->cursor_rects;
|
||||||
unsigned count = [tr count];
|
unsigned count = [tr count];
|
||||||
|
@ -1534,8 +1574,6 @@ static NSMapTable* windowmaps = NULL;
|
||||||
{
|
{
|
||||||
GSTrackingRect *rects[count];
|
GSTrackingRect *rects[count];
|
||||||
NSPoint loc = [theEvent locationInWindow];
|
NSPoint loc = [theEvent locationInWindow];
|
||||||
NSPoint lastConv;
|
|
||||||
NSPoint locConv;
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
[tr getObjects: rects];
|
[tr getObjects: rects];
|
||||||
|
@ -1552,8 +1590,8 @@ static NSMapTable* windowmaps = NULL;
|
||||||
/*
|
/*
|
||||||
* Check for presence of point in rectangle.
|
* Check for presence of point in rectangle.
|
||||||
*/
|
*/
|
||||||
last = NSMouseInRect(lastConv, r->rectangle, NO);
|
last = NSMouseInRect(last_point, r->rectangle, NO);
|
||||||
now = NSMouseInRect(locConv, r->rectangle, NO);
|
now = NSMouseInRect(loc, r->rectangle, NO);
|
||||||
|
|
||||||
// Mouse entered
|
// Mouse entered
|
||||||
if ((!last) && (now))
|
if ((!last) && (now))
|
||||||
|
@ -1635,7 +1673,6 @@ static NSMapTable* windowmaps = NULL;
|
||||||
|
|
||||||
if (!cursor_rects_valid)
|
if (!cursor_rects_valid)
|
||||||
{
|
{
|
||||||
[self discardCursorRects];
|
|
||||||
[self resetCursorRects];
|
[self resetCursorRects];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1763,19 +1800,16 @@ static NSMapTable* windowmaps = NULL;
|
||||||
|
|
||||||
case NSCursorUpdate: // Cursor update
|
case NSCursorUpdate: // Cursor update
|
||||||
{
|
{
|
||||||
GSTrackingRect *r =(GSTrackingRect *)[theEvent userData];
|
GSTrackingRect *r =(GSTrackingRect *)[theEvent userData];
|
||||||
NSCursor *c = (NSCursor *)[r owner];
|
NSCursor *c = (NSCursor *)[r owner];
|
||||||
|
|
||||||
c = (NSCursor *)[r owner];
|
|
||||||
if ([theEvent trackingNumber]) // It's a mouse entered
|
if ([theEvent trackingNumber]) // It's a mouse entered
|
||||||
{
|
{
|
||||||
if (c && [c isSetOnMouseEntered])
|
[c mouseEntered: theEvent];
|
||||||
[c set];
|
|
||||||
}
|
}
|
||||||
else // it is a mouse exited
|
else // it is a mouse exited
|
||||||
{
|
{
|
||||||
if (c && [c isSetOnMouseExited])
|
[c mouseExited: theEvent];
|
||||||
[c set];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue