• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CGWarpMouseCursorPosition and large delta/offset at next mouse motion event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGWarpMouseCursorPosition and large delta/offset at next mouse motion event


  • Subject: Re: CGWarpMouseCursorPosition and large delta/offset at next mouse motion event
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 16 Feb 2012 10:39:16 -0600

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


References: 
 >CGWarpMouseCursorPosition and large delta/offset at next mouse motion event (From: Samuel Williams <email@hidden>)

  • Prev by Date: Re: copy & isEqual nightmares
  • Next by Date: Re: copy & isEqual nightmares
  • Previous by thread: CGWarpMouseCursorPosition and large delta/offset at next mouse motion event
  • Next by thread: iOS additional sharing options (context menu)
  • Index(es):
    • Date
    • Thread