mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 05:10:03 -04:00
Modified Windows key event handling to support modifier keys.
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user