I'm currently porting an application (or to be more exact, a VST Plugin) from windows to OSX. I'm kinda new to OSX programming, but I'm using a Cocoa NSView added to a Carbon window (that I get from the host) using HICocoaCreateView.
Anywhoo... Inside this view I want to get mouseMoved & mouseDragged events, but when dragging I also want to get these events even when the mouse leaves my NSView (and also the parent window), but I just can't seem to make this happen.
On windows I would do a SetCapture on mouseDown to get all mouse events for a while. The closest thing I've found in Cocoa is "addGlobalMonitorForEventsMatchingMask", but this is 10.6+ only and I have a hard time believing this is something that wasn't possible to do before that. (After all, this is something that is commonly used for draggable components like scroll bars etc.)
This is driving me insane!
UPDATE:
There's something called CGEventTapCreate as well which, as far as I can tell from scarce docs, is similar to addGlobalMonitor... but in Carbon. I haven't gotten a hang of exactly how Carbon and Cocoa relate to eachother and what's working where. Is it usuable even though my main stuff is Cocoa? (The window I get from the host can be both Cocoa and Carbon. It's really all a mess.)