-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Setting cursor grab mode causes errors to be printed with no way to handle it #6590
Comments
After a bit more investigation, it seems to be that |
Yeah, the un/grab is now an enum, and I think that CursorGrabMode::Locked is not supported for winit as of yet, we should change it to |
To add a bit more detail, We should at least document this behaviour. |
CursorGrabMode |
Punting to 0.10 as I'm unsure how to solve this effectively. |
My current fix is semver compatible and uses the recommended approach from winit so it could be in 0.9.1. At the very least I think we should update the docs to explain the issue and maybe add a snippet to show how to make it cross platform. |
…error (#6599) # Objective - Closes #6590 - The grab mode is platform dependent, this is problematic for bevy users since we can't easily use the recommended way to detect if the feature works like the winit docs recommend https://docs.rs/winit/0.27.5/winit/window/struct.Window.html#method.set_cursor_grab ## Solution Try to use the grab mode that was requested, if it fails use the other one. Only then log an error if it fails after this step.
…error (bevyengine#6599) # Objective - Closes bevyengine#6590 - The grab mode is platform dependent, this is problematic for bevy users since we can't easily use the recommended way to detect if the feature works like the winit docs recommend https://docs.rs/winit/0.27.5/winit/window/struct.Window.html#method.set_cursor_grab ## Solution Try to use the grab mode that was requested, if it fails use the other one. Only then log an error if it fails after this step.
…error (#6599) # Objective - Closes bevyengine/bevy#6590 - The grab mode is platform dependent, this is problematic for bevy users since we can't easily use the recommended way to detect if the feature works like the winit docs recommend https://docs.rs/winit/0.27.5/winit/window/struct.Window.html#method.set_cursor_grab ## Solution Try to use the grab mode that was requested, if it fails use the other one. Only then log an error if it fails after this step.
Bevy version
0.9 and latest
What you did
Ran the mouse_grab example.
What went wrong
When pressing the left button, winit does successfully set the grab mode, but bevy prints an error message:
In the example this happens only once because it's behind a condition, but if you run it unconditionally in a system it will print this every frame even when the cursor is clearly locked/unlocked. In other words the feature clearly is supported yet winit reports an error.
The main issue here is that we can't get the result from winit and handle it user side. Ignoring the error in bevy wouldn't be ideal either, but that means an unavoidable error message for anyone that uses this api.
Relevant system information
Windows 10
The text was updated successfully, but these errors were encountered: