fix: winit does not consider space a named key anymore to comply with spec

This commit is contained in:
Ashley Wulber 2026-03-06 12:55:12 -05:00 committed by Ashley Wulber
parent b22d363f2c
commit 02149769ec
2 changed files with 4 additions and 3 deletions

View file

@ -991,8 +991,6 @@ pub enum Code {
ShiftLeft,
/// <kbd>Shift</kbd> or <kbd>⇧</kbd>
ShiftRight,
/// <kbd> </kbd> (space)
Space,
/// <kbd>Tab</kbd> or <kbd>⇥</kbd>
Tab,
/// Japanese: <kbd>変</kbd> (henkan)

View file

@ -682,7 +682,9 @@ pub fn keysym_to_key(keysym: u32) -> Key {
keysyms::_3270_PrintScreen => Named::PrintScreen,
keysyms::_3270_Enter => Named::Enter,
keysyms::space => Named::Space,
keysyms::space => {
return Key::Character(" ".into());
}
// exclam..Sinh_kunddaliya
// XFree86
@ -1069,6 +1071,7 @@ pub fn key_to_keysym(
(Some('*'), Location::Numpad) => keysyms::KP_Multiply,
(Some('/'), Location::Numpad) => keysyms::KP_Divide,
(Some('='), Location::Numpad) => keysyms::KP_Equal,
(Some(' '), _) => keysyms::space,
(Some(c), _) => unsafe {
let keysym =