Skip to content

Capture Mouse in SDL#60

Open
Softwave wants to merge 1 commit intomattiasgustavsson:mainfrom
Softwave:main
Open

Capture Mouse in SDL#60
Softwave wants to merge 1 commit intomattiasgustavsson:mainfrom
Softwave:main

Conversation

@Softwave
Copy link

Added two calls that make sure that programs using SDL properly capture the mouse cursor when the user clicks on the window. In dos-like on Linux this had caused the mouse to never be captured.

Added two calls that make sure that programs using SDL properly capture the mouse cursor when the user clicks on the window.
@mattiasgustavsson
Copy link
Owner

Thanks! I agree that it can certainly be very useful to capture the mouse cursor at times, especially for things like games, but app.h is something I use for all sorts of applications, and for many of them, having the cursor captured would be undesireable.

So in app.h, there's an API app_pointer_limit which is intended to be used to lock the cursor at the users request, but it is not implemented for the SDL backend. However, this requires something different than the sdl setrelativemouse functionality, as the idea is to be able to set an arbitrary region to lock the mouse withing, and I am not sure how that could be done in SDL... it might involve calling setmouseposition or something.

I'm not sure when I'll get around to trying an implementation of this. Maybe a reasonable intermediate step is to have app_pointer_limit and app_pointer_limit_off set the full window mouse capture for the SDL backend, ignoring the coordinates, while keeping the windows backend as is. And maybe at a later point I can look at improving the SDL implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants