diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-09-21 14:43:10 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-09-21 14:43:10 +0200 |
commit | 1b28e32e3130f58db62da6d6f6fa5e7c31043798 (patch) | |
tree | 55fcd00afcab089d338692e7249d787972402d38 /src/api/win32 | |
parent | 6787f1d43493f0f8c2310ac3c3d5cb409d13ec40 (diff) | |
parent | 84d5db91af6924de9e6aab1ee78feeb6c41d4700 (diff) | |
download | glutin-1b28e32e3130f58db62da6d6f6fa5e7c31043798.tar.gz glutin-1b28e32e3130f58db62da6d6f6fa5e7c31043798.zip |
Merge pull request #587 from neivv/win32-alt
Handle events for Alt-<Key> and F10 presses in windows
Diffstat (limited to 'src/api/win32')
-rw-r--r-- | src/api/win32/callback.rs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/api/win32/callback.rs b/src/api/win32/callback.rs index c6e7763..da8e1a6 100644 --- a/src/api/win32/callback.rs +++ b/src/api/win32/callback.rs @@ -102,6 +102,14 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, 0 }, + // Prevents default windows menu hotkeys playing unwanted + // "ding" sounds. Alternatively could check for WM_SYSCOMMAND + // with wparam being SC_KEYMENU, but this may prevent some + // other unwanted default hotkeys as well. + winapi::WM_SYSCHAR => { + 0 + } + winapi::WM_MOUSEMOVE => { use events::Event::MouseMoved; @@ -126,15 +134,19 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, 0 }, - winapi::WM_KEYDOWN => { + winapi::WM_KEYDOWN | winapi::WM_SYSKEYDOWN => { use events::Event::KeyboardInput; use events::ElementState::Pressed; - let (scancode, vkey) = event::vkeycode_to_element(wparam, lparam); - send_event(window, KeyboardInput(Pressed, scancode, vkey)); - 0 + if msg == winapi::WM_SYSKEYDOWN && wparam as i32 == winapi::VK_F4 { + user32::DefWindowProcW(window, msg, wparam, lparam) + } else { + let (scancode, vkey) = event::vkeycode_to_element(wparam, lparam); + send_event(window, KeyboardInput(Pressed, scancode, vkey)); + 0 + } }, - winapi::WM_KEYUP => { + winapi::WM_KEYUP | winapi::WM_SYSKEYUP => { use events::Event::KeyboardInput; use events::ElementState::Released; let (scancode, vkey) = event::vkeycode_to_element(wparam, lparam); |