views:

23

answers:

1

Hi

I'd like to get the finger's position when user makes a gesture on the trackpad.

I've already hooked on to swipeWithEvent that triggers on swipe. Within that NSEvent there's a method deltaX that reports the change of the movement. There's also absoluteX method that looks promising, but I can't get it to return anything but the following assertion failure:

Invalid message sent to event "NSEvent: type=Swipe loc=(394,335) time=3893.8 flags=0x100 win=0x10022fdc0 winNum=586 ctxt=0x0 deltaX=-1.000000 deltaY=0.000000"

The 'loc' value the in the error message changes a bit over time, but to my understanding it's not the right value because the change is too small.

So, how can I properly use NSEvent's absoluteX on a trackpad?

+1  A: 

From the documentation for -[NSEvent absoluteX]:

For the coordinate to be valid, the receiver should represent an event generated by a tablet pointing device (otherwise 0 is returned). This method is valid only for mouse events with a subtype of NSTabletPointEventSubtype and for events of type NSTabletPoint

I would think if you need to get the same information on a non-tablet device, you need to tell Apple (via the bug reporter or DTS) about your requirement as the API doesn't currently support it.

Graham Lee