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

Unexpected Logical Key Value #3453

Closed
Shute052 opened this issue Feb 4, 2024 · 2 comments
Closed

Unexpected Logical Key Value #3453

Shute052 opened this issue Feb 4, 2024 · 2 comments

Comments

@Shute052
Copy link

Shute052 commented Feb 4, 2024

Reported in Bevy issue #11689, the problem arises with the winit dependency at version 0.29.2. As a newcomer to winit, I'm struggling to create a reproduction case for it, which is quite unfortunate.

I've included the Bevy converter below, designed to transform winit Keys into their owns:

pub fn convert_logical_key(logical_key_code: &winit::keyboard::Key) -> bevy_input::keyboard::Key {
    match logical_key_code {
        winit::keyboard::Key::Character(s) => bevy_input::keyboard::Key::Character(s.clone()),
        // Other cases are also straightforward one-to-one mappings
    }
}

From my perspective, a logical key should remain consistent regardless of external factors.
However, the situation is that the 'W' key reporting a lowercase 'w' normally and an uppercase 'W' when CapsLock is activated or Shift is pressed.

@kchibisov
Copy link
Member

it's called logical key for a reason and that's how it's usually done, the winit key input is modeled around w3c key event, and it also has them like that.

if you want unmodified, there's key_without_modifier or physical key.

@Shute052
Copy link
Author

Shute052 commented Feb 4, 2024

Ahh, this is helpful, thanks! It seems to should keep discussion in Bevy parts since games always need shortcuts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants