From 256645cc3cb237adb0f542181786051533e936f1 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 5 Feb 2015 05:51:14 +0530 Subject: Add some more support for X11 keys (partially fixes #251) --- src/x11/window/events.rs | 98 ++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'src/x11') diff --git a/src/x11/window/events.rs b/src/x11/window/events.rs index 3f70766..cd91dbd 100644 --- a/src/x11/window/events.rs +++ b/src/x11/window/events.rs @@ -13,7 +13,7 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { //ffi::XK_Scroll_Lock => events::VirtualKeyCode::Scroll_lock, //ffi::XK_Sys_Req => events::VirtualKeyCode::Sys_req, ffi::XK_Escape => events::VirtualKeyCode::Escape, - //ffi::XK_Delete => events::VirtualKeyCode::Delete, + ffi::XK_Delete => events::VirtualKeyCode::Delete, //ffi::XK_Multi_key => events::VirtualKeyCode::Multi_key, //ffi::XK_Kanji => events::VirtualKeyCode::Kanji, //ffi::XK_Muhenkan => events::VirtualKeyCode::Muhenkan, @@ -32,7 +32,7 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { //ffi::XK_Kana_Shift => events::VirtualKeyCode::Kana_shift, //ffi::XK_Eisu_Shift => events::VirtualKeyCode::Eisu_shift, //ffi::XK_Eisu_toggle => events::VirtualKeyCode::Eisu_toggle, - //ffi::XK_Home => events::VirtualKeyCode::Home, + ffi::XK_Home => events::VirtualKeyCode::Home, ffi::XK_Left => events::VirtualKeyCode::Left, ffi::XK_Up => events::VirtualKeyCode::Up, ffi::XK_Right => events::VirtualKeyCode::Right, @@ -41,7 +41,7 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { ffi::XK_Page_Up => events::VirtualKeyCode::PageUp, //ffi::XK_Next => events::VirtualKeyCode::Next, ffi::XK_Page_Down => events::VirtualKeyCode::PageDown, - //ffi::XK_End => events::VirtualKeyCode::End, + ffi::XK_End => events::VirtualKeyCode::End, //ffi::XK_Begin => events::VirtualKeyCode::Begin, //ffi::XK_Win_L => events::VirtualKeyCode::Win_l, //ffi::XK_Win_R => events::VirtualKeyCode::Win_r, @@ -68,35 +68,35 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { //ffi::XK_KP_F3 => events::VirtualKeyCode::Kp_f3, //ffi::XK_KP_F4 => events::VirtualKeyCode::Kp_f4, //ffi::XK_KP_Home => events::VirtualKeyCode::Kp_home, - //ffi::XK_KP_Left => events::VirtualKeyCode::Kp_left, - //ffi::XK_KP_Up => events::VirtualKeyCode::Kp_up, - //ffi::XK_KP_Right => events::VirtualKeyCode::Kp_right, - //ffi::XK_KP_Down => events::VirtualKeyCode::Kp_down, + //ffi::XK_KP_Left => events::VirtualKeyCode::NumpadLeft, + //ffi::XK_KP_Up => events::VirtualKeyCode::NumpadUp, + //ffi::XK_KP_Right => events::VirtualKeyCode::NumpadRight, + //ffi::XK_KP_Down => events::VirtualKeyCode::NumpadDown, //ffi::XK_KP_Prior => events::VirtualKeyCode::Kp_prior, - //ffi::XK_KP_Page_Up => events::VirtualKeyCode::Kp_page_up, + //ffi::XK_KP_Page_Up => events::VirtualKeyCode::NumpadPageUp, //ffi::XK_KP_Next => events::VirtualKeyCode::Kp_next, - //ffi::XK_KP_Page_Down => events::VirtualKeyCode::Kp_page_down, - //ffi::XK_KP_End => events::VirtualKeyCode::Kp_end, + //ffi::XK_KP_Page_Down => events::VirtualKeyCode::NumpadPageDown, + //ffi::XK_KP_End => events::VirtualKeyCode::NumpadEnd, //ffi::XK_KP_Begin => events::VirtualKeyCode::Kp_begin, - //ffi::XK_KP_Insert => events::VirtualKeyCode::Kp_insert, - //ffi::XK_KP_Delete => events::VirtualKeyCode::Kp_delete, - //ffi::XK_KP_Equal => events::VirtualKeyCode::Kp_equal, - //ffi::XK_KP_Multiply => events::VirtualKeyCode::Kp_multiply, - //ffi::XK_KP_Add => events::VirtualKeyCode::Kp_add, + //ffi::XK_KP_Insert => events::VirtualKeyCode::NumpadInsert, + //ffi::XK_KP_Delete => events::VirtualKeyCode::NumpadDelete, + ffi::XK_KP_Equal => events::VirtualKeyCode::NumpadEquals, + //ffi::XK_KP_Multiply => events::VirtualKeyCode::NumpadMultiply, + //ffi::XK_KP_Add => events::VirtualKeyCode::NumpadAdd, //ffi::XK_KP_Separator => events::VirtualKeyCode::Kp_separator, - //ffi::XK_KP_Subtract => events::VirtualKeyCode::Kp_subtract, + //ffi::XK_KP_Subtract => events::VirtualKeyCode::NumpadSubtract, //ffi::XK_KP_Decimal => events::VirtualKeyCode::Kp_decimal, - //ffi::XK_KP_Divide => events::VirtualKeyCode::Kp_divide, - //ffi::XK_KP_0 => events::VirtualKeyCode::Kp_0, - //ffi::XK_KP_1 => events::VirtualKeyCode::Kp_1, - //ffi::XK_KP_2 => events::VirtualKeyCode::Kp_2, - //ffi::XK_KP_3 => events::VirtualKeyCode::Kp_3, - //ffi::XK_KP_4 => events::VirtualKeyCode::Kp_4, - //ffi::XK_KP_5 => events::VirtualKeyCode::Kp_5, - //ffi::XK_KP_6 => events::VirtualKeyCode::Kp_6, - //ffi::XK_KP_7 => events::VirtualKeyCode::Kp_7, - //ffi::XK_KP_8 => events::VirtualKeyCode::Kp_8, - //ffi::XK_KP_9 => events::VirtualKeyCode::Kp_9, + //ffi::XK_KP_Divide => events::VirtualKeyCode::NumpadDivide, + ffi::XK_KP_0 => events::VirtualKeyCode::Numpad0, + ffi::XK_KP_1 => events::VirtualKeyCode::Numpad1, + ffi::XK_KP_2 => events::VirtualKeyCode::Numpad2, + ffi::XK_KP_3 => events::VirtualKeyCode::Numpad3, + ffi::XK_KP_4 => events::VirtualKeyCode::Numpad4, + ffi::XK_KP_5 => events::VirtualKeyCode::Numpad5, + ffi::XK_KP_6 => events::VirtualKeyCode::Numpad6, + ffi::XK_KP_7 => events::VirtualKeyCode::Numpad7, + ffi::XK_KP_8 => events::VirtualKeyCode::Numpad8, + ffi::XK_KP_9 => events::VirtualKeyCode::Numpad9, ffi::XK_F1 => events::VirtualKeyCode::F1, ffi::XK_F2 => events::VirtualKeyCode::F2, ffi::XK_F3 => events::VirtualKeyCode::F3, @@ -178,33 +178,33 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { //ffi::XK_dollar => events::VirtualKeyCode::Dollar, //ffi::XK_percent => events::VirtualKeyCode::Percent, //ffi::XK_ampersand => events::VirtualKeyCode::Ampersand, - //ffi::XK_apostrophe => events::VirtualKeyCode::Apostrophe, + ffi::XK_apostrophe => events::VirtualKeyCode::Apostrophe, //ffi::XK_quoteright => events::VirtualKeyCode::Quoteright, //ffi::XK_parenleft => events::VirtualKeyCode::Parenleft, //ffi::XK_parenright => events::VirtualKeyCode::Parenright, //ffi::XK_asterisk => events::VirtualKeyCode::Asterisk, - //ffi::XK_plus => events::VirtualKeyCode::Plus, - //ffi::XK_comma => events::VirtualKeyCode::Comma, - ffi::XK_minus => events::VirtualKeyCode::Minus, - //ffi::XK_period => events::VirtualKeyCode::Period, - //ffi::XK_slash => events::VirtualKeyCode::Slash, - //ffi::XK_0 => events::VirtualKeyCode::0, - //ffi::XK_1 => events::VirtualKeyCode::1, - //ffi::XK_2 => events::VirtualKeyCode::2, - //ffi::XK_3 => events::VirtualKeyCode::3, - //ffi::XK_4 => events::VirtualKeyCode::4, - //ffi::XK_5 => events::VirtualKeyCode::5, - //ffi::XK_6 => events::VirtualKeyCode::6, - //ffi::XK_7 => events::VirtualKeyCode::7, - //ffi::XK_8 => events::VirtualKeyCode::8, - //ffi::XK_9 => events::VirtualKeyCode::9, - //ffi::XK_colon => events::VirtualKeyCode::Colon, - //ffi::XK_semicolon => events::VirtualKeyCode::Semicolon, + ffi::XK_plus => events::VirtualKeyCode::Add, + ffi::XK_comma => events::VirtualKeyCode::Comma, + ffi::XK_minus => events::VirtualKeyCode::Subtract, + ffi::XK_period => events::VirtualKeyCode::Period, + ffi::XK_slash => events::VirtualKeyCode::Slash, + ffi::XK_0 => events::VirtualKeyCode::Key0, + ffi::XK_1 => events::VirtualKeyCode::Key1, + ffi::XK_2 => events::VirtualKeyCode::Key2, + ffi::XK_3 => events::VirtualKeyCode::Key3, + ffi::XK_4 => events::VirtualKeyCode::Key4, + ffi::XK_5 => events::VirtualKeyCode::Key5, + ffi::XK_6 => events::VirtualKeyCode::Key6, + ffi::XK_7 => events::VirtualKeyCode::Key7, + ffi::XK_8 => events::VirtualKeyCode::Key8, + ffi::XK_9 => events::VirtualKeyCode::Key9, + ffi::XK_colon => events::VirtualKeyCode::Colon, + ffi::XK_semicolon => events::VirtualKeyCode::Semicolon, //ffi::XK_less => events::VirtualKeyCode::Less, ffi::XK_equal => events::VirtualKeyCode::Equals, //ffi::XK_greater => events::VirtualKeyCode::Greater, //ffi::XK_question => events::VirtualKeyCode::Question, - //ffi::XK_at => events::VirtualKeyCode::At, + ffi::XK_at => events::VirtualKeyCode::At, ffi::XK_A => events::VirtualKeyCode::A, ffi::XK_B => events::VirtualKeyCode::B, ffi::XK_C => events::VirtualKeyCode::C, @@ -231,9 +231,9 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { ffi::XK_X => events::VirtualKeyCode::X, ffi::XK_Y => events::VirtualKeyCode::Y, ffi::XK_Z => events::VirtualKeyCode::Z, - //ffi::XK_bracketleft => events::VirtualKeyCode::Bracketleft, - //ffi::XK_backslash => events::VirtualKeyCode::Backslash, - //ffi::XK_bracketright => events::VirtualKeyCode::Bracketright, + ffi::XK_bracketleft => events::VirtualKeyCode::LBracket, + ffi::XK_backslash => events::VirtualKeyCode::Backslash, + ffi::XK_bracketright => events::VirtualKeyCode::LBracket, //ffi::XK_asciicircum => events::VirtualKeyCode::Asciicircum, //ffi::XK_underscore => events::VirtualKeyCode::Underscore, //ffi::XK_grave => events::VirtualKeyCode::Grave, -- cgit v1.2.3