From 438d286fd5d5b0c007836bf88766ce920576c73c Mon Sep 17 00:00:00 2001 From: Mika <1299457+blaind@users.noreply.github.com> Date: Sat, 11 Dec 2021 04:14:31 +0200 Subject: [PATCH] Add new mappings for numlock, numpadenter and numpadcomma on X11 (#1937) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add X11 mappings * Update CHANGELOG.md Co-authored-by: Markus Røyset Co-authored-by: Markus Røyset --- CHANGELOG.md | 4 ++++ src/platform_impl/linux/x11/events.rs | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61cf4638..b7a39d7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Unreleased + +- On X11, add mappings for numpad comma, numpad enter, numlock and pause. + # 0.26.0 (2021-12-01) - Update `raw-window-handle` to `v0.4`. This is _not_ a breaking change, we still implement `HasRawWindowHandle` from `v0.3`, see [rust-windowing/raw-window-handle#74](https://github.com/rust-windowing/raw-window-handle/pull/74). Note that you might have to run `cargo update -p raw-window-handle` after upgrading. diff --git a/src/platform_impl/linux/x11/events.rs b/src/platform_impl/linux/x11/events.rs index 0c02ca0c..1c34b0d0 100644 --- a/src/platform_impl/linux/x11/events.rs +++ b/src/platform_impl/linux/x11/events.rs @@ -9,7 +9,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { //ffi::XK_Linefeed => VirtualKeyCode::Linefeed, //ffi::XK_Clear => VirtualKeyCode::Clear, ffi::XK_Return => VirtualKeyCode::Return, - //ffi::XK_Pause => VirtualKeyCode::Pause, + ffi::XK_Pause => VirtualKeyCode::Pause, //ffi::XK_Scroll_Lock => VirtualKeyCode::Scroll_lock, //ffi::XK_Sys_Req => VirtualKeyCode::Sys_req, ffi::XK_Escape => VirtualKeyCode::Escape, @@ -59,10 +59,10 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { //ffi::XK_Break => VirtualKeyCode::Break, //ffi::XK_Mode_switch => VirtualKeyCode::Mode_switch, //ffi::XK_script_switch => VirtualKeyCode::Script_switch, - //ffi::XK_Num_Lock => VirtualKeyCode::Num_lock, + ffi::XK_Num_Lock => VirtualKeyCode::Numlock, //ffi::XK_KP_Space => VirtualKeyCode::Kp_space, //ffi::XK_KP_Tab => VirtualKeyCode::Kp_tab, - //ffi::XK_KP_Enter => VirtualKeyCode::Kp_enter, + ffi::XK_KP_Enter => VirtualKeyCode::NumpadEnter, //ffi::XK_KP_F1 => VirtualKeyCode::Kp_f1, //ffi::XK_KP_F2 => VirtualKeyCode::Kp_f2, //ffi::XK_KP_F3 => VirtualKeyCode::Kp_f3, @@ -83,7 +83,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { ffi::XK_KP_Equal => VirtualKeyCode::NumpadEquals, ffi::XK_KP_Multiply => VirtualKeyCode::NumpadMultiply, ffi::XK_KP_Add => VirtualKeyCode::NumpadAdd, - //ffi::XK_KP_Separator => VirtualKeyCode::Kp_separator, + ffi::XK_KP_Separator => VirtualKeyCode::NumpadComma, ffi::XK_KP_Subtract => VirtualKeyCode::NumpadSubtract, ffi::XK_KP_Decimal => VirtualKeyCode::NumpadDecimal, ffi::XK_KP_Divide => VirtualKeyCode::NumpadDivide,