Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture Mouse in SDL #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

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