diff options
Diffstat (limited to 'src/win32/event.rs')
-rw-r--r-- | src/win32/event.rs | 278 |
1 files changed, 139 insertions, 139 deletions
diff --git a/src/win32/event.rs b/src/win32/event.rs index a77f40c..16080eb 100644 --- a/src/win32/event.rs +++ b/src/win32/event.rs @@ -1,51 +1,51 @@ use events; -use super::ffi; +use winapi; -pub fn vkeycode_to_element(code: ffi::WPARAM) -> Option<events::VirtualKeyCode> { +pub fn vkeycode_to_element(code: winapi::WPARAM) -> Option<events::VirtualKeyCode> { Some(match code { - //ffi::VK_LBUTTON => events::VirtualKeyCode::Lbutton, - //ffi::VK_RBUTTON => events::VirtualKeyCode::Rbutton, - //ffi::VK_CANCEL => events::VirtualKeyCode::Cancel, - //ffi::VK_MBUTTON => events::VirtualKeyCode::Mbutton, - //ffi::VK_XBUTTON1 => events::VirtualKeyCode::Xbutton1, - //ffi::VK_XBUTTON2 => events::VirtualKeyCode::Xbutton2, - ffi::VK_BACK => events::VirtualKeyCode::Back, - ffi::VK_TAB => events::VirtualKeyCode::Tab, - //ffi::VK_CLEAR => events::VirtualKeyCode::Clear, - ffi::VK_RETURN => events::VirtualKeyCode::Return, - //ffi::VK_SHIFT => events::VirtualKeyCode::Shift, - //ffi::VK_CONTROL => events::VirtualKeyCode::Control, - //ffi::VK_MENU => events::VirtualKeyCode::Menu, - ffi::VK_PAUSE => events::VirtualKeyCode::Pause, - ffi::VK_CAPITAL => events::VirtualKeyCode::Capital, - ffi::VK_KANA => events::VirtualKeyCode::Kana, - //ffi::VK_HANGUEL => events::VirtualKeyCode::Hanguel, - //ffi::VK_HANGUL => events::VirtualKeyCode::Hangul, - //ffi::VK_JUNJA => events::VirtualKeyCode::Junja, - //ffi::VK_FINAL => events::VirtualKeyCode::Final, - //ffi::VK_HANJA => events::VirtualKeyCode::Hanja, - ffi::VK_KANJI => events::VirtualKeyCode::Kanji, - ffi::VK_ESCAPE => events::VirtualKeyCode::Escape, - ffi::VK_CONVERT => events::VirtualKeyCode::Convert, - //ffi::VK_NONCONVERT => events::VirtualKeyCode::Nonconvert, - //ffi::VK_ACCEPT => events::VirtualKeyCode::Accept, - //ffi::VK_MODECHANGE => events::VirtualKeyCode::Modechange, - ffi::VK_SPACE => events::VirtualKeyCode::Space, - ffi::VK_PRIOR => events::VirtualKeyCode::PageUp, - ffi::VK_NEXT => events::VirtualKeyCode::PageDown, - ffi::VK_END => events::VirtualKeyCode::End, - ffi::VK_HOME => events::VirtualKeyCode::Home, - ffi::VK_LEFT => events::VirtualKeyCode::Left, - ffi::VK_UP => events::VirtualKeyCode::Up, - ffi::VK_RIGHT => events::VirtualKeyCode::Right, - ffi::VK_DOWN => events::VirtualKeyCode::Down, - //ffi::VK_SELECT => events::VirtualKeyCode::Select, - //ffi::VK_PRINT => events::VirtualKeyCode::Print, - //ffi::VK_EXECUTE => events::VirtualKeyCode::Execute, - ffi::VK_SNAPSHOT => events::VirtualKeyCode::Snapshot, - ffi::VK_INSERT => events::VirtualKeyCode::Insert, - ffi::VK_DELETE => events::VirtualKeyCode::Delete, - //ffi::VK_HELP => events::VirtualKeyCode::Help, + //winapi::VK_LBUTTON => events::VirtualKeyCode::Lbutton, + //winapi::VK_RBUTTON => events::VirtualKeyCode::Rbutton, + //winapi::VK_CANCEL => events::VirtualKeyCode::Cancel, + //winapi::VK_MBUTTON => events::VirtualKeyCode::Mbutton, + //winapi::VK_XBUTTON1 => events::VirtualKeyCode::Xbutton1, + //winapi::VK_XBUTTON2 => events::VirtualKeyCode::Xbutton2, + winapi::VK_BACK => events::VirtualKeyCode::Back, + winapi::VK_TAB => events::VirtualKeyCode::Tab, + //winapi::VK_CLEAR => events::VirtualKeyCode::Clear, + winapi::VK_RETURN => events::VirtualKeyCode::Return, + //winapi::VK_SHIFT => events::VirtualKeyCode::Shift, + //winapi::VK_CONTROL => events::VirtualKeyCode::Control, + //winapi::VK_MENU => events::VirtualKeyCode::Menu, + winapi::VK_PAUSE => events::VirtualKeyCode::Pause, + winapi::VK_CAPITAL => events::VirtualKeyCode::Capital, + winapi::VK_KANA => events::VirtualKeyCode::Kana, + //winapi::VK_HANGUEL => events::VirtualKeyCode::Hanguel, + //winapi::VK_HANGUL => events::VirtualKeyCode::Hangul, + //winapi::VK_JUNJA => events::VirtualKeyCode::Junja, + //winapi::VK_FINAL => events::VirtualKeyCode::Final, + //winapi::VK_HANJA => events::VirtualKeyCode::Hanja, + winapi::VK_KANJI => events::VirtualKeyCode::Kanji, + winapi::VK_ESCAPE => events::VirtualKeyCode::Escape, + winapi::VK_CONVERT => events::VirtualKeyCode::Convert, + //winapi::VK_NONCONVERT => events::VirtualKeyCode::Nonconvert, + //winapi::VK_ACCEPT => events::VirtualKeyCode::Accept, + //winapi::VK_MODECHANGE => events::VirtualKeyCode::Modechange, + winapi::VK_SPACE => events::VirtualKeyCode::Space, + winapi::VK_PRIOR => events::VirtualKeyCode::PageUp, + winapi::VK_NEXT => events::VirtualKeyCode::PageDown, + winapi::VK_END => events::VirtualKeyCode::End, + winapi::VK_HOME => events::VirtualKeyCode::Home, + winapi::VK_LEFT => events::VirtualKeyCode::Left, + winapi::VK_UP => events::VirtualKeyCode::Up, + winapi::VK_RIGHT => events::VirtualKeyCode::Right, + winapi::VK_DOWN => events::VirtualKeyCode::Down, + //winapi::VK_SELECT => events::VirtualKeyCode::Select, + //winapi::VK_PRINT => events::VirtualKeyCode::Print, + //winapi::VK_EXECUTE => events::VirtualKeyCode::Execute, + winapi::VK_SNAPSHOT => events::VirtualKeyCode::Snapshot, + winapi::VK_INSERT => events::VirtualKeyCode::Insert, + winapi::VK_DELETE => events::VirtualKeyCode::Delete, + //winapi::VK_HELP => events::VirtualKeyCode::Help, 0x30 => events::VirtualKeyCode::Key0, 0x31 => events::VirtualKeyCode::Key1, 0x32 => events::VirtualKeyCode::Key2, @@ -82,100 +82,100 @@ pub fn vkeycode_to_element(code: ffi::WPARAM) -> Option<events::VirtualKeyCode> 0x58 => events::VirtualKeyCode::X, 0x59 => events::VirtualKeyCode::Y, 0x5A => events::VirtualKeyCode::Z, - //ffi::VK_LWIN => events::VirtualKeyCode::Lwin, - //ffi::VK_RWIN => events::VirtualKeyCode::Rwin, - ffi::VK_APPS => events::VirtualKeyCode::Apps, - ffi::VK_SLEEP => events::VirtualKeyCode::Sleep, - ffi::VK_NUMPAD0 => events::VirtualKeyCode::Numpad0, - ffi::VK_NUMPAD1 => events::VirtualKeyCode::Numpad1, - ffi::VK_NUMPAD2 => events::VirtualKeyCode::Numpad2, - ffi::VK_NUMPAD3 => events::VirtualKeyCode::Numpad3, - ffi::VK_NUMPAD4 => events::VirtualKeyCode::Numpad4, - ffi::VK_NUMPAD5 => events::VirtualKeyCode::Numpad5, - ffi::VK_NUMPAD6 => events::VirtualKeyCode::Numpad6, - ffi::VK_NUMPAD7 => events::VirtualKeyCode::Numpad7, - ffi::VK_NUMPAD8 => events::VirtualKeyCode::Numpad8, - ffi::VK_NUMPAD9 => events::VirtualKeyCode::Numpad9, - ffi::VK_MULTIPLY => events::VirtualKeyCode::Multiply, - ffi::VK_ADD => events::VirtualKeyCode::Add, - //ffi::VK_SEPARATOR => events::VirtualKeyCode::Separator, - ffi::VK_SUBTRACT => events::VirtualKeyCode::Subtract, - ffi::VK_DECIMAL => events::VirtualKeyCode::Decimal, - ffi::VK_DIVIDE => events::VirtualKeyCode::Divide, - ffi::VK_F1 => events::VirtualKeyCode::F1, - ffi::VK_F2 => events::VirtualKeyCode::F2, - ffi::VK_F3 => events::VirtualKeyCode::F3, - ffi::VK_F4 => events::VirtualKeyCode::F4, - ffi::VK_F5 => events::VirtualKeyCode::F5, - ffi::VK_F6 => events::VirtualKeyCode::F6, - ffi::VK_F7 => events::VirtualKeyCode::F7, - ffi::VK_F8 => events::VirtualKeyCode::F8, - ffi::VK_F9 => events::VirtualKeyCode::F9, - ffi::VK_F10 => events::VirtualKeyCode::F10, - ffi::VK_F11 => events::VirtualKeyCode::F11, - ffi::VK_F12 => events::VirtualKeyCode::F12, - ffi::VK_F13 => events::VirtualKeyCode::F13, - ffi::VK_F14 => events::VirtualKeyCode::F14, - ffi::VK_F15 => events::VirtualKeyCode::F15, - /*ffi::VK_F16 => events::VirtualKeyCode::F16, - ffi::VK_F17 => events::VirtualKeyCode::F17, - ffi::VK_F18 => events::VirtualKeyCode::F18, - ffi::VK_F19 => events::VirtualKeyCode::F19, - ffi::VK_F20 => events::VirtualKeyCode::F20, - ffi::VK_F21 => events::VirtualKeyCode::F21, - ffi::VK_F22 => events::VirtualKeyCode::F22, - ffi::VK_F23 => events::VirtualKeyCode::F23, - ffi::VK_F24 => events::VirtualKeyCode::F24,*/ - ffi::VK_NUMLOCK => events::VirtualKeyCode::Numlock, - ffi::VK_SCROLL => events::VirtualKeyCode::Scroll, - /*ffi::VK_LSHIFT => events::VirtualKeyCode::Lshift, - ffi::VK_RSHIFT => events::VirtualKeyCode::Rshift, - ffi::VK_LCONTROL => events::VirtualKeyCode::Lcontrol, - ffi::VK_RCONTROL => events::VirtualKeyCode::Rcontrol, - ffi::VK_LMENU => events::VirtualKeyCode::Lmenu, - ffi::VK_RMENU => events::VirtualKeyCode::Rmenu, - ffi::VK_BROWSER_BACK => events::VirtualKeyCode::Browser_back, - ffi::VK_BROWSER_FORWARD => events::VirtualKeyCode::Browser_forward, - ffi::VK_BROWSER_REFRESH => events::VirtualKeyCode::Browser_refresh, - ffi::VK_BROWSER_STOP => events::VirtualKeyCode::Browser_stop, - ffi::VK_BROWSER_SEARCH => events::VirtualKeyCode::Browser_search, - ffi::VK_BROWSER_FAVORITES => events::VirtualKeyCode::Browser_favorites, - ffi::VK_BROWSER_HOME => events::VirtualKeyCode::Browser_home, - ffi::VK_VOLUME_MUTE => events::VirtualKeyCode::Volume_mute, - ffi::VK_VOLUME_DOWN => events::VirtualKeyCode::Volume_down, - ffi::VK_VOLUME_UP => events::VirtualKeyCode::Volume_up, - ffi::VK_MEDIA_NEXT_TRACK => events::VirtualKeyCode::Media_next_track, - ffi::VK_MEDIA_PREV_TRACK => events::VirtualKeyCode::Media_prev_track, - ffi::VK_MEDIA_STOP => events::VirtualKeyCode::Media_stop, - ffi::VK_MEDIA_PLAY_PAUSE => events::VirtualKeyCode::Media_play_pause, - ffi::VK_LAUNCH_MAIL => events::VirtualKeyCode::Launch_mail, - ffi::VK_LAUNCH_MEDIA_SELECT => events::VirtualKeyCode::Launch_media_select, - ffi::VK_LAUNCH_APP1 => events::VirtualKeyCode::Launch_app1, - ffi::VK_LAUNCH_APP2 => events::VirtualKeyCode::Launch_app2, - ffi::VK_OEM_1 => events::VirtualKeyCode::Oem_1, - ffi::VK_OEM_PLUS => events::VirtualKeyCode::Oem_plus, - ffi::VK_OEM_COMMA => events::VirtualKeyCode::Oem_comma, - ffi::VK_OEM_MINUS => events::VirtualKeyCode::Oem_minus, - ffi::VK_OEM_PERIOD => events::VirtualKeyCode::Oem_period, - ffi::VK_OEM_2 => events::VirtualKeyCode::Oem_2, - ffi::VK_OEM_3 => events::VirtualKeyCode::Oem_3, - ffi::VK_OEM_4 => events::VirtualKeyCode::Oem_4, - ffi::VK_OEM_5 => events::VirtualKeyCode::Oem_5, - ffi::VK_OEM_6 => events::VirtualKeyCode::Oem_6, - ffi::VK_OEM_7 => events::VirtualKeyCode::Oem_7, - ffi::VK_OEM_8 => events::VirtualKeyCode::Oem_8, - ffi::VK_OEM_102 => events::VirtualKeyCode::Oem_102, - ffi::VK_PROCESSKEY => events::VirtualKeyCode::Processkey, - ffi::VK_PACKET => events::VirtualKeyCode::Packet, - ffi::VK_ATTN => events::VirtualKeyCode::Attn, - ffi::VK_CRSEL => events::VirtualKeyCode::Crsel, - ffi::VK_EXSEL => events::VirtualKeyCode::Exsel, - ffi::VK_EREOF => events::VirtualKeyCode::Ereof, - ffi::VK_PLAY => events::VirtualKeyCode::Play, - ffi::VK_ZOOM => events::VirtualKeyCode::Zoom, - ffi::VK_NONAME => events::VirtualKeyCode::Noname, - ffi::VK_PA1 => events::VirtualKeyCode::Pa1, - ffi::VK_OEM_CLEAR => events::VirtualKeyCode::Oem_clear,*/ + //winapi::VK_LWIN => events::VirtualKeyCode::Lwin, + //winapi::VK_RWIN => events::VirtualKeyCode::Rwin, + winapi::VK_APPS => events::VirtualKeyCode::Apps, + winapi::VK_SLEEP => events::VirtualKeyCode::Sleep, + winapi::VK_NUMPAD0 => events::VirtualKeyCode::Numpad0, + winapi::VK_NUMPAD1 => events::VirtualKeyCode::Numpad1, + winapi::VK_NUMPAD2 => events::VirtualKeyCode::Numpad2, + winapi::VK_NUMPAD3 => events::VirtualKeyCode::Numpad3, + winapi::VK_NUMPAD4 => events::VirtualKeyCode::Numpad4, + winapi::VK_NUMPAD5 => events::VirtualKeyCode::Numpad5, + winapi::VK_NUMPAD6 => events::VirtualKeyCode::Numpad6, + winapi::VK_NUMPAD7 => events::VirtualKeyCode::Numpad7, + winapi::VK_NUMPAD8 => events::VirtualKeyCode::Numpad8, + winapi::VK_NUMPAD9 => events::VirtualKeyCode::Numpad9, + winapi::VK_MULTIPLY => events::VirtualKeyCode::Multiply, + winapi::VK_ADD => events::VirtualKeyCode::Add, + //winapi::VK_SEPARATOR => events::VirtualKeyCode::Separator, + winapi::VK_SUBTRACT => events::VirtualKeyCode::Subtract, + winapi::VK_DECIMAL => events::VirtualKeyCode::Decimal, + winapi::VK_DIVIDE => events::VirtualKeyCode::Divide, + winapi::VK_F1 => events::VirtualKeyCode::F1, + winapi::VK_F2 => events::VirtualKeyCode::F2, + winapi::VK_F3 => events::VirtualKeyCode::F3, + winapi::VK_F4 => events::VirtualKeyCode::F4, + winapi::VK_F5 => events::VirtualKeyCode::F5, + winapi::VK_F6 => events::VirtualKeyCode::F6, + winapi::VK_F7 => events::VirtualKeyCode::F7, + winapi::VK_F8 => events::VirtualKeyCode::F8, + winapi::VK_F9 => events::VirtualKeyCode::F9, + winapi::VK_F10 => events::VirtualKeyCode::F10, + winapi::VK_F11 => events::VirtualKeyCode::F11, + winapi::VK_F12 => events::VirtualKeyCode::F12, + winapi::VK_F13 => events::VirtualKeyCode::F13, + winapi::VK_F14 => events::VirtualKeyCode::F14, + winapi::VK_F15 => events::VirtualKeyCode::F15, + /*winapi::VK_F16 => events::VirtualKeyCode::F16, + winapi::VK_F17 => events::VirtualKeyCode::F17, + winapi::VK_F18 => events::VirtualKeyCode::F18, + winapi::VK_F19 => events::VirtualKeyCode::F19, + winapi::VK_F20 => events::VirtualKeyCode::F20, + winapi::VK_F21 => events::VirtualKeyCode::F21, + winapi::VK_F22 => events::VirtualKeyCode::F22, + winapi::VK_F23 => events::VirtualKeyCode::F23, + winapi::VK_F24 => events::VirtualKeyCode::F24,*/ + winapi::VK_NUMLOCK => events::VirtualKeyCode::Numlock, + winapi::VK_SCROLL => events::VirtualKeyCode::Scroll, + /*winapi::VK_LSHIFT => events::VirtualKeyCode::Lshift, + winapi::VK_RSHIFT => events::VirtualKeyCode::Rshift, + winapi::VK_LCONTROL => events::VirtualKeyCode::Lcontrol, + winapi::VK_RCONTROL => events::VirtualKeyCode::Rcontrol, + winapi::VK_LMENU => events::VirtualKeyCode::Lmenu, + winapi::VK_RMENU => events::VirtualKeyCode::Rmenu, + winapi::VK_BROWSER_BACK => events::VirtualKeyCode::Browser_back, + winapi::VK_BROWSER_FORWARD => events::VirtualKeyCode::Browser_forward, + winapi::VK_BROWSER_REFRESH => events::VirtualKeyCode::Browser_refresh, + winapi::VK_BROWSER_STOP => events::VirtualKeyCode::Browser_stop, + winapi::VK_BROWSER_SEARCH => events::VirtualKeyCode::Browser_search, + winapi::VK_BROWSER_FAVORITES => events::VirtualKeyCode::Browser_favorites, + winapi::VK_BROWSER_HOME => events::VirtualKeyCode::Browser_home, + winapi::VK_VOLUME_MUTE => events::VirtualKeyCode::Volume_mute, + winapi::VK_VOLUME_DOWN => events::VirtualKeyCode::Volume_down, + winapi::VK_VOLUME_UP => events::VirtualKeyCode::Volume_up, + winapi::VK_MEDIA_NEXT_TRACK => events::VirtualKeyCode::Media_next_track, + winapi::VK_MEDIA_PREV_TRACK => events::VirtualKeyCode::Media_prev_track, + winapi::VK_MEDIA_STOP => events::VirtualKeyCode::Media_stop, + winapi::VK_MEDIA_PLAY_PAUSE => events::VirtualKeyCode::Media_play_pause, + winapi::VK_LAUNCH_MAIL => events::VirtualKeyCode::Launch_mail, + winapi::VK_LAUNCH_MEDIA_SELECT => events::VirtualKeyCode::Launch_media_select, + winapi::VK_LAUNCH_APP1 => events::VirtualKeyCode::Launch_app1, + winapi::VK_LAUNCH_APP2 => events::VirtualKeyCode::Launch_app2, + winapi::VK_OEM_1 => events::VirtualKeyCode::Oem_1, + winapi::VK_OEM_PLUS => events::VirtualKeyCode::Oem_plus, + winapi::VK_OEM_COMMA => events::VirtualKeyCode::Oem_comma, + winapi::VK_OEM_MINUS => events::VirtualKeyCode::Oem_minus, + winapi::VK_OEM_PERIOD => events::VirtualKeyCode::Oem_period, + winapi::VK_OEM_2 => events::VirtualKeyCode::Oem_2, + winapi::VK_OEM_3 => events::VirtualKeyCode::Oem_3, + winapi::VK_OEM_4 => events::VirtualKeyCode::Oem_4, + winapi::VK_OEM_5 => events::VirtualKeyCode::Oem_5, + winapi::VK_OEM_6 => events::VirtualKeyCode::Oem_6, + winapi::VK_OEM_7 => events::VirtualKeyCode::Oem_7, + winapi::VK_OEM_8 => events::VirtualKeyCode::Oem_8, + winapi::VK_OEM_102 => events::VirtualKeyCode::Oem_102, + winapi::VK_PROCESSKEY => events::VirtualKeyCode::Processkey, + winapi::VK_PACKET => events::VirtualKeyCode::Packet, + winapi::VK_ATTN => events::VirtualKeyCode::Attn, + winapi::VK_CRSEL => events::VirtualKeyCode::Crsel, + winapi::VK_EXSEL => events::VirtualKeyCode::Exsel, + winapi::VK_EREOF => events::VirtualKeyCode::Ereof, + winapi::VK_PLAY => events::VirtualKeyCode::Play, + winapi::VK_ZOOM => events::VirtualKeyCode::Zoom, + winapi::VK_NONAME => events::VirtualKeyCode::Noname, + winapi::VK_PA1 => events::VirtualKeyCode::Pa1, + winapi::VK_OEM_CLEAR => events::VirtualKeyCode::Oem_clear,*/ _ => return None }) } |