aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/win32/callback.rs
diff options
context:
space:
mode:
authorDylan Ede <dylanede@googlemail.com>2015-08-03 15:54:56 +0100
committerDylan Ede <dylanede@googlemail.com>2015-08-26 14:37:05 +0100
commit3427308c607f9156a958cedd8ba4f101ae293e4d (patch)
treeb3e77d738aca3dfb125b5774521c84779306acda /src/api/win32/callback.rs
parent7dd98efccb61578e4aec7fdd166e81878fe84839 (diff)
downloadglutin-3427308c607f9156a958cedd8ba4f101ae293e4d.tar.gz
glutin-3427308c607f9156a958cedd8ba4f101ae293e4d.zip
Modified Windows key event handling to support modifier keys.
Diffstat (limited to 'src/api/win32/callback.rs')
-rw-r--r--src/api/win32/callback.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/api/win32/callback.rs b/src/api/win32/callback.rs
index 5667ca8..c6e7763 100644
--- a/src/api/win32/callback.rs
+++ b/src/api/win32/callback.rs
@@ -129,8 +129,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
winapi::WM_KEYDOWN => {
use events::Event::KeyboardInput;
use events::ElementState::Pressed;
- let scancode = ((lparam >> 16) & 0xff) as u8;
- let vkey = event::vkeycode_to_element(wparam);
+ let (scancode, vkey) = event::vkeycode_to_element(wparam, lparam);
send_event(window, KeyboardInput(Pressed, scancode, vkey));
0
},
@@ -138,8 +137,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
winapi::WM_KEYUP => {
use events::Event::KeyboardInput;
use events::ElementState::Released;
- let scancode = ((lparam >> 16) & 0xff) as u8;
- let vkey = event::vkeycode_to_element(wparam);
+ let (scancode, vkey) = event::vkeycode_to_element(wparam, lparam);
send_event(window, KeyboardInput(Released, scancode, vkey));
0
},