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

Rename keys like LAlt to AltLeft #8792

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions crates/bevy_input/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,11 @@ pub enum KeyCode {
LControl,
/// The `LShift` / `Left Shift` key.
LShift,
/// The `LWin` / `Left Windows` key. Maps to `Left Command` on Mac.
LWin,
/// The `LSuper` / `Left Super` key.
/// 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,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
LSuper,
SuperLeft,

We should align with #8745 to avoid conflicts (and keep consistency with upstream).

Copy link
Contributor Author

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.?

Copy link
Member

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.

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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


/// The `Mail` key.
Mail,
Expand Down Expand Up @@ -376,8 +379,11 @@ pub enum KeyCode {
RControl,
/// The `RShift` / `Right Shift` key.
RShift,
/// The `RWin` / `Right Windows` key. Maps to `Right Command` on Mac.
RWin,
/// The `RSuper` / `Right Super` key.
/// 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,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
RSuper,
SuperRight,


/// The `Semicolon` / `;` key.
Semicolon,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_winit/src/converters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
winit::event::VirtualKeyCode::LBracket => KeyCode::LBracket,
winit::event::VirtualKeyCode::LControl => KeyCode::LControl,
winit::event::VirtualKeyCode::LShift => KeyCode::LShift,
winit::event::VirtualKeyCode::LWin => KeyCode::LWin,
winit::event::VirtualKeyCode::LWin => KeyCode::LSuper,
winit::event::VirtualKeyCode::Mail => KeyCode::Mail,
winit::event::VirtualKeyCode::MediaSelect => KeyCode::MediaSelect,
winit::event::VirtualKeyCode::MediaStop => KeyCode::MediaStop,
Expand All @@ -200,7 +200,7 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
winit::event::VirtualKeyCode::RBracket => KeyCode::RBracket,
winit::event::VirtualKeyCode::RControl => KeyCode::RControl,
winit::event::VirtualKeyCode::RShift => KeyCode::RShift,
winit::event::VirtualKeyCode::RWin => KeyCode::RWin,
winit::event::VirtualKeyCode::RWin => KeyCode::RSuper,
winit::event::VirtualKeyCode::Semicolon => KeyCode::Semicolon,
winit::event::VirtualKeyCode::Slash => KeyCode::Slash,
winit::event::VirtualKeyCode::Sleep => KeyCode::Sleep,
Expand Down