Is there a way to get
- (void)beginGestureWithEvent:(NSEvent *)event
and
- (void)endGestureWithEvent:(NSEvent *)event
calls to a view even if the containing window is in the background? It seems these calls are only delivered to windows if they are key.
In general no. In Leopard and SnowLeopard, gestures are intended to target only the foreground window. As you discovered, the window server will not even send gesture events to background applications.
You could instal an event tap, but those events don't look exactly their the NS equivalents. All the data is there, though, if you really want to dig into it.
Please file a radar asking for this along with why this would be useful.
But here's a workaround:
Add a tracking area to your view bounds with options NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways
NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways
…and activate your application upon mouseEntered:
It's non-standard but it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.