Skip to content

Wrong key codes for Shift+Number and others - German/Other^^^ keyboard layouts for macOS not supported? #2631

@DerKarlos

Description

@DerKarlos

I am using a Mac Air with a German keyboard layout.
Bevy includes winit "0.27.5"

While the number keys 1..9 and 0 are ok,
pressing one of the shift keys puzzles me:
Shift+1 comes as "Key1", not "!"
Shift+2 comes correctly as "Apostrophe"
Shift+3 comes as "Key3", not "§"
Shift+4 comes as "Key4", not "$"
Shift+5 comes as "Key5", not "%"
Shift+6 comes as "Key7" Seven! not "&"
Shift+7 comes correctly as "Slash"
Shift+8 comes as "Key9" ! not "("
Shift+9 comes as "Key0" ! not ")"
Shift+0 comes correctly as "Equal"

Some keys result in odd key-codes also:
The + key comes as "Equals"
The # key comes as "Key3" to

In winit/src/platform_impl/macos/event.rs I see how that could be caused.
'3' | '#' => VirtualKeyCode::Key3,
WINIT does not consider different keyboard layouts (for mac) anyway.
Mostly I can consider this in my code, but not for all, the 3/# for example.

I checked for the scan codes, they look ok. Using them would be a workaround
but I need to consider different keyboard layouts myself!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DS - appkitAffects the AppKit/macOS backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions