Is there an API that allows an application to constrain a mouse cursor's 
movement to a window or a rect?

The use case for this is in SDL2, where windows created with 
SDL_FULLSCREEN_DESKTOP create desktop-sized, borderless windows that are 
topmost, similar to a fullscreen application (but without a mode change and 
allowing quick Cmd-Tab etc). This works great, but on multi-monitor setups, the 
mouse can be moved out of the window onto the other desktop.

The current workaround is using CGWarpMouseCursorPosition to move the cursor 
back if it leaves the window, but depending on the update rate of the 
application, a user can still have a mouse click be delivered to another 
application or the desktop, causing a focus loss. Not a great experience.

Is this more appropriate for mac-games-dev@ or quartz-dev@?

- Jørgen.
_______________________________________________

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