Add support for navigation keys

This commit is contained in:
Manish Goregaokar 2016-02-27 15:29:06 +05:30
parent a3543b700f
commit 1de66e4efb
4 changed files with 18 additions and 13 deletions

View file

@ -81,60 +81,60 @@ osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.i586-unknown-linux-gnu.dependencies] [target.i586-unknown-linux-gnu.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.x86_64-unknown-linux-gnu.dependencies] [target.x86_64-unknown-linux-gnu.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.arm-unknown-linux-gnueabihf.dependencies] [target.arm-unknown-linux-gnueabihf.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.armv7-unknown-linux-gnueabihf.dependencies] [target.armv7-unknown-linux-gnueabihf.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.aarch64-unknown-linux-gnu.dependencies] [target.aarch64-unknown-linux-gnu.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.x86_64-unknown-dragonfly.dependencies] [target.x86_64-unknown-dragonfly.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.x86_64-unknown-freebsd.dependencies] [target.x86_64-unknown-freebsd.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"
[target.x86_64-unknown-openbsd.dependencies] [target.x86_64-unknown-openbsd.dependencies]
osmesa-sys = "0.0.5" osmesa-sys = "0.0.5"
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
wayland-kbd = "0.3.3" wayland-kbd = "0.3.3"
wayland-window = "0.2.2" wayland-window = "0.2.2"
x11-dl = "~2.3" x11-dl = "~2.4"

View file

@ -148,10 +148,10 @@ pub fn vkeycode_to_element(wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> (S
winapi::VK_LCONTROL => Some(VirtualKeyCode::Lcontrol), winapi::VK_LCONTROL => Some(VirtualKeyCode::Lcontrol),
winapi::VK_RCONTROL => Some(VirtualKeyCode::Rcontrol), winapi::VK_RCONTROL => Some(VirtualKeyCode::Rcontrol),
winapi::VK_LMENU => Some(VirtualKeyCode::Lmenu), winapi::VK_LMENU => Some(VirtualKeyCode::Lmenu),
winapi::VK_RMENU => Some(VirtualKeyCode::Rmenu), winapi::VK_RMENU => Some(VirtualKeyCode::Rmenu),*/
winapi::VK_BROWSER_BACK => Some(VirtualKeyCode::Browser_back), winapi::VK_BROWSER_BACK => Some(VirtualKeyCode::NavigateBackward),
winapi::VK_BROWSER_FORWARD => Some(VirtualKeyCode::Browser_forward), winapi::VK_BROWSER_FORWARD => Some(VirtualKeyCode::NavigateForward),
winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::Browser_refresh), /*winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::Browser_refresh),
winapi::VK_BROWSER_STOP => Some(VirtualKeyCode::Browser_stop), winapi::VK_BROWSER_STOP => Some(VirtualKeyCode::Browser_stop),
winapi::VK_BROWSER_SEARCH => Some(VirtualKeyCode::Browser_search), winapi::VK_BROWSER_SEARCH => Some(VirtualKeyCode::Browser_search),
winapi::VK_BROWSER_FAVORITES => Some(VirtualKeyCode::Browser_favorites), winapi::VK_BROWSER_FAVORITES => Some(VirtualKeyCode::Browser_favorites),

View file

@ -3,6 +3,7 @@ use super::ffi;
use VirtualKeyCode; use VirtualKeyCode;
pub fn keycode_to_element(scancode: libc::c_uint) -> Option<VirtualKeyCode> { pub fn keycode_to_element(scancode: libc::c_uint) -> Option<VirtualKeyCode> {
println!("{:?}", scancode);
Some(match scancode { Some(match scancode {
ffi::XK_BackSpace => events::VirtualKeyCode::Back, ffi::XK_BackSpace => events::VirtualKeyCode::Back,
ffi::XK_Tab => events::VirtualKeyCode::Tab, ffi::XK_Tab => events::VirtualKeyCode::Tab,
@ -997,6 +998,8 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option<VirtualKeyCode> {
//ffi::XK_hebrew_taw => events::VirtualKeyCode::Hebrew_taw, //ffi::XK_hebrew_taw => events::VirtualKeyCode::Hebrew_taw,
//ffi::XK_hebrew_taf => events::VirtualKeyCode::Hebrew_taf, //ffi::XK_hebrew_taf => events::VirtualKeyCode::Hebrew_taf,
//ffi::XK_Hebrew_switch => events::VirtualKeyCode::Hebrew_switch, //ffi::XK_Hebrew_switch => events::VirtualKeyCode::Hebrew_switch,
ffi::XF86XK_Back => VirtualKeyCode::NavigateBackward,
ffi::XF86XK_Forward => VirtualKeyCode::NavigateForward,
_ => return None _ => return None
}) })
} }

View file

@ -264,6 +264,8 @@ pub enum VirtualKeyCode {
Multiply, Multiply,
Mute, Mute,
MyComputer, MyComputer,
NavigateForward, // also called "Prior"
NavigateBackward, // also called "Next"
NextTrack, NextTrack,
NoConvert, NoConvert,
NumpadComma, NumpadComma,