From 3d54525d46eba76379a67ea93bad87fad03cbb46 Mon Sep 17 00:00:00 2001 From: Krzysztof Kondrak Date: Wed, 16 Dec 2015 09:31:14 +0100 Subject: [PATCH] added support for Ctrl and Shift keys --- src/lib.rs | 6 +++++- src/windows.rs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a6548e1..0f5b33c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -135,8 +135,12 @@ pub enum Key { Space, Tab, CapsLock, + LeftShift, + RightShift, + LeftCtrl, + RightCtrl, - Count = 80, + Count = 84, } #[cfg(target_os = "windows")] diff --git a/src/windows.rs b/src/windows.rs index 52fa9ef..5340c33 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -106,6 +106,10 @@ fn update_key_state(window: &mut Window, wparam: u32, state: bool) { 0x039 => window.keys[Key::Space as usize] = state, 0x00F => window.keys[Key::Tab as usize] = state, 0x03A => window.keys[Key::CapsLock as usize] = state, + 0x02A => window.keys[Key::LeftShift as usize] = state, + 0x036 => window.keys[Key::RightShift as usize] = state, + 0x01D => window.keys[Key::LeftCtrl as usize] = state, + 0x11D => window.keys[Key::RightCtrl as usize] = state, _ => (), } }