-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Complexities with international keyboard layouts (macOS) #263
Copy link
Copy link
Closed
Labels
B - bugDang, that shouldn't have happenedDang, that shouldn't have happenedD - hardLikely harder than most tasks hereLikely harder than most tasks hereDS - appkitAffects the AppKit/macOS backendAffects the AppKit/macOS backendH - help wantedSomeone please save usSomeone please save usP - normalGreat to haveGreat to haveS - platform parityUnintended platform differencesUnintended platform differences
Metadata
Metadata
Assignees
Labels
B - bugDang, that shouldn't have happenedDang, that shouldn't have happenedD - hardLikely harder than most tasks hereLikely harder than most tasks hereDS - appkitAffects the AppKit/macOS backendAffects the AppKit/macOS backendH - help wantedSomeone please save usSomeone please save usP - normalGreat to haveGreat to haveS - platform parityUnintended platform differencesUnintended platform differences
Type
Fields
Give feedbackNo fields configured for issues without a type.
See my two comments on the Alacritty project for more details: alacritty/alacritty#209 (comment)
Basically, there are two problems when trying to use winit for keyboard processing with non-U.S. key maps:
The first one is pretty obvious: on my keyboard, typing an
åsendsVirtualKeyCode::LBracket, and there are plenty of other mismatched keys.-isSlash,+isMinus, etc.The second one is mostly a problem when you want to implement keyboard shortcuts, and is compounded by macOS always treating Option as AltGr. If you type
<Option>-x, you receive the≈character with the alt modifier set. There's no generic way to get back the unmodified character,x. You can reverse this in your application layer on a U.S. keyboard by mappingVirtualKeyCode::Xback to an 'x' yourself, but, thanks to the earlier problem, it doesn't work with other key layouts. On my keyboard,<Option>-'sends™, and if I reversed it I would be reversingVirtualKeyCode::Backslashinto\instead of'.It seems like one or the other of these needs to be fixed – though preferrably both – to use winit for raw key processing across key layouts.
I'm not sure if it's possible across all of the OSs, but possibly the VirtualKeyCode enum could encode the character that the key generates... so you would get
VirtualKeyCode::Backslash(Some('))when you press™on a swedish keyboard, and even though the name is wrong you can still extract out the 'base' key character?