diff --git a/CHANGELOG.md b/CHANGELOG.md index b8077d4a..cc4386ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ - **Breaking:** On Web, `set_cursor_position` and `set_cursor_grab` will now always return an error. - **Breaking:** `PixelDelta` scroll events now return a `PhysicalPosition`. - 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) diff --git a/src/event.rs b/src/event.rs index 9e9320c2..134421ac 100644 --- a/src/event.rs +++ b/src/event.rs @@ -892,6 +892,10 @@ pub enum VirtualKeyCode { Numpad7, Numpad8, Numpad9, + NumpadComma, + NumpadEnter, + NumpadEquals, + NumpadSubtract, AbntC1, AbntC2, @@ -930,9 +934,6 @@ pub enum VirtualKeyCode { NavigateBackward, NextTrack, NoConvert, - NumpadComma, - NumpadEnter, - NumpadEquals, OEM102, Period, PlayPause, @@ -947,7 +948,6 @@ pub enum VirtualKeyCode { Slash, Sleep, Stop, - Subtract, Sysrq, Tab, Underline, diff --git a/src/platform_impl/linux/wayland/keyboard.rs b/src/platform_impl/linux/wayland/keyboard.rs index 8f911888..fb9219e0 100644 --- a/src/platform_impl/linux/wayland/keyboard.rs +++ b/src/platform_impl/linux/wayland/keyboard.rs @@ -340,7 +340,7 @@ fn keysym_to_vkey(keysym: u32) -> Option { keysyms::XKB_KEY_KP_Enter => Some(VirtualKeyCode::NumpadEnter), keysyms::XKB_KEY_KP_Equal => Some(VirtualKeyCode::NumpadEquals), 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_Page_Up => Some(VirtualKeyCode::PageUp), keysyms::XKB_KEY_KP_Page_Down => Some(VirtualKeyCode::PageDown), @@ -360,7 +360,6 @@ fn keysym_to_vkey(keysym: u32) -> Option { keysyms::XKB_KEY_slash => Some(VirtualKeyCode::Slash), // => Some(VirtualKeyCode::Sleep), // => Some(VirtualKeyCode::Stop), - // => Some(VirtualKeyCode::Subtract), // => Some(VirtualKeyCode::Sysrq), keysyms::XKB_KEY_Tab => Some(VirtualKeyCode::Tab), keysyms::XKB_KEY_ISO_Left_Tab => Some(VirtualKeyCode::Tab), diff --git a/src/platform_impl/linux/x11/events.rs b/src/platform_impl/linux/x11/events.rs index 1b4996e7..f7d98b98 100644 --- a/src/platform_impl/linux/x11/events.rs +++ b/src/platform_impl/linux/x11/events.rs @@ -84,7 +84,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { //ffi::XK_KP_Multiply => VirtualKeyCode::NumpadMultiply, ffi::XK_KP_Add => VirtualKeyCode::Add, //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_Divide => VirtualKeyCode::Divide, ffi::XK_KP_0 => VirtualKeyCode::Numpad0, @@ -186,7 +186,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { //ffi::XK_asterisk => VirtualKeyCode::Asterisk, ffi::XK_plus => VirtualKeyCode::Add, ffi::XK_comma => VirtualKeyCode::Comma, - ffi::XK_minus => VirtualKeyCode::Subtract, + ffi::XK_minus => VirtualKeyCode::Minus, ffi::XK_period => VirtualKeyCode::Period, ffi::XK_slash => VirtualKeyCode::Slash, ffi::XK_0 => VirtualKeyCode::Key0, diff --git a/src/platform_impl/macos/event.rs b/src/platform_impl/macos/event.rs index 6e231940..dd12c973 100644 --- a/src/platform_impl/macos/event.rs +++ b/src/platform_impl/macos/event.rs @@ -169,7 +169,7 @@ pub fn scancode_to_keycode(scancode: c_ushort) -> Option { 0x4b => VirtualKeyCode::Divide, 0x4c => VirtualKeyCode::NumpadEnter, //0x4d => unkown, - 0x4e => VirtualKeyCode::Subtract, + 0x4e => VirtualKeyCode::NumpadSubtract, 0x4f => VirtualKeyCode::F18, 0x50 => VirtualKeyCode::F19, 0x51 => VirtualKeyCode::NumpadEquals, diff --git a/src/platform_impl/web/stdweb/event.rs b/src/platform_impl/web/stdweb/event.rs index d57f9bb5..e9bb1b38 100644 --- a/src/platform_impl/web/stdweb/event.rs +++ b/src/platform_impl/web/stdweb/event.rs @@ -195,7 +195,7 @@ pub fn virtual_key_code(event: &impl IKeyboardEvent) -> Option { "Slash" => VirtualKeyCode::Slash, "Sleep" => VirtualKeyCode::Sleep, "Stop" => VirtualKeyCode::Stop, - "NumpadSubtract" => VirtualKeyCode::Subtract, + "NumpadSubtract" => VirtualKeyCode::NumpadSubtract, "Sysrq" => VirtualKeyCode::Sysrq, "Tab" => VirtualKeyCode::Tab, "Underline" => VirtualKeyCode::Underline, diff --git a/src/platform_impl/web/web_sys/event.rs b/src/platform_impl/web/web_sys/event.rs index 18927d40..80291568 100644 --- a/src/platform_impl/web/web_sys/event.rs +++ b/src/platform_impl/web/web_sys/event.rs @@ -204,7 +204,7 @@ pub fn virtual_key_code(event: &KeyboardEvent) -> Option { "Slash" => VirtualKeyCode::Slash, "Sleep" => VirtualKeyCode::Sleep, "Stop" => VirtualKeyCode::Stop, - "NumpadSubtract" => VirtualKeyCode::Subtract, + "NumpadSubtract" => VirtualKeyCode::NumpadSubtract, "Sysrq" => VirtualKeyCode::Sysrq, "Tab" => VirtualKeyCode::Tab, "Underline" => VirtualKeyCode::Underline, diff --git a/src/platform_impl/windows/event.rs b/src/platform_impl/windows/event.rs index 49501f1a..40312418 100644 --- a/src/platform_impl/windows/event.rs +++ b/src/platform_impl/windows/event.rs @@ -262,7 +262,7 @@ pub fn vkey_to_winit_vkey(vkey: c_int) -> Option { winuser::VK_MULTIPLY => Some(VirtualKeyCode::Multiply), winuser::VK_ADD => Some(VirtualKeyCode::Add), //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_DIVIDE => Some(VirtualKeyCode::Divide), winuser::VK_F1 => Some(VirtualKeyCode::F1),