From 9e2a179daaa9f61b80733f1c0739b203a4bbaa8c Mon Sep 17 00:00:00 2001 From: Adam Casey Date: Sat, 19 Mar 2016 09:45:14 +0000 Subject: [PATCH] Enable more Windows keys This should enable most required keys on Windows. Mappings taken from: https://msdn.microsoft.com/en-gb/library/windows/desktop/dd375731%28v=vs.85%29.aspx and applied with some guesswork to the Glutin names. --- src/api/win32/event.rs | 62 +++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/src/api/win32/event.rs b/src/api/win32/event.rs index c4946bb2..a4de7503 100644 --- a/src/api/win32/event.rs +++ b/src/api/win32/event.rs @@ -42,7 +42,7 @@ pub fn vkeycode_to_element(wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> (S winapi::VK_KANJI => Some(VirtualKeyCode::Kanji), winapi::VK_ESCAPE => Some(VirtualKeyCode::Escape), winapi::VK_CONVERT => Some(VirtualKeyCode::Convert), - //winapi::VK_NONCONVERT => Some(VirtualKeyCode::Nonconvert), + winapi::VK_NONCONVERT => Some(VirtualKeyCode::NoConvert), //winapi::VK_ACCEPT => Some(VirtualKeyCode::Accept), //winapi::VK_MODECHANGE => Some(VirtualKeyCode::Modechange), winapi::VK_SPACE => Some(VirtualKeyCode::Space), @@ -143,44 +143,38 @@ pub fn vkeycode_to_element(wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> (S winapi::VK_F24 => Some(VirtualKeyCode::F24),*/ winapi::VK_NUMLOCK => Some(VirtualKeyCode::Numlock), winapi::VK_SCROLL => Some(VirtualKeyCode::Scroll), - /*winapi::VK_LSHIFT => Some(VirtualKeyCode::Lshift), - winapi::VK_RSHIFT => Some(VirtualKeyCode::Rshift), - winapi::VK_LCONTROL => Some(VirtualKeyCode::Lcontrol), - winapi::VK_RCONTROL => Some(VirtualKeyCode::Rcontrol), - winapi::VK_LMENU => Some(VirtualKeyCode::Lmenu), - winapi::VK_RMENU => Some(VirtualKeyCode::Rmenu),*/ winapi::VK_BROWSER_BACK => Some(VirtualKeyCode::NavigateBackward), winapi::VK_BROWSER_FORWARD => Some(VirtualKeyCode::NavigateForward), - /*winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::Browser_refresh), - winapi::VK_BROWSER_STOP => Some(VirtualKeyCode::Browser_stop), - winapi::VK_BROWSER_SEARCH => Some(VirtualKeyCode::Browser_search), - winapi::VK_BROWSER_FAVORITES => Some(VirtualKeyCode::Browser_favorites), - winapi::VK_BROWSER_HOME => Some(VirtualKeyCode::Browser_home), - winapi::VK_VOLUME_MUTE => Some(VirtualKeyCode::Volume_mute), - winapi::VK_VOLUME_DOWN => Some(VirtualKeyCode::Volume_down), - winapi::VK_VOLUME_UP => Some(VirtualKeyCode::Volume_up), - winapi::VK_MEDIA_NEXT_TRACK => Some(VirtualKeyCode::Media_next_track), - winapi::VK_MEDIA_PREV_TRACK => Some(VirtualKeyCode::Media_prev_track), - winapi::VK_MEDIA_STOP => Some(VirtualKeyCode::Media_stop), - winapi::VK_MEDIA_PLAY_PAUSE => Some(VirtualKeyCode::Media_play_pause), - winapi::VK_LAUNCH_MAIL => Some(VirtualKeyCode::Launch_mail), - winapi::VK_LAUNCH_MEDIA_SELECT => Some(VirtualKeyCode::Launch_media_select), - winapi::VK_LAUNCH_APP1 => Some(VirtualKeyCode::Launch_app1), - winapi::VK_LAUNCH_APP2 => Some(VirtualKeyCode::Launch_app2), - winapi::VK_OEM_1 => Some(VirtualKeyCode::Oem_1),*/ - winapi::VK_OEM_PLUS => Some(VirtualKeyCode::Add), + winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::WebRefresh), + winapi::VK_BROWSER_STOP => Some(VirtualKeyCode::WebStop), + winapi::VK_BROWSER_SEARCH => Some(VirtualKeyCode::WebSearch), + winapi::VK_BROWSER_FAVORITES => Some(VirtualKeyCode::WebFavorites), + winapi::VK_BROWSER_HOME => Some(VirtualKeyCode::WebHome), + winapi::VK_VOLUME_MUTE => Some(VirtualKeyCode::Mute), + winapi::VK_VOLUME_DOWN => Some(VirtualKeyCode::VolumeDown), + winapi::VK_VOLUME_UP => Some(VirtualKeyCode::VolumeUp), + winapi::VK_MEDIA_NEXT_TRACK => Some(VirtualKeyCode::NextTrack), + winapi::VK_MEDIA_PREV_TRACK => Some(VirtualKeyCode::PrevTrack), + winapi::VK_MEDIA_STOP => Some(VirtualKeyCode::MediaStop), + winapi::VK_MEDIA_PLAY_PAUSE => Some(VirtualKeyCode::PlayPause), + winapi::VK_LAUNCH_MAIL => Some(VirtualKeyCode::Mail), + winapi::VK_LAUNCH_MEDIA_SELECT => Some(VirtualKeyCode::MediaSelect), + /*winapi::VK_LAUNCH_APP1 => Some(VirtualKeyCode::Launch_app1), + winapi::VK_LAUNCH_APP2 => Some(VirtualKeyCode::Launch_app2),*/ + winapi::VK_OEM_PLUS => Some(VirtualKeyCode::Equals), winapi::VK_OEM_COMMA => Some(VirtualKeyCode::Comma), winapi::VK_OEM_MINUS => Some(VirtualKeyCode::Minus), winapi::VK_OEM_PERIOD => Some(VirtualKeyCode::Period), - /*winapi::VK_OEM_2 => Some(VirtualKeyCode::Oem_2), - winapi::VK_OEM_3 => Some(VirtualKeyCode::Oem_3), - winapi::VK_OEM_4 => Some(VirtualKeyCode::Oem_4), - winapi::VK_OEM_5 => Some(VirtualKeyCode::Oem_5), - winapi::VK_OEM_6 => Some(VirtualKeyCode::Oem_6), - winapi::VK_OEM_7 => Some(VirtualKeyCode::Oem_7), - winapi::VK_OEM_8 => Some(VirtualKeyCode::Oem_8), - winapi::VK_OEM_102 => Some(VirtualKeyCode::Oem_102), - winapi::VK_PROCESSKEY => Some(VirtualKeyCode::Processkey), + /*winapi::VK_OEM_1 => Some(VirtualKeyCode::Oem_1), + winapi::VK_OEM_2 => Some(VirtualKeyCode::Oem_2), + winapi::VK_OEM_3 => Some(VirtualKeyCode::Oem_3), + winapi::VK_OEM_4 => Some(VirtualKeyCode::Oem_4), + winapi::VK_OEM_5 => Some(VirtualKeyCode::Oem_5), + winapi::VK_OEM_6 => Some(VirtualKeyCode::Oem_6), + winapi::VK_OEM_7 => Some(VirtualKeyCode::Oem_7), + winapi::VK_OEM_8 => Some(VirtualKeyCode::Oem_8), */ + winapi::VK_OEM_102 => Some(VirtualKeyCode::OEM102), + /*winapi::VK_PROCESSKEY => Some(VirtualKeyCode::Processkey), winapi::VK_PACKET => Some(VirtualKeyCode::Packet), winapi::VK_ATTN => Some(VirtualKeyCode::Attn), winapi::VK_CRSEL => Some(VirtualKeyCode::Crsel),