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

[Merged by Bors] - Fix set_cursor_grab_mode to try an alternative mode before giving an error #6599

Closed
wants to merge 3 commits into from

Conversation

IceSentry
Copy link
Contributor

@IceSentry IceSentry commented Nov 13, 2022

Objective

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.

@IceSentry IceSentry added A-Windowing Platform-agnostic interface layer to run your app in C-Enhancement A new feature labels Nov 13, 2022
@alice-i-cecile
Copy link
Member

Yeah we should rename this to reflect the bool nature

@alice-i-cecile
Copy link
Member

Ugh, this is technically a breaking change :( I'm probably fine violating semver here: the provided API basically doesn't work.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior and removed C-Enhancement A new feature labels Nov 13, 2022
@alice-i-cecile alice-i-cecile added this to the 0.9.1 milestone Nov 13, 2022
@IceSentry
Copy link
Contributor Author

One way to keep semver would be to keep the api and add a new one with bools. Maybe even tag the broken one as deprecated, but I'm not sure if deprecation warning break semver.

@mockersf
Copy link
Member

this was set_cursor_lock_mode in the 0.8 times

@IceSentry
Copy link
Contributor Author

Yes, but I decided to keep the grab terminology to stay closer to winit. Would you say it's better to keep it named grab_mode instead of grabbed?

@alice-i-cecile
Copy link
Member

Yeah I like the idea of keeping the old API with a deprecation so we can put this in the point release

@IceSentry
Copy link
Contributor Author

I reintroduced the api, but I modified the implementation a bit to avoid the error. This means that we technically don't need the boolean api, and this gives a tiny bit more control to the user. I left both in the PR for now, but I'm not sure what to do here.

@alice-i-cecile alice-i-cecile modified the milestones: 0.9.1, 0.10 Nov 25, 2022
@IceSentry IceSentry force-pushed the grab_mode_bool branch 2 times, most recently from 8ea185e to bab52f2 Compare November 25, 2022 23:02
@IceSentry
Copy link
Contributor Author

Updated to only use the fixed api and don't introduce a new api or remove anything.

@alice-i-cecile
Copy link
Member

I'm very happy with this now. Can you update your PR description?

@alice-i-cecile alice-i-cecile modified the milestones: 0.10, 0.9.1 Nov 25, 2022
@IceSentry IceSentry changed the title Make grab_mode a bool instead of enum Fix set_cursor_grab_mode to try an alternative mode before giving an error Nov 25, 2022
@IceSentry
Copy link
Contributor Author

IceSentry commented Nov 25, 2022

I updated the title and changed the docs a little bit to reflect that it's possible that the getter will return a value that is different from the one sent to winit.

Copy link
Contributor

@paul-hansen paul-hansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, this works on Windows and the changes look good to me.

Note that I had to remove the commit with the breaking change from main that's in this branch to test this with my project. I assume there's plan to avoid including that commit in the 0.9.1 release but just a heads up.

@IceSentry
Copy link
Contributor Author

Which commit is that? This PR shouldn't have any breaking commit.

@IceSentry
Copy link
Contributor Author

IceSentry commented Nov 26, 2022

Oh, is the issue that I made this PR from main? If that's the case then yeah the 0.9.1 release will only cherry pick this PR.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Nov 26, 2022
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Nov 26, 2022
…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.
@bors bors bot changed the title Fix set_cursor_grab_mode to try an alternative mode before giving an error [Merged by Bors] - Fix set_cursor_grab_mode to try an alternative mode before giving an error Nov 26, 2022
@bors bors bot closed this Nov 26, 2022
@IceSentry IceSentry deleted the grab_mode_bool branch November 28, 2022 21:50
cart pushed a commit that referenced this pull request Nov 30, 2022
…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.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting cursor grab mode causes errors to be printed with no way to handle it
4 participants