This isn't really a Cocoa issue.  Seems more appropriate for quartz-dev...

On Feb 16, 2012, at 3:29 AM, Samuel Williams wrote:

> 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.

Indeed.  I've been bitten by this, too.


> 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 don't have a cleaner hack, but I do have a different hack.  Remember your 
warp delta and subtract it from the next mouse event's delta.

Another thing to consider (although it didn't suit my needs and may not suit 
yours): maybe you don't need to warp the cursor position at all.  Given that 
you're hiding the cursor and disassociating it from the mouse, do you really 
care where the absolute cursor position is?

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to