aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/win32/callback.rs
diff options
context:
space:
mode:
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
},