From 1de66e4efbd428e5cefa422e6c771e225cab1829 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 27 Feb 2016 15:29:06 +0530 Subject: Add support for navigation keys --- Cargo.toml | 18 +++++++++--------- src/api/win32/event.rs | 8 ++++---- src/api/x11/events.rs | 3 +++ src/events.rs | 2 ++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3a251c2..294d55d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,60 +81,60 @@ osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.i586-unknown-linux-gnu.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.x86_64-unknown-linux-gnu.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.arm-unknown-linux-gnueabihf.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.armv7-unknown-linux-gnueabihf.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.aarch64-unknown-linux-gnu.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.x86_64-unknown-dragonfly.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.x86_64-unknown-freebsd.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" [target.x86_64-unknown-openbsd.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-kbd = "0.3.3" wayland-window = "0.2.2" -x11-dl = "~2.3" +x11-dl = "~2.4" diff --git a/src/api/win32/event.rs b/src/api/win32/event.rs index ad4598a..f60ec7e 100644 --- a/src/api/win32/event.rs +++ b/src/api/win32/event.rs @@ -148,10 +148,10 @@ pub fn vkeycode_to_element(wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> (S 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::Browser_back), - winapi::VK_BROWSER_FORWARD => Some(VirtualKeyCode::Browser_forward), - winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::Browser_refresh), + 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), diff --git a/src/api/x11/events.rs b/src/api/x11/events.rs index 408a3ec..d497319 100644 --- a/src/api/x11/events.rs +++ b/src/api/x11/events.rs @@ -3,6 +3,7 @@ use super::ffi; use VirtualKeyCode; pub fn keycode_to_element(scancode: libc::c_uint) -> Option { + println!("{:?}", scancode); Some(match scancode { ffi::XK_BackSpace => events::VirtualKeyCode::Back, ffi::XK_Tab => events::VirtualKeyCode::Tab, @@ -997,6 +998,8 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option { //ffi::XK_hebrew_taw => events::VirtualKeyCode::Hebrew_taw, //ffi::XK_hebrew_taf => events::VirtualKeyCode::Hebrew_taf, //ffi::XK_Hebrew_switch => events::VirtualKeyCode::Hebrew_switch, + ffi::XF86XK_Back => VirtualKeyCode::NavigateBackward, + ffi::XF86XK_Forward => VirtualKeyCode::NavigateForward, _ => return None }) } diff --git a/src/events.rs b/src/events.rs index 8049c16..9fff1fb 100644 --- a/src/events.rs +++ b/src/events.rs @@ -264,6 +264,8 @@ pub enum VirtualKeyCode { Multiply, Mute, MyComputer, + NavigateForward, // also called "Prior" + NavigateBackward, // also called "Next" NextTrack, NoConvert, NumpadComma, -- cgit v1.2.3