Right, so you'd CGAssociateMouseAndCursorPosition(false) and then use
CGWarpMouseCursorPosition or CGDisplayMouseCursorToPoint to move it where
you want it to be, but clamped inside the rect. As long as you keep pumping
the event loop separately that does this (as fast as possible) it shouldn't
be perceptively different from an OS cursor.


On Mon, Feb 24, 2014 at 7:41 PM, Vincent Scheib <sch...@google.com> wrote:

>
>
>
> On Mon, Feb 24, 2014 at 10:37 AM, Florian Bösch <pya...@gmail.com> wrote:
>
>> On Mon, Feb 24, 2014 at 7:07 PM, Vincent Scheib <sch...@google.com>wrote:
>>
>>> Windows has ClipCursor() and Linux has XGrabPointer(). Once we know we
>>> can implement the functionality, we can discuss how to express this in an
>>> API.
>>>
>>
>> Would using Quarz CGWarpMouseCursorPosition work where you'd clamp the
>> passed position into the desired rectangle?
>>
>>
>> https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/c/func/CGWarpMouseCursorPosition
>>
>>
>
> I believe no, because it would allow the pointer to escape the region
> before being warped back, permitting escape if clicked at that time as well.
>

Reply via email to