mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Unify Minus/Subtract virtual keycodes
On all platforms other than Linux/X11, the Subtract key was uniformly used only for the Numpad. To make this cross-platform compatible, the `-` key will now map to `Minus` on X11 instead of `Subtract`. Since people have been confused about the difference between `Minus` and `Subtract` in the past, the `Subtract` key has also been renamed to `NumpadSubtract`. This is a breaking change that might be annoying to downstream since there's no direct improvement, but it should help new users in the future. Alternatively this could just be documented, rather than explicitly mentioning the Numpad in the name.
This commit is contained in:
parent
02a34a167a
commit
a2db4c0a32
|
@ -23,6 +23,8 @@
|
||||||
- **Breaking:** On Web, `set_cursor_position` and `set_cursor_grab` will now always return an error.
|
- **Breaking:** On Web, `set_cursor_position` and `set_cursor_grab` will now always return an error.
|
||||||
- **Breaking:** `PixelDelta` scroll events now return a `PhysicalPosition`.
|
- **Breaking:** `PixelDelta` scroll events now return a `PhysicalPosition`.
|
||||||
- On NetBSD, fixed crash due to incorrect detection of the main thread.
|
- On NetBSD, fixed crash due to incorrect detection of the main thread.
|
||||||
|
- **Breaking:** The virtual key code `Subtract` has been renamed to `NumpadSubtract`
|
||||||
|
- **Breaking:** On X11, `-` key is mapped to the `Minus` virtual key code, instead of `Subtract`
|
||||||
|
|
||||||
# 0.22.2 (2020-05-16)
|
# 0.22.2 (2020-05-16)
|
||||||
|
|
||||||
|
|
|
@ -892,6 +892,10 @@ pub enum VirtualKeyCode {
|
||||||
Numpad7,
|
Numpad7,
|
||||||
Numpad8,
|
Numpad8,
|
||||||
Numpad9,
|
Numpad9,
|
||||||
|
NumpadComma,
|
||||||
|
NumpadEnter,
|
||||||
|
NumpadEquals,
|
||||||
|
NumpadSubtract,
|
||||||
|
|
||||||
AbntC1,
|
AbntC1,
|
||||||
AbntC2,
|
AbntC2,
|
||||||
|
@ -930,9 +934,6 @@ pub enum VirtualKeyCode {
|
||||||
NavigateBackward,
|
NavigateBackward,
|
||||||
NextTrack,
|
NextTrack,
|
||||||
NoConvert,
|
NoConvert,
|
||||||
NumpadComma,
|
|
||||||
NumpadEnter,
|
|
||||||
NumpadEquals,
|
|
||||||
OEM102,
|
OEM102,
|
||||||
Period,
|
Period,
|
||||||
PlayPause,
|
PlayPause,
|
||||||
|
@ -947,7 +948,6 @@ pub enum VirtualKeyCode {
|
||||||
Slash,
|
Slash,
|
||||||
Sleep,
|
Sleep,
|
||||||
Stop,
|
Stop,
|
||||||
Subtract,
|
|
||||||
Sysrq,
|
Sysrq,
|
||||||
Tab,
|
Tab,
|
||||||
Underline,
|
Underline,
|
||||||
|
|
|
@ -340,7 +340,7 @@ fn keysym_to_vkey(keysym: u32) -> Option<VirtualKeyCode> {
|
||||||
keysyms::XKB_KEY_KP_Enter => Some(VirtualKeyCode::NumpadEnter),
|
keysyms::XKB_KEY_KP_Enter => Some(VirtualKeyCode::NumpadEnter),
|
||||||
keysyms::XKB_KEY_KP_Equal => Some(VirtualKeyCode::NumpadEquals),
|
keysyms::XKB_KEY_KP_Equal => Some(VirtualKeyCode::NumpadEquals),
|
||||||
keysyms::XKB_KEY_KP_Add => Some(VirtualKeyCode::Add),
|
keysyms::XKB_KEY_KP_Add => Some(VirtualKeyCode::Add),
|
||||||
keysyms::XKB_KEY_KP_Subtract => Some(VirtualKeyCode::Subtract),
|
keysyms::XKB_KEY_KP_Subtract => Some(VirtualKeyCode::NumpadSubtract),
|
||||||
keysyms::XKB_KEY_KP_Divide => Some(VirtualKeyCode::Divide),
|
keysyms::XKB_KEY_KP_Divide => Some(VirtualKeyCode::Divide),
|
||||||
keysyms::XKB_KEY_KP_Page_Up => Some(VirtualKeyCode::PageUp),
|
keysyms::XKB_KEY_KP_Page_Up => Some(VirtualKeyCode::PageUp),
|
||||||
keysyms::XKB_KEY_KP_Page_Down => Some(VirtualKeyCode::PageDown),
|
keysyms::XKB_KEY_KP_Page_Down => Some(VirtualKeyCode::PageDown),
|
||||||
|
@ -360,7 +360,6 @@ fn keysym_to_vkey(keysym: u32) -> Option<VirtualKeyCode> {
|
||||||
keysyms::XKB_KEY_slash => Some(VirtualKeyCode::Slash),
|
keysyms::XKB_KEY_slash => Some(VirtualKeyCode::Slash),
|
||||||
// => Some(VirtualKeyCode::Sleep),
|
// => Some(VirtualKeyCode::Sleep),
|
||||||
// => Some(VirtualKeyCode::Stop),
|
// => Some(VirtualKeyCode::Stop),
|
||||||
// => Some(VirtualKeyCode::Subtract),
|
|
||||||
// => Some(VirtualKeyCode::Sysrq),
|
// => Some(VirtualKeyCode::Sysrq),
|
||||||
keysyms::XKB_KEY_Tab => Some(VirtualKeyCode::Tab),
|
keysyms::XKB_KEY_Tab => Some(VirtualKeyCode::Tab),
|
||||||
keysyms::XKB_KEY_ISO_Left_Tab => Some(VirtualKeyCode::Tab),
|
keysyms::XKB_KEY_ISO_Left_Tab => Some(VirtualKeyCode::Tab),
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option<VirtualKeyCode> {
|
||||||
//ffi::XK_KP_Multiply => VirtualKeyCode::NumpadMultiply,
|
//ffi::XK_KP_Multiply => VirtualKeyCode::NumpadMultiply,
|
||||||
ffi::XK_KP_Add => VirtualKeyCode::Add,
|
ffi::XK_KP_Add => VirtualKeyCode::Add,
|
||||||
//ffi::XK_KP_Separator => VirtualKeyCode::Kp_separator,
|
//ffi::XK_KP_Separator => VirtualKeyCode::Kp_separator,
|
||||||
ffi::XK_KP_Subtract => VirtualKeyCode::Subtract,
|
ffi::XK_KP_Subtract => VirtualKeyCode::NumpadSubtract,
|
||||||
//ffi::XK_KP_Decimal => VirtualKeyCode::Kp_decimal,
|
//ffi::XK_KP_Decimal => VirtualKeyCode::Kp_decimal,
|
||||||
ffi::XK_KP_Divide => VirtualKeyCode::Divide,
|
ffi::XK_KP_Divide => VirtualKeyCode::Divide,
|
||||||
ffi::XK_KP_0 => VirtualKeyCode::Numpad0,
|
ffi::XK_KP_0 => VirtualKeyCode::Numpad0,
|
||||||
|
@ -186,7 +186,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option<VirtualKeyCode> {
|
||||||
//ffi::XK_asterisk => VirtualKeyCode::Asterisk,
|
//ffi::XK_asterisk => VirtualKeyCode::Asterisk,
|
||||||
ffi::XK_plus => VirtualKeyCode::Add,
|
ffi::XK_plus => VirtualKeyCode::Add,
|
||||||
ffi::XK_comma => VirtualKeyCode::Comma,
|
ffi::XK_comma => VirtualKeyCode::Comma,
|
||||||
ffi::XK_minus => VirtualKeyCode::Subtract,
|
ffi::XK_minus => VirtualKeyCode::Minus,
|
||||||
ffi::XK_period => VirtualKeyCode::Period,
|
ffi::XK_period => VirtualKeyCode::Period,
|
||||||
ffi::XK_slash => VirtualKeyCode::Slash,
|
ffi::XK_slash => VirtualKeyCode::Slash,
|
||||||
ffi::XK_0 => VirtualKeyCode::Key0,
|
ffi::XK_0 => VirtualKeyCode::Key0,
|
||||||
|
|
|
@ -169,7 +169,7 @@ pub fn scancode_to_keycode(scancode: c_ushort) -> Option<VirtualKeyCode> {
|
||||||
0x4b => VirtualKeyCode::Divide,
|
0x4b => VirtualKeyCode::Divide,
|
||||||
0x4c => VirtualKeyCode::NumpadEnter,
|
0x4c => VirtualKeyCode::NumpadEnter,
|
||||||
//0x4d => unkown,
|
//0x4d => unkown,
|
||||||
0x4e => VirtualKeyCode::Subtract,
|
0x4e => VirtualKeyCode::NumpadSubtract,
|
||||||
0x4f => VirtualKeyCode::F18,
|
0x4f => VirtualKeyCode::F18,
|
||||||
0x50 => VirtualKeyCode::F19,
|
0x50 => VirtualKeyCode::F19,
|
||||||
0x51 => VirtualKeyCode::NumpadEquals,
|
0x51 => VirtualKeyCode::NumpadEquals,
|
||||||
|
|
|
@ -195,7 +195,7 @@ pub fn virtual_key_code(event: &impl IKeyboardEvent) -> Option<VirtualKeyCode> {
|
||||||
"Slash" => VirtualKeyCode::Slash,
|
"Slash" => VirtualKeyCode::Slash,
|
||||||
"Sleep" => VirtualKeyCode::Sleep,
|
"Sleep" => VirtualKeyCode::Sleep,
|
||||||
"Stop" => VirtualKeyCode::Stop,
|
"Stop" => VirtualKeyCode::Stop,
|
||||||
"NumpadSubtract" => VirtualKeyCode::Subtract,
|
"NumpadSubtract" => VirtualKeyCode::NumpadSubtract,
|
||||||
"Sysrq" => VirtualKeyCode::Sysrq,
|
"Sysrq" => VirtualKeyCode::Sysrq,
|
||||||
"Tab" => VirtualKeyCode::Tab,
|
"Tab" => VirtualKeyCode::Tab,
|
||||||
"Underline" => VirtualKeyCode::Underline,
|
"Underline" => VirtualKeyCode::Underline,
|
||||||
|
|
|
@ -204,7 +204,7 @@ pub fn virtual_key_code(event: &KeyboardEvent) -> Option<VirtualKeyCode> {
|
||||||
"Slash" => VirtualKeyCode::Slash,
|
"Slash" => VirtualKeyCode::Slash,
|
||||||
"Sleep" => VirtualKeyCode::Sleep,
|
"Sleep" => VirtualKeyCode::Sleep,
|
||||||
"Stop" => VirtualKeyCode::Stop,
|
"Stop" => VirtualKeyCode::Stop,
|
||||||
"NumpadSubtract" => VirtualKeyCode::Subtract,
|
"NumpadSubtract" => VirtualKeyCode::NumpadSubtract,
|
||||||
"Sysrq" => VirtualKeyCode::Sysrq,
|
"Sysrq" => VirtualKeyCode::Sysrq,
|
||||||
"Tab" => VirtualKeyCode::Tab,
|
"Tab" => VirtualKeyCode::Tab,
|
||||||
"Underline" => VirtualKeyCode::Underline,
|
"Underline" => VirtualKeyCode::Underline,
|
||||||
|
|
|
@ -262,7 +262,7 @@ pub fn vkey_to_winit_vkey(vkey: c_int) -> Option<VirtualKeyCode> {
|
||||||
winuser::VK_MULTIPLY => Some(VirtualKeyCode::Multiply),
|
winuser::VK_MULTIPLY => Some(VirtualKeyCode::Multiply),
|
||||||
winuser::VK_ADD => Some(VirtualKeyCode::Add),
|
winuser::VK_ADD => Some(VirtualKeyCode::Add),
|
||||||
//winuser::VK_SEPARATOR => Some(VirtualKeyCode::Separator),
|
//winuser::VK_SEPARATOR => Some(VirtualKeyCode::Separator),
|
||||||
winuser::VK_SUBTRACT => Some(VirtualKeyCode::Subtract),
|
winuser::VK_SUBTRACT => Some(VirtualKeyCode::NumpadSubtract),
|
||||||
winuser::VK_DECIMAL => Some(VirtualKeyCode::Decimal),
|
winuser::VK_DECIMAL => Some(VirtualKeyCode::Decimal),
|
||||||
winuser::VK_DIVIDE => Some(VirtualKeyCode::Divide),
|
winuser::VK_DIVIDE => Some(VirtualKeyCode::Divide),
|
||||||
winuser::VK_F1 => Some(VirtualKeyCode::F1),
|
winuser::VK_F1 => Some(VirtualKeyCode::F1),
|
||||||
|
|
Loading…
Reference in a new issue