NSTrackingArea message lag
NSTrackingArea message lag
- Subject: NSTrackingArea message lag
- From: Markus Spoettl <email@hidden>
- Date: Wed, 25 Jun 2008 23:11:43 -0700
Hello List,
I have a custom NSView that draws a number of rectangles of
different heights, overlapping 1 pixel on the left and right edge.
Each rectangle gets its own tracking area
NSTrackingAreaOptions opts = (NSTrackingMouseEnteredAndExited |
NSTrackingActiveInKeyWindow);
NSDictionary *dict = <Dictionary with 2 entries>;
NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:rect
options:opts
owner:self
userInfo:dict];
[self addTrackingArea:ta];
The -mouseEntered and -mouseExited messages are being fired, causing a
redraw of the view. Everything works nicely with a low number of areas
(10).
When the number of bars increases to more than 20, there is a visible
lag between mouse movement and the location that is being redrawn. The
more areas there are the greater the lag.
The result is that the view redraws an area (highlighting a bar) that
the mouse passed long ago (up to 1 second and more, depending on the
bar count).
I have double (quadruple actually) checked that the redrawing is not
the problem, the view draws very quickly. When the mouse is being
dragged over the view, the same series of redrawing events is
completely instant up to a bar count of more than 200. I've even
completely disabled redrawing as a result of tracking area events and
the lag is still there. So the drawing is not causing the lag.
My suspicion is that only one (or a very small number) of tracking
area events are being fired for a view in each run loop cycle (or some
other limitation with respect to the number of tracking area events
that can be delivered instantly). That would explain the visible lag
with greater numbers of areas (thus events). This would explain why
the events keep coming in in an asynchronous fashion.
I have two questions:
1) Is this a known problem/limitation or is it my fault?
2) Is there a way to cancel tracking area events? Some way to ask the
system not to fire a tracking event when a new event has arrived prior
to the delivery of an existing one?
Thanks!
Regards
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden