mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 04:50:54 +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>
|
2012-03-22 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/NSAttributedString.m
|
* Source/NSAttributedString.m
|
||||||
|
|
|
@ -290,13 +290,9 @@ static BOOL restoreMouseMoved;
|
||||||
if ([[provider object] respondsToSelector:
|
if ([[provider object] respondsToSelector:
|
||||||
@selector(view:stringForToolTip:point:userData:)] == YES)
|
@selector(view:stringForToolTip:point:userData:)] == YES)
|
||||||
{
|
{
|
||||||
// According to the Apple docs, the point is relative to the tracking
|
// From testing on OS X, point is in the view's coordinate system
|
||||||
// rectangle
|
NSPoint p = [view convertPoint: [theEvent locationInWindow]
|
||||||
NSPoint p = [theEvent locationInWindow];
|
fromView: nil];
|
||||||
NSPoint origin =
|
|
||||||
[view convertRect: [provider viewRect] toView: nil].origin;
|
|
||||||
p.x -= origin.x;
|
|
||||||
p.y -= origin.y;
|
|
||||||
toolTipString = [[provider object] view: view
|
toolTipString = [[provider object] view: view
|
||||||
stringForToolTip: [theEvent trackingNumber]
|
stringForToolTip: [theEvent trackingNumber]
|
||||||
point: p
|
point: p
|
||||||
|
@ -562,7 +558,7 @@ static BOOL restoreMouseMoved;
|
||||||
/* The delay timed out -- display the tooltip */
|
/* The delay timed out -- display the tooltip */
|
||||||
- (void) _timedOut: (NSTimer *)aTimer
|
- (void) _timedOut: (NSTimer *)aTimer
|
||||||
{
|
{
|
||||||
NSString *toolTipString = [aTimer userInfo];
|
NSString *toolTipString;
|
||||||
NSAttributedString *toolTipText = nil;
|
NSAttributedString *toolTipText = nil;
|
||||||
NSSize textSize;
|
NSSize textSize;
|
||||||
NSPoint mouseLocation = [NSEvent mouseLocation];
|
NSPoint mouseLocation = [NSEvent mouseLocation];
|
||||||
|
@ -570,6 +566,11 @@ static BOOL restoreMouseMoved;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
NSMutableDictionary *attributes;
|
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)
|
if (nil == toolTipString)
|
||||||
{
|
{
|
||||||
toolTipString = @"";
|
toolTipString = @"";
|
||||||
|
|
Loading…
Reference in a new issue