Author: fredkiefer
Date: Mon Dec  8 16:29:11 2014
New Revision: 38241

URL: http://svn.gna.org/viewcvs/gnustep?rev=38241&view=rev
Log:
        * Source/GSToolTips.m: Fixed two issues with tooltips.
        (a) locationInView was being converted twice, producing invalid
        coordinates the second time, when using a provider to get the
        tooltips.
        (b) Tooltips were not working if you had two tracking rects next
        to each other in the same view, when moving from one to the
other,
        depending on the order they were processed, one could get the
        enter before the other's exit, thus canceling the timer.
        Patch by Paul Landers <[email protected]>.

Modified:
    libs/gui/trunk/ChangeLog
    libs/gui/trunk/Source/GSToolTips.m

Modified: libs/gui/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=38241&r1=38240&r2=38241&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog    (original)
+++ libs/gui/trunk/ChangeLog    Mon Dec  8 16:29:11 2014
@@ -1,3 +1,15 @@
+2014-12-08  Fred Kiefer <[email protected]>
+
+       * Source/GSToolTips.m: Fixed two issues with tooltips.
+       (a) locationInView was being converted twice, producing invalid
+       coordinates the second time, when using a provider to get the
+       tooltips.
+       (b) Tooltips were not working if you had two tracking rects next
+       to each other in the same view, when moving from one to the other,
+       depending on the order they were processed, one could get the
+       enter before the other's exit, thus canceling the timer.
+       Patch by Paul Landers <[email protected]>.
+
 2014-12-08  Fred Kiefer <[email protected]>
 
        * Headers/AppKit/NSTableView.h,

Modified: libs/gui/trunk/Source/GSToolTips.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/GSToolTips.m?rev=38241&r1=38240&r2=38241&view=diff
==============================================================================
--- libs/gui/trunk/Source/GSToolTips.m  (original)
+++ libs/gui/trunk/Source/GSToolTips.m  Mon Dec  8 16:29:11 2014
@@ -202,6 +202,7 @@
 
 @interface     GSToolTips (Private)
 - (void) _endDisplay;
+- (void) _endDisplay: (NSTrackingRectTag)tag;
 - (void) _timedOut: (NSTimer *)timer;
 @end
 /*
@@ -217,6 +218,7 @@
 static NSMapTable      *viewsMap = 0;
 static NSTimer         *timer = nil;
 static GSToolTips       *timedObject = nil;
+static NSTrackingRectTag timedTag = NSNotFound;
 // Having a single stored panel for tooltips greatly reduces callback 
interaction from MS-Windows
 static GSTTPanel       *window = nil;
 // Prevent Windows callback API from attempting to dismiss tooltip as its in 
the process of appearing
@@ -341,6 +343,7 @@
       [timer invalidate];
       timer = nil;
       timedObject = nil;
+      timedTag = NSNotFound;
     }
 
   provider = (GSTTProvider*)[theEvent userData];
@@ -348,8 +351,10 @@
     @selector(view:stringForToolTip:point:userData:)] == YES)
     {
       // From testing on OS X, point is in the view's coordinate system
-      NSPoint p = [view convertPoint: [theEvent locationInWindow]
-                           fromView: nil];
+      // The locationInWindow has been converted to this in
+      // [NSWindow _checkTrackingRectangles:forEvent:]
+      NSPoint p = [theEvent locationInWindow];
+
       toolTipString = [[provider object] view: view
                             stringForToolTip: [theEvent trackingNumber]
                                        point: p
@@ -367,6 +372,7 @@
                                           repeats: YES];
   [[NSRunLoop currentRunLoop] addTimer: timer forMode: 
NSModalPanelRunLoopMode];
   timedObject = self;
+  timedTag = [theEvent trackingNumber];
   if ([[view window] acceptsMouseMovedEvents] == YES)
     {
       restoreMouseMoved = NO;
@@ -381,7 +387,7 @@
 
 - (void) mouseExited: (NSEvent *)theEvent
 {
-  [self _endDisplay];
+  [self _endDisplay:[theEvent trackingNumber]];
 }
 
 - (void) mouseDown: (NSEvent *)theEvent
@@ -534,16 +540,21 @@
 
 - (void) _endDisplay
 {
+  [self _endDisplay:NSNotFound];
+}
+
+- (void) _endDisplay: (NSTrackingRectTag)tag
+{
   if (isOpening)
     return;
   if ([NSWindow _toolTipVisible] == self)
     {
       [NSWindow _setToolTipVisible: nil];
     }
-  /* If there is currently a timer running for this object,
-   * cancel it.
+  /* If there is currently a timer running for this object and it is the 
target tag,
+   * cancel it. Always remove if the target tag is NSNotFound
    */
-  if (timer != nil && timedObject == self)
+  if (timer != nil && timedObject == self && (timedTag == tag || tag == 
NSNotFound))
     {
       if ([timer isValid])
        {
@@ -551,6 +562,7 @@
        }
       timer = nil;
       timedObject = nil;
+      timedTag = NSNotFound;
     }
   if (window != nil)
     {
@@ -595,6 +607,7 @@
        }
       timer = nil;
       timedObject = nil;
+      timedTag = NSNotFound;
     }
 
   if ([window isVisible])


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to