mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 00:21:36 +00:00
* Source/GSToolTips.m (-mouseEntered:): When calling the owner's
view:stringForToolTip:point:userData: method, make the point relative to the view's coordinate system (tested on OS X) instead of relative to the tracking rect (as before.) * Source/GSToolTips.m (-_timedOut:): Fix a crash caused by invalidating the timer and then using its userInfo object. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35000 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
41692e079d
commit
45bb48a925
2 changed files with 18 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
|||
2012-03-26 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSToolTips.m (-mouseEntered:): When calling the owner's
|
||||
view:stringForToolTip:point:userData: method, make the point
|
||||
relative to the view's coordinate system (tested on OS X) instead
|
||||
of relative to the tracking rect (as before.)
|
||||
* Source/GSToolTips.m (-_timedOut:): Fix a crash caused by
|
||||
invalidating the timer and then using its userInfo object.
|
||||
|
||||
2012-03-22 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSAttributedString.m
|
||||
|
|
|
@ -290,13 +290,9 @@ static BOOL restoreMouseMoved;
|
|||
if ([[provider object] respondsToSelector:
|
||||
@selector(view:stringForToolTip:point:userData:)] == YES)
|
||||
{
|
||||
// According to the Apple docs, the point is relative to the tracking
|
||||
// rectangle
|
||||
NSPoint p = [theEvent locationInWindow];
|
||||
NSPoint origin =
|
||||
[view convertRect: [provider viewRect] toView: nil].origin;
|
||||
p.x -= origin.x;
|
||||
p.y -= origin.y;
|
||||
// From testing on OS X, point is in the view's coordinate system
|
||||
NSPoint p = [view convertPoint: [theEvent locationInWindow]
|
||||
fromView: nil];
|
||||
toolTipString = [[provider object] view: view
|
||||
stringForToolTip: [theEvent trackingNumber]
|
||||
point: p
|
||||
|
@ -562,7 +558,7 @@ static BOOL restoreMouseMoved;
|
|||
/* The delay timed out -- display the tooltip */
|
||||
- (void) _timedOut: (NSTimer *)aTimer
|
||||
{
|
||||
NSString *toolTipString = [aTimer userInfo];
|
||||
NSString *toolTipString;
|
||||
NSAttributedString *toolTipText = nil;
|
||||
NSSize textSize;
|
||||
NSPoint mouseLocation = [NSEvent mouseLocation];
|
||||
|
@ -570,6 +566,11 @@ static BOOL restoreMouseMoved;
|
|||
NSRect rect;
|
||||
NSMutableDictionary *attributes;
|
||||
|
||||
// retain and autorelease the timer's userinfo because we
|
||||
// may invalidate the timer (which releases the userinfo),
|
||||
// but need the userinfo object to remain valid for the
|
||||
// remainder of this method.
|
||||
toolTipString = [[[aTimer userInfo] retain] autorelease];
|
||||
if (nil == toolTipString)
|
||||
{
|
||||
toolTipString = @"";
|
||||
|
|
Loading…
Reference in a new issue