Receiving touch events in NSView when cursor is outside of the view
In my application I need to respond to trackpad touch events (touchesBeganWithEvent / touchesMovedWithEvent / touchesEndedWithEvent) in a custom NSView, I have th开发者_如何学Ce code working properly. But I also need to do this when the cursor is outside of the view when the touch starts and NSView doesn't receive these events in this case.
One direction I was exploring is subclassing NSApplication and overriding sendEvent. But I am not sure how to dispatch the proper messages to my NSView. Just forwarding these events to the NSWindow via sendEvent doesn't seem to work.
Or is there a better way? Any ideas?
Thanks.
精彩评论