Reputation: 1571
I'm a beginner for Mac development and I'm wondering if there is any private API to judge what state the mouse is,like dragging,left/right mouse down etc.Thanks.
Upvotes: 1
Views: 801
Reputation: 90531
If you just need the instantaneous state, you can use +[NSEvent mouseLocation]
and +[NSEvent pressedMouseButtons]
. However, examining the instantaneous state is rarely the right thing to do. If you explain what you're trying to achieve we may be able to suggest better approaches.
Upvotes: 2
Reputation: 9392
You don't need a private api. NSEvent has the method
+ (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(void (^)(NSEvent*))block
which allows monitoring different types of mouse/key events.
Upvotes: 0