Constraining a mouse cursor to a rect / window
Constraining a mouse cursor to a rect / window
- Subject: Constraining a mouse cursor to a rect / window
- From: Jorgen Tjerno <email@hidden>
- Date: Mon, 22 Jul 2013 21:42:43 +0000
- Thread-topic: Constraining a mouse cursor to a rect / window
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@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