From c8a1e4c8b540df1a5e71bb5f83f3eaa8253fa30e Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Fri, 19 Feb 2021 01:58:45 -0500 Subject: [PATCH] Map XK_Caps_Lock to VirtualKeyCode::Capital This allows applications to handle events for the caps lock key under X11 --- CHANGELOG.md | 1 + src/platform_impl/linux/x11/events.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fad7afd131..4ea4aca61d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - On Windows, added `WindowBuilderExtWindows::with_menu` to set a custom menu at window creation time. - On Android, bump `ndk` and `ndk-glue` to 0.3: use predefined constants for event `ident`. - On Web, added support for `DeviceEvent::MouseMotion` to listen for relative mouse movements. +- On X11, fix events for caps lock key not being sent # 0.24.0 (2020-12-09) diff --git a/src/platform_impl/linux/x11/events.rs b/src/platform_impl/linux/x11/events.rs index 0c02ca0c82..d1914f9240 100644 --- a/src/platform_impl/linux/x11/events.rs +++ b/src/platform_impl/linux/x11/events.rs @@ -161,7 +161,7 @@ pub fn keysym_to_element(keysym: libc::c_uint) -> Option { ffi::XK_Shift_R => VirtualKeyCode::RShift, ffi::XK_Control_L => VirtualKeyCode::LControl, ffi::XK_Control_R => VirtualKeyCode::RControl, - //ffi::XK_Caps_Lock => VirtualKeyCode::Caps_lock, + ffi::XK_Caps_Lock => VirtualKeyCode::Capital, //ffi::XK_Shift_Lock => VirtualKeyCode::Shift_lock, //ffi::XK_Meta_L => VirtualKeyCode::Meta_l, //ffi::XK_Meta_R => VirtualKeyCode::Meta_r,