mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 00:50:49 +00:00
Fix implementation of tracking rectangles to use the coordinate system
of their views, as they do under Cocoa. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35645 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4bc8763f12
commit
4d7ff1de4a
5 changed files with 24 additions and 55 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2012-10-06 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* 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 <wolfgang.lux@gmail.com>
|
2012-10-04 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
Improve keyboard navigation by automatically computing a key view
|
Improve keyboard navigation by automatically computing a key view
|
||||||
|
|
|
@ -80,11 +80,6 @@
|
||||||
*/
|
*/
|
||||||
- (void) mouseMoved: (NSEvent *)theEvent;
|
- (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]
|
/** Support [NSView-removeAllToolTips]
|
||||||
*/
|
*/
|
||||||
- (void) removeAllToolTips;
|
- (void) removeAllToolTips;
|
||||||
|
|
|
@ -63,13 +63,11 @@
|
||||||
{
|
{
|
||||||
id object;
|
id object;
|
||||||
void *data;
|
void *data;
|
||||||
NSRect viewRect;
|
|
||||||
}
|
}
|
||||||
- (void*) data;
|
- (void*) data;
|
||||||
- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r;
|
- (id) initWithObject: (id)o userData: (void*)d;
|
||||||
- (id) object;
|
- (id) object;
|
||||||
- (void) setObject: (id)o;
|
- (void) setObject: (id)o;
|
||||||
- (NSRect) viewRect;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GSTTProvider
|
@implementation GSTTProvider
|
||||||
|
@ -82,10 +80,9 @@
|
||||||
[self setObject: nil];
|
[self setObject: nil];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r
|
- (id) initWithObject: (id)o userData: (void*)d
|
||||||
{
|
{
|
||||||
data = d;
|
data = d;
|
||||||
viewRect = r;
|
|
||||||
[self setObject: o];
|
[self setObject: o];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -116,10 +113,6 @@
|
||||||
object = [[object description] copy];
|
object = [[object description] copy];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
- (NSRect) viewRect
|
|
||||||
{
|
|
||||||
return viewRect;
|
|
||||||
}
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GSTTPanel : NSPanel
|
@interface GSTTPanel : NSPanel
|
||||||
|
@ -233,8 +226,7 @@ static BOOL restoreMouseMoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
provider = [[GSTTProvider alloc] initWithObject: anObject
|
provider = [[GSTTProvider alloc] initWithObject: anObject
|
||||||
userData: data
|
userData: data];
|
||||||
rect: aRect];
|
|
||||||
tag = [view addTrackingRect: aRect
|
tag = [view addTrackingRect: aRect
|
||||||
owner: self
|
owner: self
|
||||||
userData: provider
|
userData: provider
|
||||||
|
@ -350,35 +342,6 @@ static BOOL restoreMouseMoved;
|
||||||
[window setFrameOrigin: origin];
|
[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
|
- (void) removeAllToolTips
|
||||||
{
|
{
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
|
@ -461,8 +424,7 @@ static BOOL restoreMouseMoved;
|
||||||
|
|
||||||
rect = [view bounds];
|
rect = [view bounds];
|
||||||
provider = [[GSTTProvider alloc] initWithObject: string
|
provider = [[GSTTProvider alloc] initWithObject: string
|
||||||
userData: nil
|
userData: nil];
|
||||||
rect: rect];
|
|
||||||
toolTipTag = [view addTrackingRect: rect
|
toolTipTag = [view addTrackingRect: rect
|
||||||
owner: self
|
owner: self
|
||||||
userData: provider
|
userData: provider
|
||||||
|
|
|
@ -360,12 +360,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
_visibleRect = _bounds;
|
_visibleRect = _bounds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_rFlags.has_tooltips != 0)
|
|
||||||
{
|
|
||||||
GSToolTips *tt = [GSToolTips tipsForView: self];
|
|
||||||
|
|
||||||
[tt rebuild];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3448,6 +3448,7 @@ resetCursorRectsForView(NSView *theView)
|
||||||
return;
|
return;
|
||||||
if (theView->_rFlags.has_trkrects)
|
if (theView->_rFlags.has_trkrects)
|
||||||
{
|
{
|
||||||
|
BOOL isFlipped = [theView isFlipped];
|
||||||
NSArray *tr = theView->_tracking_rects;
|
NSArray *tr = theView->_tracking_rects;
|
||||||
unsigned count = [tr count];
|
unsigned count = [tr count];
|
||||||
|
|
||||||
|
@ -3458,8 +3459,11 @@ resetCursorRectsForView(NSView *theView)
|
||||||
{
|
{
|
||||||
GSTrackingRect *rects[count];
|
GSTrackingRect *rects[count];
|
||||||
NSPoint loc = [theEvent locationInWindow];
|
NSPoint loc = [theEvent locationInWindow];
|
||||||
|
NSPoint lastPoint = _lastPoint;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
lastPoint = [theView convertPoint: lastPoint fromView: nil];
|
||||||
|
loc = [theView convertPoint: loc fromView: nil];
|
||||||
[tr getObjects: rects];
|
[tr getObjects: rects];
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
|
@ -3471,9 +3475,9 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if ([r isValid] == NO)
|
if ([r isValid] == NO)
|
||||||
continue;
|
continue;
|
||||||
/* Check mouse at last point */
|
/* Check mouse at last point */
|
||||||
last = NSMouseInRect(_lastPoint, r->rectangle, NO);
|
last = NSMouseInRect(lastPoint, r->rectangle, isFlipped);
|
||||||
/* Check mouse at current point */
|
/* Check mouse at current point */
|
||||||
now = NSMouseInRect(loc, r->rectangle, NO);
|
now = NSMouseInRect(loc, r->rectangle, isFlipped);
|
||||||
|
|
||||||
if ((!last) && (now)) // Mouse entered event
|
if ((!last) && (now)) // Mouse entered event
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue