CGWarpMouseCursorPosition and large delta/offset at next mouse motion event
CGWarpMouseCursorPosition and large delta/offset at next mouse motion event
- Subject: CGWarpMouseCursorPosition and large delta/offset at next mouse motion event
- From: Samuel Williams <email@hidden>
- Date: Thu, 16 Feb 2012 22:29:01 +1300
Hi,
I'm using CGWarpMouseCursorPosition to position the cursor in the window
after grabbing it and hiding it. I'm using
CGAssociateMouseAndMouseCursorPosition(true/false) to ensure that the
motion can be captured separately from the mouse position.
However, after doing this, the next motion event (NSMouseMovedMask |
NSLeftMouseDraggedMask | NSRightMouseDraggedMask | NSOtherMouseDraggedMask)
seems to have an offset/delta equal to the warp that occurred.
This seems to be undesirable behaviour.
The reason why this is a bit confusion is because the documentation states
that CGWarpMouseCursorPosition will not generate mouse events, and yet in
this case, while not directly generating events it is causing some strange
behaviour down the road.
The only solution I've found to fix this "bug" is to simply discard the
next motion input event that occurs to the given view, but this seems like
a huge hack IMHO. I was wondering if there is some way to reset the
internal delta tracking state as a slightly cleaner hack?
I've filed a bug report to Apple, but obviously I need a fix. The hack
above is working but is far from pleasant - does anyone have any
suggestions on how I can improve this hack?
Kind regards,
Samuel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden