diff --git a/ChangeLog b/ChangeLog index 9869fa9b1..fb2779ae3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2012-10-06 Wolfgang Lux + + * Source/NSWindow.m (-_checkTrackingRectangles:forEvent:): + Tracking rectangles now use the coordinate system of their views, + as they do under Cocoa. + + * Source/GSToolTips.h (-rebuild): Remove. + * Source/GSToolTips.m (-rebuild): Remove. + * Source/NSView.m (-_rebuildCoordinates): No need to recompute + tool tip tracking rectangles. + + * Source/GSToolTips.m (GSTTProvider): Remove view rectangles from + GSTTProvider class. They are no longer used. + 2012-10-04 Wolfgang Lux Improve keyboard navigation by automatically computing a key view diff --git a/Source/GSToolTips.h b/Source/GSToolTips.h index 8383be21e..cc3f0c51f 100644 --- a/Source/GSToolTips.h +++ b/Source/GSToolTips.h @@ -80,11 +80,6 @@ */ - (void) mouseMoved: (NSEvent *)theEvent; -/** Rebuild rectangles. Called by NSView whenever it has to rebuild its - * coordinate system because it has been resized, moved, or reparented. - */ -- (void) rebuild; - /** Support [NSView-removeAllToolTips] */ - (void) removeAllToolTips; diff --git a/Source/GSToolTips.m b/Source/GSToolTips.m index a9a831785..978fdfc58 100644 --- a/Source/GSToolTips.m +++ b/Source/GSToolTips.m @@ -63,13 +63,11 @@ { id object; void *data; - NSRect viewRect; } - (void*) data; -- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r; +- (id) initWithObject: (id)o userData: (void*)d; - (id) object; - (void) setObject: (id)o; -- (NSRect) viewRect; @end @implementation GSTTProvider @@ -82,10 +80,9 @@ [self setObject: nil]; [super dealloc]; } -- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r +- (id) initWithObject: (id)o userData: (void*)d { data = d; - viewRect = r; [self setObject: o]; return self; } @@ -116,10 +113,6 @@ object = [[object description] copy]; } } -- (NSRect) viewRect -{ - return viewRect; -} @end @interface GSTTPanel : NSPanel @@ -233,8 +226,7 @@ static BOOL restoreMouseMoved; } provider = [[GSTTProvider alloc] initWithObject: anObject - userData: data - rect: aRect]; + userData: data]; tag = [view addTrackingRect: aRect owner: self userData: provider @@ -350,35 +342,6 @@ static BOOL restoreMouseMoved; [window setFrameOrigin: origin]; } -- (void) rebuild -{ - NSEnumerator *enumerator; - GSTrackingRect *rect; - - enumerator = [((NSViewPtr)view)->_tracking_rects objectEnumerator]; - while ((rect = [enumerator nextObject]) != nil) - { - if (rect->owner == self) - { - GSTTProvider *provider = (GSTTProvider *)rect->user_data; - NSRect frame; - - if (rect->tag == toolTipTag) - { - frame = [view bounds]; - } - else - { - // FIXME is this the thing to do with tooltips other than - // the main one (which we know should cover the whole view)? - frame = [provider viewRect]; - } - frame = [view convertRect: frame toView: nil]; - [rect reset: frame inside: NO]; - } - } -} - - (void) removeAllToolTips { NSEnumerator *enumerator; @@ -461,8 +424,7 @@ static BOOL restoreMouseMoved; rect = [view bounds]; provider = [[GSTTProvider alloc] initWithObject: string - userData: nil - rect: rect]; + userData: nil]; toolTipTag = [view addTrackingRect: rect owner: self userData: provider diff --git a/Source/NSView.m b/Source/NSView.m index dda2eb8f5..6d755f751 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -360,12 +360,6 @@ GSSetDragTypes(NSView* obj, NSArray *types) _visibleRect = _bounds; } } - if (_rFlags.has_tooltips != 0) - { - GSToolTips *tt = [GSToolTips tipsForView: self]; - - [tt rebuild]; - } } } diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 39741895b..edd519e80 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -3448,6 +3448,7 @@ resetCursorRectsForView(NSView *theView) return; if (theView->_rFlags.has_trkrects) { + BOOL isFlipped = [theView isFlipped]; NSArray *tr = theView->_tracking_rects; unsigned count = [tr count]; @@ -3458,8 +3459,11 @@ resetCursorRectsForView(NSView *theView) { GSTrackingRect *rects[count]; NSPoint loc = [theEvent locationInWindow]; + NSPoint lastPoint = _lastPoint; unsigned i; + lastPoint = [theView convertPoint: lastPoint fromView: nil]; + loc = [theView convertPoint: loc fromView: nil]; [tr getObjects: rects]; for (i = 0; i < count; ++i) @@ -3471,9 +3475,9 @@ resetCursorRectsForView(NSView *theView) if ([r isValid] == NO) continue; /* Check mouse at last point */ - last = NSMouseInRect(_lastPoint, r->rectangle, NO); + last = NSMouseInRect(lastPoint, r->rectangle, isFlipped); /* Check mouse at current point */ - now = NSMouseInRect(loc, r->rectangle, NO); + now = NSMouseInRect(loc, r->rectangle, isFlipped); if ((!last) && (now)) // Mouse entered event {