-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Rename keys like LAlt
to AltLeft
#8792
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this differs from winit's KeyCode naming, I think this makes things a bit clearer for non-Windows users.
I might be biased though: #3240 (my first ever issue for Bevy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but if possible we should add a doc alias to the enum variant. No idea if that's supported though :)
This needs a little more careful consideration. |
This is also part of the winit update (#8745). |
I could add doc aliases to the enum cases. Something like |
Great, I like the doc aliases regardless of the final decision here. |
crates/bevy_input/src/keyboard.rs
Outdated
/// Generic keyboards usually display this key with the *Microsoft Windows* logo. | ||
/// Apple keyboards call this key the *Command Key* and display it using the ⌘ character. | ||
#[doc(alias("LWin", "LMeta", "LLogo"))] | ||
LSuper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LSuper, | |
SuperLeft, |
We should align with #8745 to avoid conflicts (and keep consistency with upstream).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we then also rename LAlt
, LBracket
, LControl
, and LShift
to LeftAlt
etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AltLeft
, but yes, I agree. I think that the increased clarity is worth the extra characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure @mockersf has opinions though :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case we should also adjust the doc aliases to WinLeft
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure @mockersf has opinions though :p
If we change one, we should change them all... but no opinion on wether to do it now or with winit update later
crates/bevy_input/src/keyboard.rs
Outdated
/// Generic keyboards usually display this key with the *Microsoft Windows* logo. | ||
/// Apple keyboards call this key the *Command Key* and display it using the ⌘ character. | ||
#[doc(alias("RWin", "RMeta", "RLogo"))] | ||
RSuper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSuper, | |
SuperRight, |
As author of in #8792, I saw this PR linked, I'm ok with handling the potential conflicts due to merging this PR :) The PR description mentions winit's ModifiersKeys ; but as hinted in the comments, I think I'd prefer to keep our namings matched to winit's KeyCode.
I'm alright with temporary winit difference, if consensus is that it's clearer. If there's no issue with #8745, namings should be back to similar after we update to winit 0.29 (hopefully bevy 0.12). |
So I renamed the key codes to |
Also, the title and description (at least the migration guide) should probably be updated to make the changelog work easier for 0.11 |
LWin
and RWin
to LSuper
and RSuper
LAlt
to AltLeft
/// The `Left Alt` key. Maps to `Left Option` on Mac. | ||
AltLeft, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor thing: The doc string is now the reverse of the actual name.
Not sure if this matters though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm not a fan of winit's naming here but it makes sense to be consistent with them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think this is fine.
Alright, merging this in as no one else has expressed opposition after more socialization and there's consensus that these names are clearer :) |
Objective
The
KeyCode
enum casesLWin
andRWin
are too opinionated because they are also assigned meaning by non-Windows operating systems. macOS calls the keys completely different.Solution
Match winits approach naming convention.
Migration Guide
Migrate by replacing:
LAlt
→AltLeft
RAlt
→AltRight
LBracket
→BracketLeft
RBracket
→BracketRight
LControl
→ControlLeft
RControl
→ControlRight
LShift
→ShiftLeft
RShift
→ShiftRight
LWin
→SuperLeft
RWin
→SuperRight