diff --git a/ChangeLog b/ChangeLog index 665cb1587..b8d5f8604 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-05-27 Fred Kiefer + + * Source/NSView.m (-discardCursorRects, -removeCursorRect:cursor:) + * Source/NSWindow.m (-invalidateCursorRectsForView:, + -resetCursorRects): Improved handling of cursor rects to fix bug #5871. + * Source/NSCursor.m (-mouseExited:): + Set the default cursor, when the cursor was set on enter. + Patch by Mircea Trache . + 2006-05-23 Fred Kiefer * Source/NSTabView.m (-tabViewItemAtPoint:, -mouseDown:): Moved diff --git a/Source/NSCursor.m b/Source/NSCursor.m index 0efb02cbb..945a8cffc 100644 --- a/Source/NSCursor.m +++ b/Source/NSCursor.m @@ -448,6 +448,14 @@ backgroundColorHint:(NSColor *)bg */ [self pop]; } + else + { + /* + * The cursor was set on entry, we reset it to the default cursor on exit. + * Using push and pop all the time would seem to be a clearer way. + */ + [[NSCursor arrowCursor] set]; + } } /**

Pops the cursor off the top of the stack and makes the previous diff --git a/Source/NSView.m b/Source/NSView.m index 5b2e326af..53db18c3a 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -2625,7 +2625,25 @@ Returns YES iff any scrolling was done. { if (_rFlags.valid_rects != 0) { - [_cursor_rects makeObjectsPerformSelector: @selector(invalidate)]; + unsigned count = [_cursor_rects count]; + if (count > 0) + { + GSTrackingRect *rects[count]; + NSPoint loc = [_window mouseLocationOutsideOfEventStream]; + unsigned i; + + [_cursor_rects getObjects: rects]; + + for (i = 0; i < count; ++i) + { + GSTrackingRect *r = rects[i]; + if (NSMouseInRect(loc, r->rectangle, NO)) + { + [[r owner] mouseExited: nil]; + } + [r invalidate]; + } + } _rFlags.valid_rects = 0; } [_cursor_rects removeAllObjects]; @@ -2638,6 +2656,7 @@ Returns YES iff any scrolling was done. id e = [_cursor_rects objectEnumerator]; GSTrackingRect *o; NSCursor *c; + NSPoint loc = [_window mouseLocationOutsideOfEventStream]; /* Base remove test upon cursor object */ o = [e nextObject]; @@ -2646,6 +2665,10 @@ Returns YES iff any scrolling was done. c = [o owner]; if (c == anObject) { + if (NSMouseInRect(loc, o->rectangle, NO)) + { + [c mouseExited: nil]; + } [o invalidate]; [_cursor_rects removeObject: o]; if ([_cursor_rects count] == 0) diff --git a/Source/NSWindow.m b/Source/NSWindow.m index aee4d7eee..f8f7e0487 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2344,10 +2344,43 @@ discardCursorRectsForView(NSView *theView) { if (((NSViewPtr)aView)->_rFlags.valid_rects) { - [((NSViewPtr)aView)->_cursor_rects - makeObjectsPerformSelector: @selector(invalidate)]; + unsigned count = [((NSViewPtr)aView)->_cursor_rects count]; + if (count > 0) + { + GSTrackingRect *rects[count]; + unsigned i; + + [((NSViewPtr)aView)->_cursor_rects getObjects: rects]; + + for (i = 0; i < count; ++i) + { + GSTrackingRect *r = rects[i]; + if (NSMouseInRect(_lastPoint, r->rectangle, NO)) + { + [[r owner] mouseExited: nil]; + } + [r invalidate]; + } + } ((NSViewPtr)aView)->_rFlags.valid_rects = 0; - _f.cursor_rects_valid = NO; + + if (_f.cursor_rects_valid) + { + if (_f.is_key && _f.cursor_rects_enabled) + { + NSEvent *e = [NSEvent otherEventWithType: NSAppKitDefined + location: NSMakePoint(-1, -1) + modifierFlags: 0 + timestamp: 0 + windowNumber: _windowNum + context: GSCurrentContext() + subtype: -1 + data1: 0 + data2: 0]; + [self postEvent: e atStart: YES]; + } + _f.cursor_rects_valid = NO; + } } } @@ -2383,6 +2416,26 @@ resetCursorRectsForView(NSView *theView) [self discardCursorRects]; resetCursorRectsForView(_wv); _f.cursor_rects_valid = YES; + + if (_f.is_key && _f.cursor_rects_enabled) + { + NSPoint loc = [self mouseLocationOutsideOfEventStream]; + if (NSMouseInRect(loc, [_wv bounds], NO)) + { + NSEvent *e = [NSEvent mouseEventWithType: NSMouseMoved + location: loc + modifierFlags: 0 + timestamp: 0 + windowNumber: _windowNum + context: GSCurrentContext() + eventNumber: 0 + clickCount: 0 + pressure: 0]; + _lastPoint = NSMakePoint(-1,-1); + (*ccImp)(self, ccSel, _wv, e); + _lastPoint = loc; + } + } } /*