views:

18

answers:

1

I'm trying to register the NSMouseMoved event globally using this line of code:

[NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMoved handler:mouseMovedBlock];

However, my mouseMovedBlock only gets called when the mouse gets clicked and not when the mouse is moved. I tried detecting the type of the NSEvent and it returns NSMouseUp, which doesn't really make any sense.

Why is my program acting so strange / what did I miss?

+2  A: 

Turns out it was a simple mistake. I just changed "NSMouseMoved" to "NSMouseMovedMask". I simply forgot that it needed to be an event mask instead of a normal event type.

Sorig