mirror of https://github.com/sgoudham/neovide.git
Keyboard refactor (#418)
* Moved refactoring to the new program structure * Imported enum variants to qwerty layout files * Changed keyboard impl from From to Into * Simplified imports * Implement From rather than Intomacos-click-through
parent
b4401d3b88
commit
c63b054521
@ -1,81 +0,0 @@
|
|||||||
use log::error;
|
|
||||||
|
|
||||||
use crate::settings::*;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub enum KeyboardLayout {
|
|
||||||
Qwerty,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromValue for KeyboardLayout {
|
|
||||||
fn from_value(&mut self, value: Value) {
|
|
||||||
match value.as_str() {
|
|
||||||
Some("qwerty") => *self = KeyboardLayout::Qwerty,
|
|
||||||
_ => error!(
|
|
||||||
"keyboard_layout setting expected a known keyboard layout name, but received: {}",
|
|
||||||
value
|
|
||||||
),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<KeyboardLayout> for Value {
|
|
||||||
fn from(layout: KeyboardLayout) -> Self {
|
|
||||||
match layout {
|
|
||||||
KeyboardLayout::Qwerty => "qwerty".into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct KeyboardSettings {
|
|
||||||
pub layout: KeyboardLayout,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn initialize_settings() {
|
|
||||||
SETTINGS.set(&KeyboardSettings {
|
|
||||||
layout: KeyboardLayout::Qwerty,
|
|
||||||
});
|
|
||||||
|
|
||||||
register_nvim_setting!("keyboard_layout", KeyboardSettings::layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn append_modifiers(
|
|
||||||
keycode_text: &str,
|
|
||||||
special: bool,
|
|
||||||
shift: bool,
|
|
||||||
ctrl: bool,
|
|
||||||
alt: bool,
|
|
||||||
gui: bool,
|
|
||||||
) -> String {
|
|
||||||
let mut result = keycode_text.to_string();
|
|
||||||
let mut special = if result == "<" {
|
|
||||||
result = "lt".to_string();
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
special
|
|
||||||
};
|
|
||||||
|
|
||||||
if shift {
|
|
||||||
special = true;
|
|
||||||
result = format!("S-{}", result);
|
|
||||||
}
|
|
||||||
if ctrl {
|
|
||||||
special = true;
|
|
||||||
result = format!("C-{}", result);
|
|
||||||
}
|
|
||||||
if alt {
|
|
||||||
special = true;
|
|
||||||
result = format!("M-{}", result);
|
|
||||||
}
|
|
||||||
if cfg!(not(target_os = "windows")) && gui {
|
|
||||||
special = true;
|
|
||||||
result = format!("D-{}", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if special {
|
|
||||||
result = format!("<{}>", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
|
@ -0,0 +1,26 @@
|
|||||||
|
use crate::settings::{FromValue, Value};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub enum KeyboardLayout {
|
||||||
|
Qwerty,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromValue for KeyboardLayout {
|
||||||
|
fn from_value(&mut self, value: Value) {
|
||||||
|
match value.as_str() {
|
||||||
|
Some("qwerty") => *self = KeyboardLayout::Qwerty,
|
||||||
|
_ => log::error!(
|
||||||
|
"keyboard_layout setting expected a known keyboard layout name, but received: {}",
|
||||||
|
value
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<KeyboardLayout> for Value {
|
||||||
|
fn from(layout: KeyboardLayout) -> Self {
|
||||||
|
match layout {
|
||||||
|
KeyboardLayout::Qwerty => "qwerty".into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
mod layout;
|
||||||
|
mod modifiers;
|
||||||
|
mod settings;
|
||||||
|
mod token;
|
||||||
|
|
||||||
|
use crate::settings::SETTINGS;
|
||||||
|
|
||||||
|
pub use self::{
|
||||||
|
layout::KeyboardLayout,
|
||||||
|
modifiers::Modifiers,
|
||||||
|
settings::{initialize_settings, KeyboardSettings},
|
||||||
|
token::Token,
|
||||||
|
};
|
||||||
|
|
||||||
|
type KeycodeToTokenFn<T> = fn(T, bool) -> Option<Token<'static>>;
|
||||||
|
|
||||||
|
pub fn neovim_keybinding_string<T, U>(
|
||||||
|
keycode: Option<U>,
|
||||||
|
keytext: Option<String>,
|
||||||
|
modifiers: T,
|
||||||
|
keycode_to_token: KeycodeToTokenFn<U>,
|
||||||
|
) -> Option<String>
|
||||||
|
where
|
||||||
|
T: Into<Modifiers>,
|
||||||
|
{
|
||||||
|
let modifiers: Modifiers = modifiers.into();
|
||||||
|
if let Some(text) = keytext {
|
||||||
|
Some(
|
||||||
|
if text == "<" {
|
||||||
|
Token::new("lt", true, true)
|
||||||
|
} else {
|
||||||
|
Token::new(&text, false, false)
|
||||||
|
}
|
||||||
|
.into_string(modifiers),
|
||||||
|
)
|
||||||
|
} else if let Some(keycode) = keycode {
|
||||||
|
match SETTINGS.get::<KeyboardSettings>().layout {
|
||||||
|
KeyboardLayout::Qwerty => keycode_to_token(keycode, modifiers.shift),
|
||||||
|
}
|
||||||
|
.map(|e| e.into_string(modifiers))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn unsupported_key<T, R>(keycode: T) -> Option<R>
|
||||||
|
where
|
||||||
|
T: std::fmt::Debug,
|
||||||
|
{
|
||||||
|
log::trace!("Unsupported key: {:?}", keycode);
|
||||||
|
None
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/// The keyboard modifiers associated with a keystroke
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub struct Modifiers {
|
||||||
|
/// Shift key
|
||||||
|
pub shift: bool,
|
||||||
|
|
||||||
|
/// Control key
|
||||||
|
pub control: bool,
|
||||||
|
|
||||||
|
/// Alt on Windows, option on Mac
|
||||||
|
pub meta: bool,
|
||||||
|
|
||||||
|
/// Windows key on PC, command key on Mac
|
||||||
|
pub logo: bool,
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
use super::KeyboardLayout;
|
||||||
|
use crate::{
|
||||||
|
register_nvim_setting,
|
||||||
|
settings::{FromValue, Value, SETTINGS},
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct KeyboardSettings {
|
||||||
|
pub layout: KeyboardLayout,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn initialize_settings() {
|
||||||
|
SETTINGS.set(&KeyboardSettings {
|
||||||
|
layout: KeyboardLayout::Qwerty,
|
||||||
|
});
|
||||||
|
register_nvim_setting!("keyboard_layout", KeyboardSettings::layout);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
use super::Modifiers;
|
||||||
|
|
||||||
|
/// Information about how to translate keyboard into Vim input
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct Token<'a> {
|
||||||
|
/// The name of the key in Vimscript.
|
||||||
|
/// See `:help key-notation` for more details.
|
||||||
|
key_name: &'a str,
|
||||||
|
|
||||||
|
/// Whether the token should be enclosed in brackets, such as <Esc> or <BS>
|
||||||
|
special: bool,
|
||||||
|
|
||||||
|
/// Whether the shift key should be considered for inclusion in the token.
|
||||||
|
use_shift: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Token<'a> {
|
||||||
|
pub const fn new(key_name: &'a str, special: bool, use_shift: bool) -> Self {
|
||||||
|
Self {
|
||||||
|
key_name,
|
||||||
|
special,
|
||||||
|
use_shift,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Converts the keypress to a Neovim input
|
||||||
|
pub fn into_string(self, mods: Modifiers) -> String {
|
||||||
|
let shift = self.use_shift && mods.shift;
|
||||||
|
let special = self.special || shift || mods.control || mods.meta || use_logo(mods.logo);
|
||||||
|
let open = if special { "<" } else { "" };
|
||||||
|
let command = if use_logo(mods.logo) { "D-" } else { "" };
|
||||||
|
let shift = if shift { "S-" } else { "" };
|
||||||
|
let control = if mods.control { "C-" } else { "" };
|
||||||
|
let meta = if mods.meta { "M-" } else { "" };
|
||||||
|
let close = if special { ">" } else { "" };
|
||||||
|
format!(
|
||||||
|
"{}{}{}{}{}{}{}",
|
||||||
|
open, command, shift, control, meta, self.key_name, close
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn use_logo(logo: bool) -> bool {
|
||||||
|
return logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Windows key is used for OS-level shortcuts,
|
||||||
|
// so we want to ignore the logo key on this platform.
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn use_logo(_: bool) -> bool {
|
||||||
|
false
|
||||||
|
}
|
@ -1,36 +1,17 @@
|
|||||||
mod qwerty;
|
mod qwerty;
|
||||||
|
|
||||||
use log::trace;
|
use crate::window::keyboard::Modifiers;
|
||||||
use skulpin::sdl2::keyboard::{Keycode, Mod};
|
use skulpin::sdl2::keyboard::Mod;
|
||||||
|
|
||||||
use super::keyboard::*;
|
pub use qwerty::handle_qwerty_layout;
|
||||||
use crate::settings::*;
|
|
||||||
use qwerty::*;
|
|
||||||
|
|
||||||
pub fn unsupported_key<R>(keycode: Keycode) -> Option<R> {
|
impl From<Mod> for Modifiers {
|
||||||
trace!("Unsupported key: {:?}", keycode);
|
fn from(mods: Mod) -> Modifiers {
|
||||||
None
|
Modifiers {
|
||||||
}
|
shift: mods.contains(Mod::LSHIFTMOD) || mods.contains(Mod::RSHIFTMOD),
|
||||||
|
control: mods.contains(Mod::LCTRLMOD) || mods.contains(Mod::RCTRLMOD),
|
||||||
pub fn produce_neovim_keybinding_string(
|
meta: mods.contains(Mod::LALTMOD) || mods.contains(Mod::RALTMOD),
|
||||||
keycode: Option<Keycode>,
|
logo: mods.contains(Mod::LGUIMOD) || mods.contains(Mod::RGUIMOD),
|
||||||
keytext: Option<String>,
|
}
|
||||||
modifiers: Mod,
|
|
||||||
) -> Option<String> {
|
|
||||||
let shift = modifiers.contains(Mod::LSHIFTMOD) || modifiers.contains(Mod::RSHIFTMOD);
|
|
||||||
let ctrl = modifiers.contains(Mod::LCTRLMOD) || modifiers.contains(Mod::RCTRLMOD);
|
|
||||||
let alt = modifiers.contains(Mod::LALTMOD) || modifiers.contains(Mod::RALTMOD);
|
|
||||||
let gui = modifiers.contains(Mod::LGUIMOD) || modifiers.contains(Mod::RGUIMOD);
|
|
||||||
if let Some(text) = keytext {
|
|
||||||
Some(append_modifiers(&text, false, false, ctrl, alt, gui))
|
|
||||||
} else if let Some(keycode) = keycode {
|
|
||||||
(match SETTINGS.get::<KeyboardSettings>().layout {
|
|
||||||
KeyboardLayout::Qwerty => handle_qwerty_layout(keycode, shift, ctrl, alt),
|
|
||||||
})
|
|
||||||
.map(|(transformed_text, special, shift, ctrl, alt)| {
|
|
||||||
append_modifiers(transformed_text, special, shift, ctrl, alt, gui)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,269 +1,184 @@
|
|||||||
use super::unsupported_key;
|
use crate::window::keyboard::{unsupported_key, Token};
|
||||||
|
use skulpin::sdl2::keyboard::Keycode::{self, *};
|
||||||
|
|
||||||
use skulpin::sdl2::keyboard::Keycode;
|
/// Maps winit keyboard events to Vim tokens
|
||||||
|
pub fn handle_qwerty_layout(keycode: Keycode, shift: bool) -> Option<Token<'static>> {
|
||||||
pub fn handle_qwerty_layout(
|
let special = |text| Some(Token::new(text, true, true));
|
||||||
keycode: Keycode,
|
let normal = |text| Some(Token::new(text, false, true));
|
||||||
shift: bool,
|
let partial = |text| Some(Token::new(text, false, false));
|
||||||
ctrl: bool,
|
match (keycode, shift) {
|
||||||
alt: bool,
|
(Backspace, _) => special("BS"),
|
||||||
) -> Option<(&'static str, bool, bool, bool, bool)> {
|
(Tab, _) => special("Tab"),
|
||||||
match (keycode, shift, ctrl, alt) {
|
(Return, _) => special("Enter"),
|
||||||
(Keycode::Backspace, shift, ctrl, alt) => Some(("BS", true, shift, ctrl, alt)),
|
(Escape, _) => special("Esc"),
|
||||||
(Keycode::Tab, shift, ctrl, alt) => Some(("Tab", true, shift, ctrl, alt)),
|
(Space, _) => normal(" "),
|
||||||
(Keycode::Return, shift, ctrl, alt) => Some(("Enter", true, shift, ctrl, alt)),
|
(Exclaim, _) => normal("!"),
|
||||||
(Keycode::Escape, shift, ctrl, alt) => Some(("Esc", true, shift, ctrl, alt)),
|
(Quotedbl, _) => normal("\""),
|
||||||
(Keycode::Space, shift, ctrl, alt) => Some((" ", false, shift, ctrl, alt)),
|
(Hash, _) => normal("#"),
|
||||||
(Keycode::Exclaim, shift, ctrl, alt) => Some(("!", false, shift, ctrl, alt)),
|
(Dollar, _) => normal("$"),
|
||||||
(Keycode::Quotedbl, shift, ctrl, alt) => Some(("\"", false, shift, ctrl, alt)),
|
(Percent, _) => normal("%"),
|
||||||
(Keycode::Hash, shift, ctrl, alt) => Some(("#", false, shift, ctrl, alt)),
|
(Ampersand, _) => normal("&"),
|
||||||
(Keycode::Dollar, shift, ctrl, alt) => Some(("$", false, shift, ctrl, alt)),
|
(Quote, false) => normal("'"),
|
||||||
(Keycode::Percent, shift, ctrl, alt) => Some(("%", false, shift, ctrl, alt)),
|
(Quote, true) => normal("\""),
|
||||||
(Keycode::Ampersand, shift, ctrl, alt) => Some(("&", false, shift, ctrl, alt)),
|
(LeftParen, _) => normal("("),
|
||||||
(Keycode::Quote, false, ctrl, alt) => Some(("'", false, false, ctrl, alt)),
|
(RightParen, _) => normal(")"),
|
||||||
(Keycode::Quote, true, ctrl, alt) => Some(("\"", false, false, ctrl, alt)),
|
(Asterisk, _) => normal("*"),
|
||||||
(Keycode::LeftParen, shift, ctrl, alt) => Some(("(", false, shift, ctrl, alt)),
|
(Plus, _) => normal("+"),
|
||||||
(Keycode::RightParen, shift, ctrl, alt) => Some((")", false, shift, ctrl, alt)),
|
(Comma, false) => normal(","),
|
||||||
(Keycode::Asterisk, shift, ctrl, alt) => Some(("*", false, shift, ctrl, alt)),
|
(Comma, true) => special("lt"),
|
||||||
(Keycode::Plus, shift, ctrl, alt) => Some(("+", false, shift, ctrl, alt)),
|
(Minus, false) => partial("-"),
|
||||||
(Keycode::Comma, false, ctrl, alt) => Some((",", false, shift, ctrl, alt)),
|
(Minus, true) => partial("_"),
|
||||||
(Keycode::Comma, true, ctrl, alt) => Some(("<", false, shift, ctrl, alt)),
|
(Period, false) => partial("."),
|
||||||
(Keycode::Minus, false, ctrl, alt) => Some(("-", false, false, ctrl, alt)),
|
(Period, true) => partial(">"),
|
||||||
(Keycode::Minus, true, ctrl, alt) => Some(("_", false, false, ctrl, alt)),
|
(Slash, false) => partial("/"),
|
||||||
(Keycode::Period, false, ctrl, alt) => Some((".", false, false, ctrl, alt)),
|
(Slash, true) => partial("?"),
|
||||||
(Keycode::Period, true, ctrl, alt) => Some((">", false, false, ctrl, alt)),
|
(Num0, false) => partial("0"),
|
||||||
(Keycode::Slash, false, ctrl, alt) => Some(("/", false, false, ctrl, alt)),
|
(Num0, true) => special(")"),
|
||||||
(Keycode::Slash, true, ctrl, alt) => Some(("?", false, false, ctrl, alt)),
|
(Num1, false) => partial("1"),
|
||||||
(Keycode::Num0, false, ctrl, alt) => Some(("0", false, shift, ctrl, alt)),
|
(Num1, true) => special("!"),
|
||||||
(Keycode::Num0, true, ctrl, alt) => Some((")", true, shift, ctrl, alt)),
|
(Num2, false) => partial("2"),
|
||||||
(Keycode::Num1, false, ctrl, alt) => Some(("1", false, shift, ctrl, alt)),
|
(Num2, true) => partial("@"),
|
||||||
(Keycode::Num1, true, ctrl, alt) => Some(("!", true, shift, ctrl, alt)),
|
(Num3, false) => partial("3"),
|
||||||
(Keycode::Num2, false, ctrl, alt) => Some(("2", false, false, ctrl, alt)),
|
(Num3, true) => partial("#"),
|
||||||
(Keycode::Num2, true, ctrl, alt) => Some(("@", false, false, ctrl, alt)),
|
(Num4, false) => partial("4"),
|
||||||
(Keycode::Num3, false, ctrl, alt) => Some(("3", false, false, ctrl, alt)),
|
(Num4, true) => partial("$"),
|
||||||
(Keycode::Num3, true, ctrl, alt) => Some(("#", false, false, ctrl, alt)),
|
(Num5, false) => partial("5"),
|
||||||
(Keycode::Num4, false, ctrl, alt) => Some(("4", false, false, ctrl, alt)),
|
(Num5, true) => partial("%"),
|
||||||
(Keycode::Num4, true, ctrl, alt) => Some(("$", false, false, ctrl, alt)),
|
(Num6, false) => partial("6"),
|
||||||
(Keycode::Num5, false, ctrl, alt) => Some(("5", false, false, ctrl, alt)),
|
(Num6, true) => partial("^"),
|
||||||
(Keycode::Num5, true, ctrl, alt) => Some(("%", false, false, ctrl, alt)),
|
(Num7, false) => partial("7"),
|
||||||
(Keycode::Num6, false, ctrl, alt) => Some(("6", false, false, ctrl, alt)),
|
(Num7, true) => partial("&"),
|
||||||
(Keycode::Num6, true, ctrl, alt) => Some(("^", false, false, ctrl, alt)),
|
(Num8, false) => partial("8"),
|
||||||
(Keycode::Num7, false, ctrl, alt) => Some(("7", false, false, ctrl, alt)),
|
(Num8, true) => partial("*"),
|
||||||
(Keycode::Num7, true, ctrl, alt) => Some(("&", false, false, ctrl, alt)),
|
(Num9, false) => partial("9"),
|
||||||
(Keycode::Num8, false, ctrl, alt) => Some(("8", false, false, ctrl, alt)),
|
(Num9, true) => partial("("),
|
||||||
(Keycode::Num8, true, ctrl, alt) => Some(("*", false, false, ctrl, alt)),
|
(Colon, _) => normal(":"),
|
||||||
(Keycode::Num9, false, ctrl, alt) => Some(("9", false, false, ctrl, alt)),
|
(Semicolon, false) => partial(";"),
|
||||||
(Keycode::Num9, true, ctrl, alt) => Some(("(", true, false, ctrl, alt)),
|
(Semicolon, true) => partial(":"),
|
||||||
(Keycode::Colon, shift, ctrl, alt) => Some((":", false, shift, ctrl, alt)),
|
(Less, _) => special("lt"),
|
||||||
(Keycode::Semicolon, false, ctrl, alt) => Some((";", false, false, ctrl, alt)),
|
(Equals, false) => partial("="),
|
||||||
(Keycode::Semicolon, true, ctrl, alt) => Some((":", false, false, ctrl, alt)),
|
(Equals, true) => partial("+"),
|
||||||
(Keycode::Less, shift, ctrl, alt) => Some(("lt", false, shift, ctrl, alt)),
|
(Greater, _) => normal("gt"),
|
||||||
(Keycode::Equals, false, ctrl, alt) => Some(("=", false, false, ctrl, alt)),
|
(Question, _) => normal("?"),
|
||||||
(Keycode::Equals, true, ctrl, alt) => Some(("+", false, false, ctrl, alt)),
|
(At, _) => normal("@"),
|
||||||
(Keycode::Greater, shift, ctrl, alt) => Some(("gt", false, shift, ctrl, alt)),
|
(LeftBracket, false) => partial("["),
|
||||||
(Keycode::Question, shift, ctrl, alt) => Some(("?", false, shift, ctrl, alt)),
|
(LeftBracket, true) => partial("{"),
|
||||||
(Keycode::At, shift, ctrl, alt) => Some(("@", false, shift, ctrl, alt)),
|
(Backslash, false) => partial("\\"),
|
||||||
(Keycode::LeftBracket, false, ctrl, alt) => Some(("[", false, false, ctrl, alt)),
|
(Backslash, true) => partial("|"),
|
||||||
(Keycode::LeftBracket, true, ctrl, alt) => Some(("{", false, false, ctrl, alt)),
|
(RightBracket, false) => partial("]"),
|
||||||
(Keycode::Backslash, false, ctrl, alt) => Some(("\\", false, false, ctrl, alt)),
|
(RightBracket, true) => partial("}"),
|
||||||
(Keycode::Backslash, true, ctrl, alt) => Some(("|", false, false, ctrl, alt)),
|
(Caret, _) => normal("^"),
|
||||||
(Keycode::RightBracket, false, ctrl, alt) => Some(("]", false, false, ctrl, alt)),
|
(Underscore, _) => normal("_"),
|
||||||
(Keycode::RightBracket, true, ctrl, alt) => Some(("}", false, false, ctrl, alt)),
|
(Backquote, false) => partial("`"),
|
||||||
(Keycode::Caret, shift, ctrl, alt) => Some(("^", false, shift, ctrl, alt)),
|
(Backquote, true) => partial("~"),
|
||||||
(Keycode::Underscore, shift, ctrl, alt) => Some(("_", false, shift, ctrl, alt)),
|
(A, _) => normal("a"),
|
||||||
(Keycode::Backquote, false, ctrl, alt) => Some(("`", false, false, ctrl, alt)),
|
(B, _) => normal("b"),
|
||||||
(Keycode::Backquote, true, ctrl, alt) => Some(("~", false, false, ctrl, alt)),
|
(C, _) => normal("c"),
|
||||||
(Keycode::A, shift, ctrl, alt) => Some(("a", false, shift, ctrl, alt)),
|
(D, _) => normal("d"),
|
||||||
(Keycode::B, shift, ctrl, alt) => Some(("b", false, shift, ctrl, alt)),
|
(E, _) => normal("e"),
|
||||||
(Keycode::C, shift, ctrl, alt) => Some(("c", false, shift, ctrl, alt)),
|
(F, _) => normal("f"),
|
||||||
(Keycode::D, shift, ctrl, alt) => Some(("d", false, shift, ctrl, alt)),
|
(G, _) => normal("g"),
|
||||||
(Keycode::E, shift, ctrl, alt) => Some(("e", false, shift, ctrl, alt)),
|
(H, _) => normal("h"),
|
||||||
(Keycode::F, shift, ctrl, alt) => Some(("f", false, shift, ctrl, alt)),
|
(I, _) => normal("i"),
|
||||||
(Keycode::G, shift, ctrl, alt) => Some(("g", false, shift, ctrl, alt)),
|
(J, _) => normal("j"),
|
||||||
(Keycode::H, shift, ctrl, alt) => Some(("h", false, shift, ctrl, alt)),
|
(K, _) => normal("k"),
|
||||||
(Keycode::I, shift, ctrl, alt) => Some(("i", false, shift, ctrl, alt)),
|
(L, _) => normal("l"),
|
||||||
(Keycode::J, shift, ctrl, alt) => Some(("j", false, shift, ctrl, alt)),
|
(M, _) => normal("m"),
|
||||||
(Keycode::K, shift, ctrl, alt) => Some(("k", false, shift, ctrl, alt)),
|
(N, _) => normal("n"),
|
||||||
(Keycode::L, shift, ctrl, alt) => Some(("l", false, shift, ctrl, alt)),
|
(O, _) => normal("o"),
|
||||||
(Keycode::M, shift, ctrl, alt) => Some(("m", false, shift, ctrl, alt)),
|
(P, _) => normal("p"),
|
||||||
(Keycode::N, shift, ctrl, alt) => Some(("n", false, shift, ctrl, alt)),
|
(Q, _) => normal("q"),
|
||||||
(Keycode::O, shift, ctrl, alt) => Some(("o", false, shift, ctrl, alt)),
|
(R, _) => normal("r"),
|
||||||
(Keycode::P, shift, ctrl, alt) => Some(("p", false, shift, ctrl, alt)),
|
(S, _) => normal("s"),
|
||||||
(Keycode::Q, shift, ctrl, alt) => Some(("q", false, shift, ctrl, alt)),
|
(T, _) => normal("t"),
|
||||||
(Keycode::R, shift, ctrl, alt) => Some(("r", false, shift, ctrl, alt)),
|
(U, _) => normal("u"),
|
||||||
(Keycode::S, shift, ctrl, alt) => Some(("s", false, shift, ctrl, alt)),
|
(V, _) => normal("v"),
|
||||||
(Keycode::T, shift, ctrl, alt) => Some(("t", false, shift, ctrl, alt)),
|
(W, _) => normal("w"),
|
||||||
(Keycode::U, shift, ctrl, alt) => Some(("u", false, shift, ctrl, alt)),
|
(X, _) => normal("x"),
|
||||||
(Keycode::V, shift, ctrl, alt) => Some(("v", false, shift, ctrl, alt)),
|
(Y, _) => normal("y"),
|
||||||
(Keycode::W, shift, ctrl, alt) => Some(("w", false, shift, ctrl, alt)),
|
(Z, _) => normal("z"),
|
||||||
(Keycode::X, shift, ctrl, alt) => Some(("x", false, shift, ctrl, alt)),
|
(Delete, _) => special("Delete"),
|
||||||
(Keycode::Y, shift, ctrl, alt) => Some(("y", false, shift, ctrl, alt)),
|
(F1, _) => special("F1"),
|
||||||
(Keycode::Z, shift, ctrl, alt) => Some(("z", false, shift, ctrl, alt)),
|
(F2, _) => special("F2"),
|
||||||
(Keycode::Delete, shift, ctrl, alt) => Some(("Delete", true, shift, ctrl, alt)),
|
(F3, _) => special("F3"),
|
||||||
(Keycode::CapsLock, _, _, _) => unsupported_key(Keycode::CapsLock),
|
(F4, _) => special("F4"),
|
||||||
(Keycode::F1, shift, ctrl, alt) => Some(("F1", true, shift, ctrl, alt)),
|
(F5, _) => special("F5"),
|
||||||
(Keycode::F2, shift, ctrl, alt) => Some(("F2", true, shift, ctrl, alt)),
|
(F6, _) => special("F6"),
|
||||||
(Keycode::F3, shift, ctrl, alt) => Some(("F3", true, shift, ctrl, alt)),
|
(F7, _) => special("F7"),
|
||||||
(Keycode::F4, shift, ctrl, alt) => Some(("F4", true, shift, ctrl, alt)),
|
(F8, _) => special("F8"),
|
||||||
(Keycode::F5, shift, ctrl, alt) => Some(("F5", true, shift, ctrl, alt)),
|
(F9, _) => special("F9"),
|
||||||
(Keycode::F6, shift, ctrl, alt) => Some(("F6", true, shift, ctrl, alt)),
|
(F10, _) => special("F10"),
|
||||||
(Keycode::F7, shift, ctrl, alt) => Some(("F7", true, shift, ctrl, alt)),
|
(F11, _) => special("F11"),
|
||||||
(Keycode::F8, shift, ctrl, alt) => Some(("F8", true, shift, ctrl, alt)),
|
(F12, _) => special("F12"),
|
||||||
(Keycode::F9, shift, ctrl, alt) => Some(("F9", true, shift, ctrl, alt)),
|
(Insert, _) => special("Insert"),
|
||||||
(Keycode::F10, shift, ctrl, alt) => Some(("F10", true, shift, ctrl, alt)),
|
(Home, _) => special("Home"),
|
||||||
(Keycode::F11, shift, ctrl, alt) => Some(("F11", true, shift, ctrl, alt)),
|
(PageUp, _) => special("PageUp"),
|
||||||
(Keycode::F12, shift, ctrl, alt) => Some(("F12", true, shift, ctrl, alt)),
|
(End, _) => special("End"),
|
||||||
(Keycode::PrintScreen, _, _, _) => unsupported_key(Keycode::PrintScreen),
|
(PageDown, _) => special("PageDown"),
|
||||||
(Keycode::ScrollLock, _, _, _) => unsupported_key(Keycode::ScrollLock),
|
(Right, _) => special("Right"),
|
||||||
(Keycode::Pause, _, _, _) => unsupported_key(Keycode::Pause),
|
(Left, _) => special("Left"),
|
||||||
(Keycode::Insert, shift, ctrl, alt) => Some(("Insert", true, shift, ctrl, alt)),
|
(Down, _) => special("Down"),
|
||||||
(Keycode::Home, shift, ctrl, alt) => Some(("Home", true, shift, ctrl, alt)),
|
(Up, _) => special("Up"),
|
||||||
(Keycode::PageUp, shift, ctrl, alt) => Some(("PageUp", true, shift, ctrl, alt)),
|
(KpDivide, _) => special("/"),
|
||||||
(Keycode::End, shift, ctrl, alt) => Some(("End", true, shift, ctrl, alt)),
|
(KpMultiply, _) => special("*"),
|
||||||
(Keycode::PageDown, shift, ctrl, alt) => Some(("PageDown", true, shift, ctrl, alt)),
|
(KpMinus, _) => special("-"),
|
||||||
(Keycode::Right, shift, ctrl, alt) => Some(("Right", true, shift, ctrl, alt)),
|
(KpPlus, _) => special("+"),
|
||||||
(Keycode::Left, shift, ctrl, alt) => Some(("Left", true, shift, ctrl, alt)),
|
(KpEnter, _) => special("Enter"),
|
||||||
(Keycode::Down, shift, ctrl, alt) => Some(("Down", true, shift, ctrl, alt)),
|
(Kp0, _) => normal("0"),
|
||||||
(Keycode::Up, shift, ctrl, alt) => Some(("Up", true, shift, ctrl, alt)),
|
(Kp1, _) => normal("1"),
|
||||||
(Keycode::NumLockClear, _, _, _) => unsupported_key(Keycode::NumLockClear),
|
(Kp2, _) => normal("2"),
|
||||||
(Keycode::KpDivide, shift, ctrl, alt) => Some(("/", true, shift, ctrl, alt)),
|
(Kp3, _) => normal("3"),
|
||||||
(Keycode::KpMultiply, shift, ctrl, alt) => Some(("*", true, shift, ctrl, alt)),
|
(Kp4, _) => normal("4"),
|
||||||
(Keycode::KpMinus, shift, ctrl, alt) => Some(("-", true, shift, ctrl, alt)),
|
(Kp5, _) => normal("5"),
|
||||||
(Keycode::KpPlus, shift, ctrl, alt) => Some(("+", true, shift, ctrl, alt)),
|
(Kp6, _) => normal("6"),
|
||||||
(Keycode::KpEnter, shift, ctrl, alt) => Some(("Enter", true, shift, ctrl, alt)),
|
(Kp7, _) => normal("7"),
|
||||||
(Keycode::Kp0, shift, ctrl, alt) => Some(("0", false, shift, ctrl, alt)),
|
(Kp8, _) => normal("8"),
|
||||||
(Keycode::Kp1, shift, ctrl, alt) => Some(("1", false, shift, ctrl, alt)),
|
(Kp9, _) => normal("9"),
|
||||||
(Keycode::Kp2, shift, ctrl, alt) => Some(("2", false, shift, ctrl, alt)),
|
(KpPeriod, _) => normal("."),
|
||||||
(Keycode::Kp3, shift, ctrl, alt) => Some(("3", false, shift, ctrl, alt)),
|
(KpEquals, _) => normal("="),
|
||||||
(Keycode::Kp4, shift, ctrl, alt) => Some(("4", false, shift, ctrl, alt)),
|
(F13, _) => special("F13"),
|
||||||
(Keycode::Kp5, shift, ctrl, alt) => Some(("5", false, shift, ctrl, alt)),
|
(F14, _) => special("F14"),
|
||||||
(Keycode::Kp6, shift, ctrl, alt) => Some(("6", false, shift, ctrl, alt)),
|
(F15, _) => special("F15"),
|
||||||
(Keycode::Kp7, shift, ctrl, alt) => Some(("7", false, shift, ctrl, alt)),
|
(F16, _) => special("F16"),
|
||||||
(Keycode::Kp8, shift, ctrl, alt) => Some(("8", false, shift, ctrl, alt)),
|
(F17, _) => special("F17"),
|
||||||
(Keycode::Kp9, shift, ctrl, alt) => Some(("9", false, shift, ctrl, alt)),
|
(F18, _) => special("F18"),
|
||||||
(Keycode::KpPeriod, shift, ctrl, alt) => Some((".", false, shift, ctrl, alt)),
|
(F19, _) => special("F19"),
|
||||||
(Keycode::Application, _, _, _) => unsupported_key(Keycode::Application),
|
(F20, _) => special("F20"),
|
||||||
(Keycode::Power, _, _, _) => unsupported_key(Keycode::Power),
|
(F21, _) => special("F21"),
|
||||||
(Keycode::KpEquals, shift, ctrl, alt) => Some(("=", false, shift, ctrl, alt)),
|
(F22, _) => special("F22"),
|
||||||
(Keycode::F13, shift, ctrl, alt) => Some(("F13", true, shift, ctrl, alt)),
|
(F23, _) => special("F23"),
|
||||||
(Keycode::F14, shift, ctrl, alt) => Some(("F14", true, shift, ctrl, alt)),
|
(F24, _) => special("F24"),
|
||||||
(Keycode::F15, shift, ctrl, alt) => Some(("F15", true, shift, ctrl, alt)),
|
(KpLeftParen, _) => normal("("),
|
||||||
(Keycode::F16, shift, ctrl, alt) => Some(("F16", true, shift, ctrl, alt)),
|
(KpRightParen, _) => normal("("),
|
||||||
(Keycode::F17, shift, ctrl, alt) => Some(("F17", true, shift, ctrl, alt)),
|
(KpLeftBrace, _) => normal("["),
|
||||||
(Keycode::F18, shift, ctrl, alt) => Some(("F18", true, shift, ctrl, alt)),
|
(KpRightBrace, _) => normal("]"),
|
||||||
(Keycode::F19, shift, ctrl, alt) => Some(("F19", true, shift, ctrl, alt)),
|
(KpTab, _) => special("TAB"),
|
||||||
(Keycode::F20, shift, ctrl, alt) => Some(("F20", true, shift, ctrl, alt)),
|
(KpBackspace, _) => special("BS"),
|
||||||
(Keycode::F21, shift, ctrl, alt) => Some(("F21", true, shift, ctrl, alt)),
|
(KpA, _) => normal("A"),
|
||||||
(Keycode::F22, shift, ctrl, alt) => Some(("F22", true, shift, ctrl, alt)),
|
(KpB, _) => normal("B"),
|
||||||
(Keycode::F23, shift, ctrl, alt) => Some(("F23", true, shift, ctrl, alt)),
|
(KpC, _) => normal("C"),
|
||||||
(Keycode::F24, shift, ctrl, alt) => Some(("F24", true, shift, ctrl, alt)),
|
(KpD, _) => normal("D"),
|
||||||
(Keycode::Execute, _, _, _) => unsupported_key(Keycode::Execute),
|
(KpE, _) => normal("E"),
|
||||||
(Keycode::Help, _, _, _) => unsupported_key(Keycode::Help),
|
(KpF, _) => normal("F"),
|
||||||
(Keycode::Menu, _, _, _) => unsupported_key(Keycode::Menu),
|
(KpPower, _) => normal("^"),
|
||||||
(Keycode::Select, _, _, _) => unsupported_key(Keycode::Select),
|
(KpPercent, _) => normal("%"),
|
||||||
(Keycode::Stop, _, _, _) => unsupported_key(Keycode::Stop),
|
(KpLess, _) => special("lt"),
|
||||||
(Keycode::Again, _, _, _) => unsupported_key(Keycode::Again),
|
(KpGreater, _) => special("gt"),
|
||||||
(Keycode::Undo, _, _, _) => unsupported_key(Keycode::Undo),
|
(KpAmpersand, _) => normal("&"),
|
||||||
(Keycode::Cut, _, _, _) => unsupported_key(Keycode::Cut),
|
(KpVerticalBar, _) => normal("|"),
|
||||||
(Keycode::Copy, _, _, _) => unsupported_key(Keycode::Copy),
|
(KpColon, _) => normal(":"),
|
||||||
(Keycode::Paste, _, _, _) => unsupported_key(Keycode::Paste),
|
(KpHash, _) => normal("#"),
|
||||||
(Keycode::Find, _, _, _) => unsupported_key(Keycode::Find),
|
(KpSpace, _) => normal(" "),
|
||||||
(Keycode::Mute, _, _, _) => unsupported_key(Keycode::Mute),
|
(KpAt, _) => normal("@"),
|
||||||
(Keycode::VolumeUp, _, _, _) => unsupported_key(Keycode::VolumeUp),
|
(KpExclam, _) => normal("!"),
|
||||||
(Keycode::VolumeDown, _, _, _) => unsupported_key(Keycode::VolumeDown),
|
(LCtrl, _) => None,
|
||||||
(Keycode::KpComma, _, _, _) => unsupported_key(Keycode::KpComma),
|
(LShift, _) => None,
|
||||||
(Keycode::KpEqualsAS400, _, _, _) => unsupported_key(Keycode::KpEqualsAS400),
|
(LAlt, _) => None,
|
||||||
(Keycode::AltErase, _, _, _) => unsupported_key(Keycode::AltErase),
|
(LGui, _) => None,
|
||||||
(Keycode::Sysreq, _, _, _) => unsupported_key(Keycode::Sysreq),
|
(RCtrl, _) => None,
|
||||||
(Keycode::Cancel, _, _, _) => unsupported_key(Keycode::Cancel),
|
(RShift, _) => None,
|
||||||
(Keycode::Clear, _, _, _) => unsupported_key(Keycode::Clear),
|
(RAlt, _) => None,
|
||||||
(Keycode::Prior, _, _, _) => unsupported_key(Keycode::Prior),
|
(RGui, _) => None,
|
||||||
(Keycode::Return2, _, _, _) => unsupported_key(Keycode::Return2),
|
(keycode, _) => unsupported_key(keycode),
|
||||||
(Keycode::Separator, _, _, _) => unsupported_key(Keycode::Separator),
|
|
||||||
(Keycode::Out, _, _, _) => unsupported_key(Keycode::Out),
|
|
||||||
(Keycode::Oper, _, _, _) => unsupported_key(Keycode::Oper),
|
|
||||||
(Keycode::ClearAgain, _, _, _) => unsupported_key(Keycode::ClearAgain),
|
|
||||||
(Keycode::CrSel, _, _, _) => unsupported_key(Keycode::CrSel),
|
|
||||||
(Keycode::ExSel, _, _, _) => unsupported_key(Keycode::ExSel),
|
|
||||||
(Keycode::Kp00, _, _, _) => unsupported_key(Keycode::Kp00),
|
|
||||||
(Keycode::Kp000, _, _, _) => unsupported_key(Keycode::Kp000),
|
|
||||||
(Keycode::ThousandsSeparator, _, _, _) => unsupported_key(Keycode::ThousandsSeparator),
|
|
||||||
(Keycode::DecimalSeparator, _, _, _) => unsupported_key(Keycode::DecimalSeparator),
|
|
||||||
(Keycode::CurrencyUnit, _, _, _) => unsupported_key(Keycode::CurrencyUnit),
|
|
||||||
(Keycode::CurrencySubUnit, _, _, _) => unsupported_key(Keycode::CurrencySubUnit),
|
|
||||||
(Keycode::KpLeftParen, shift, ctrl, alt) => Some(("(", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpRightParen, shift, ctrl, alt) => Some(("(", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpLeftBrace, shift, ctrl, alt) => Some(("[", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpRightBrace, shift, ctrl, alt) => Some(("]", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpTab, shift, ctrl, alt) => Some(("TAB", true, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpBackspace, shift, ctrl, alt) => Some(("BS", true, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpA, shift, ctrl, alt) => Some(("A", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpB, shift, ctrl, alt) => Some(("B", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpC, shift, ctrl, alt) => Some(("C", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpD, shift, ctrl, alt) => Some(("D", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpE, shift, ctrl, alt) => Some(("E", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpF, shift, ctrl, alt) => Some(("F", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpXor, _, _, _) => unsupported_key(Keycode::KpXor),
|
|
||||||
(Keycode::KpPower, shift, ctrl, alt) => Some(("^", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpPercent, shift, ctrl, alt) => Some(("%", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpLess, shift, ctrl, alt) => Some(("lt", true, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpGreater, shift, ctrl, alt) => Some(("gt", true, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpAmpersand, shift, ctrl, alt) => Some(("&", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpDblAmpersand, _, _, _) => unsupported_key(Keycode::KpDblAmpersand),
|
|
||||||
(Keycode::KpVerticalBar, shift, ctrl, alt) => Some(("|", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpDblVerticalBar, _, _, _) => unsupported_key(Keycode::KpDblVerticalBar),
|
|
||||||
(Keycode::KpColon, shift, ctrl, alt) => Some((":", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpHash, shift, ctrl, alt) => Some(("#", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpSpace, shift, ctrl, alt) => Some((" ", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpAt, shift, ctrl, alt) => Some(("@", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpExclam, shift, ctrl, alt) => Some(("!", false, shift, ctrl, alt)),
|
|
||||||
(Keycode::KpMemStore, _, _, _) => unsupported_key(Keycode::KpMemStore),
|
|
||||||
(Keycode::KpMemRecall, _, _, _) => unsupported_key(Keycode::KpMemRecall),
|
|
||||||
(Keycode::KpMemClear, _, _, _) => unsupported_key(Keycode::KpMemClear),
|
|
||||||
(Keycode::KpMemAdd, _, _, _) => unsupported_key(Keycode::KpMemAdd),
|
|
||||||
(Keycode::KpMemSubtract, _, _, _) => unsupported_key(Keycode::KpMemSubtract),
|
|
||||||
(Keycode::KpMemMultiply, _, _, _) => unsupported_key(Keycode::KpMemMultiply),
|
|
||||||
(Keycode::KpMemDivide, _, _, _) => unsupported_key(Keycode::KpMemDivide),
|
|
||||||
(Keycode::KpPlusMinus, _, _, _) => unsupported_key(Keycode::KpPlusMinus),
|
|
||||||
(Keycode::KpClear, _, _, _) => unsupported_key(Keycode::KpClear),
|
|
||||||
(Keycode::KpClearEntry, _, _, _) => unsupported_key(Keycode::KpClearEntry),
|
|
||||||
(Keycode::KpBinary, _, _, _) => unsupported_key(Keycode::KpBinary),
|
|
||||||
(Keycode::KpOctal, _, _, _) => unsupported_key(Keycode::KpOctal),
|
|
||||||
(Keycode::KpDecimal, _, _, _) => unsupported_key(Keycode::KpDecimal),
|
|
||||||
(Keycode::KpHexadecimal, _, _, _) => unsupported_key(Keycode::KpHexadecimal),
|
|
||||||
(Keycode::LCtrl, _, _, _) => None,
|
|
||||||
(Keycode::LShift, _, _, _) => None,
|
|
||||||
(Keycode::LAlt, _, _, _) => None,
|
|
||||||
(Keycode::LGui, _, _, _) => None,
|
|
||||||
(Keycode::RCtrl, _, _, _) => None,
|
|
||||||
(Keycode::RShift, _, _, _) => None,
|
|
||||||
(Keycode::RAlt, _, _, _) => None,
|
|
||||||
(Keycode::RGui, _, _, _) => None,
|
|
||||||
(Keycode::Mode, _, _, _) => unsupported_key(Keycode::Mode),
|
|
||||||
(Keycode::AudioNext, _, _, _) => unsupported_key(Keycode::AudioNext),
|
|
||||||
(Keycode::AudioPrev, _, _, _) => unsupported_key(Keycode::AudioPrev),
|
|
||||||
(Keycode::AudioStop, _, _, _) => unsupported_key(Keycode::AudioStop),
|
|
||||||
(Keycode::AudioPlay, _, _, _) => unsupported_key(Keycode::AudioPlay),
|
|
||||||
(Keycode::AudioMute, _, _, _) => unsupported_key(Keycode::AudioMute),
|
|
||||||
(Keycode::MediaSelect, _, _, _) => unsupported_key(Keycode::MediaSelect),
|
|
||||||
(Keycode::Www, _, _, _) => unsupported_key(Keycode::Www),
|
|
||||||
(Keycode::Mail, _, _, _) => unsupported_key(Keycode::Mail),
|
|
||||||
(Keycode::Calculator, _, _, _) => unsupported_key(Keycode::Calculator),
|
|
||||||
(Keycode::Computer, _, _, _) => unsupported_key(Keycode::Computer),
|
|
||||||
(Keycode::AcSearch, _, _, _) => unsupported_key(Keycode::AcSearch),
|
|
||||||
(Keycode::AcHome, _, _, _) => unsupported_key(Keycode::AcHome),
|
|
||||||
(Keycode::AcBack, _, _, _) => unsupported_key(Keycode::AcBack),
|
|
||||||
(Keycode::AcForward, _, _, _) => unsupported_key(Keycode::AcForward),
|
|
||||||
(Keycode::AcStop, _, _, _) => unsupported_key(Keycode::AcStop),
|
|
||||||
(Keycode::AcRefresh, _, _, _) => unsupported_key(Keycode::AcRefresh),
|
|
||||||
(Keycode::AcBookmarks, _, _, _) => unsupported_key(Keycode::AcBookmarks),
|
|
||||||
(Keycode::BrightnessDown, _, _, _) => unsupported_key(Keycode::BrightnessDown),
|
|
||||||
(Keycode::BrightnessUp, _, _, _) => unsupported_key(Keycode::BrightnessUp),
|
|
||||||
(Keycode::DisplaySwitch, _, _, _) => unsupported_key(Keycode::DisplaySwitch),
|
|
||||||
(Keycode::KbdIllumToggle, _, _, _) => unsupported_key(Keycode::KbdIllumToggle),
|
|
||||||
(Keycode::KbdIllumDown, _, _, _) => unsupported_key(Keycode::KbdIllumDown),
|
|
||||||
(Keycode::KbdIllumUp, _, _, _) => unsupported_key(Keycode::KbdIllumUp),
|
|
||||||
(Keycode::Eject, _, _, _) => unsupported_key(Keycode::Eject),
|
|
||||||
(Keycode::Sleep, _, _, _) => unsupported_key(Keycode::Sleep),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,21 @@
|
|||||||
mod qwerty;
|
mod qwerty;
|
||||||
|
|
||||||
use log::trace;
|
use crate::window::keyboard::Modifiers;
|
||||||
use skulpin::winit::event::ModifiersState;
|
use skulpin::winit::event::ModifiersState;
|
||||||
use skulpin::winit::event::VirtualKeyCode as Keycode;
|
|
||||||
|
|
||||||
use super::keyboard::*;
|
pub use qwerty::handle_qwerty_layout;
|
||||||
use crate::settings::*;
|
|
||||||
use qwerty::*;
|
|
||||||
|
|
||||||
pub fn unsupported_key<R>(keycode: Keycode) -> Option<R> {
|
impl From<Option<ModifiersState>> for Modifiers {
|
||||||
trace!("Unsupported key: {:?}", keycode);
|
fn from(state: Option<ModifiersState>) -> Modifiers {
|
||||||
None
|
if let Some(modifiers) = state {
|
||||||
}
|
Modifiers {
|
||||||
|
shift: state.shift(),
|
||||||
pub fn produce_neovim_keybinding_string(
|
control: state.ctrl(),
|
||||||
keycode: Option<Keycode>,
|
meta: state.alt(),
|
||||||
keytext: Option<String>,
|
logo: state.logo(),
|
||||||
modifiers: Option<ModifiersState>,
|
|
||||||
) -> Option<String> {
|
|
||||||
let mut shift = false;
|
|
||||||
let mut ctrl = false;
|
|
||||||
let mut alt = false;
|
|
||||||
let mut gui = false;
|
|
||||||
if let Some(modifiers) = modifiers {
|
|
||||||
shift = modifiers.shift();
|
|
||||||
ctrl = modifiers.ctrl();
|
|
||||||
alt = modifiers.alt();
|
|
||||||
gui = modifiers.logo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(text) = keytext {
|
|
||||||
Some(append_modifiers(&text, false, false, ctrl, alt, gui))
|
|
||||||
} else if let Some(keycode) = keycode {
|
|
||||||
(match SETTINGS.get::<KeyboardSettings>().layout {
|
|
||||||
KeyboardLayout::Qwerty => handle_qwerty_layout(keycode, shift, ctrl, alt),
|
|
||||||
})
|
|
||||||
.map(|(transformed_text, special, shift, ctrl, alt)| {
|
|
||||||
append_modifiers(transformed_text, special, shift, ctrl, alt, gui)
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
None
|
Modifiers::new(false, false, false, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,164 +1,138 @@
|
|||||||
use super::unsupported_key;
|
use crate::window::keyboard::{unsupported_key, Token};
|
||||||
|
use skulpin::winit::event::VirtualKeyCode::{self, *};
|
||||||
|
|
||||||
use skulpin::winit::event::VirtualKeyCode as Keycode;
|
/// Maps winit keyboard events to Vim tokens
|
||||||
|
pub fn handle_qwerty_layout(keycode: VirtualKeyCode, shift: bool) -> Option<Token<'static>> {
|
||||||
pub fn handle_qwerty_layout(
|
let special = |text| Some(Token::new(text, true, true));
|
||||||
keycode: Keycode,
|
let normal = |text| Some(Token::new(text, false, true));
|
||||||
shift: bool,
|
let partial = |text| Some(Token::new(text, false, false));
|
||||||
ctrl: bool,
|
match (keycode, shift) {
|
||||||
alt: bool,
|
(Back, _) => special("BS"),
|
||||||
) -> Option<(&'static str, bool, bool, bool, bool)> {
|
(Tab, _) => special("Tab"),
|
||||||
match (keycode, shift, ctrl, alt) {
|
(Return, _) => special("Enter"),
|
||||||
(Keycode::Back, shift, ctrl, alt) => Some(("BS", true, shift, ctrl, alt)),
|
(Escape, _) => special("Esc"),
|
||||||
(Keycode::Tab, shift, ctrl, alt) => Some(("Tab", true, shift, ctrl, alt)),
|
(Space, _) => normal(" "),
|
||||||
(Keycode::Return, shift, ctrl, alt) => Some(("Enter", true, shift, ctrl, alt)),
|
(Apostrophe, false) => partial("'"),
|
||||||
(Keycode::Escape, shift, ctrl, alt) => Some(("Esc", true, shift, ctrl, alt)),
|
(Apostrophe, true) => partial("\""),
|
||||||
(Keycode::Space, shift, ctrl, alt) => Some((" ", false, shift, ctrl, alt)),
|
(Comma, false) => normal(","),
|
||||||
(Keycode::Apostrophe, false, ctrl, alt) => Some(("'", false, false, ctrl, alt)),
|
(Comma, true) => special("lt"),
|
||||||
(Keycode::Apostrophe, true, ctrl, alt) => Some(("\"", false, false, ctrl, alt)),
|
(Minus, false) => partial("-"),
|
||||||
(Keycode::Comma, false, ctrl, alt) => Some((",", false, shift, ctrl, alt)),
|
(Minus, true) => partial("_"),
|
||||||
(Keycode::Comma, true, ctrl, alt) => Some(("<", false, shift, ctrl, alt)),
|
(Period, false) => partial("."),
|
||||||
(Keycode::Minus, false, ctrl, alt) => Some(("-", false, false, ctrl, alt)),
|
(Period, true) => partial(">"),
|
||||||
(Keycode::Minus, true, ctrl, alt) => Some(("_", false, false, ctrl, alt)),
|
(Slash, false) => partial("/"),
|
||||||
(Keycode::Period, false, ctrl, alt) => Some((".", false, false, ctrl, alt)),
|
(Slash, true) => partial("?"),
|
||||||
(Keycode::Period, true, ctrl, alt) => Some((">", false, false, ctrl, alt)),
|
(Key0, false) => normal("0"),
|
||||||
(Keycode::Slash, false, ctrl, alt) => Some(("/", false, false, ctrl, alt)),
|
(Key0, true) => special(")"),
|
||||||
(Keycode::Slash, true, ctrl, alt) => Some(("?", false, false, ctrl, alt)),
|
(Key1, false) => normal("1"),
|
||||||
(Keycode::Key0, false, ctrl, alt) => Some(("0", false, shift, ctrl, alt)),
|
(Key1, true) => special("!"),
|
||||||
(Keycode::Key0, true, ctrl, alt) => Some((")", true, shift, ctrl, alt)),
|
(Key2, false) => partial("2"),
|
||||||
(Keycode::Key1, false, ctrl, alt) => Some(("1", false, shift, ctrl, alt)),
|
(Key2, true) => partial("@"),
|
||||||
(Keycode::Key1, true, ctrl, alt) => Some(("!", true, shift, ctrl, alt)),
|
(Key3, false) => partial("3"),
|
||||||
(Keycode::Key2, false, ctrl, alt) => Some(("2", false, false, ctrl, alt)),
|
(Key3, true) => partial("#"),
|
||||||
(Keycode::Key2, true, ctrl, alt) => Some(("@", false, false, ctrl, alt)),
|
(Key4, false) => partial("4"),
|
||||||
(Keycode::Key3, false, ctrl, alt) => Some(("3", false, false, ctrl, alt)),
|
(Key4, true) => partial("$"),
|
||||||
(Keycode::Key3, true, ctrl, alt) => Some(("#", false, false, ctrl, alt)),
|
(Key5, false) => partial("5"),
|
||||||
(Keycode::Key4, false, ctrl, alt) => Some(("4", false, false, ctrl, alt)),
|
(Key5, true) => partial("%"),
|
||||||
(Keycode::Key4, true, ctrl, alt) => Some(("$", false, false, ctrl, alt)),
|
(Key6, false) => partial("6"),
|
||||||
(Keycode::Key5, false, ctrl, alt) => Some(("5", false, false, ctrl, alt)),
|
(Key6, true) => partial("^"),
|
||||||
(Keycode::Key5, true, ctrl, alt) => Some(("%", false, false, ctrl, alt)),
|
(Key7, false) => partial("7"),
|
||||||
(Keycode::Key6, false, ctrl, alt) => Some(("6", false, false, ctrl, alt)),
|
(Key7, true) => partial("&"),
|
||||||
(Keycode::Key6, true, ctrl, alt) => Some(("^", false, false, ctrl, alt)),
|
(Key8, false) => partial("8"),
|
||||||
(Keycode::Key7, false, ctrl, alt) => Some(("7", false, false, ctrl, alt)),
|
(Key8, true) => partial("*"),
|
||||||
(Keycode::Key7, true, ctrl, alt) => Some(("&", false, false, ctrl, alt)),
|
(Key9, false) => partial("9"),
|
||||||
(Keycode::Key8, false, ctrl, alt) => Some(("8", false, false, ctrl, alt)),
|
(Key9, true) => partial("("),
|
||||||
(Keycode::Key8, true, ctrl, alt) => Some(("*", false, false, ctrl, alt)),
|
(Colon, _) => normal(":"),
|
||||||
(Keycode::Key9, false, ctrl, alt) => Some(("9", false, false, ctrl, alt)),
|
(Semicolon, false) => partial(";"),
|
||||||
(Keycode::Key9, true, ctrl, alt) => Some(("(", true, false, ctrl, alt)),
|
(Semicolon, true) => partial(":"),
|
||||||
(Keycode::Colon, shift, ctrl, alt) => Some((":", false, shift, ctrl, alt)),
|
(Equals, false) => partial("="),
|
||||||
(Keycode::Semicolon, false, ctrl, alt) => Some((";", false, false, ctrl, alt)),
|
(Equals, true) => partial("+"),
|
||||||
(Keycode::Semicolon, true, ctrl, alt) => Some((":", false, false, ctrl, alt)),
|
(At, _) => normal("@"),
|
||||||
(Keycode::Equals, false, ctrl, alt) => Some(("=", false, false, ctrl, alt)),
|
(LBracket, false) => partial("["),
|
||||||
(Keycode::Equals, true, ctrl, alt) => Some(("+", false, false, ctrl, alt)),
|
(LBracket, true) => partial("{"),
|
||||||
(Keycode::At, shift, ctrl, alt) => Some(("@", false, shift, ctrl, alt)),
|
(Backslash, false) => partial("\\"),
|
||||||
(Keycode::LBracket, false, ctrl, alt) => Some(("[", false, false, ctrl, alt)),
|
(Backslash, true) => partial("|"),
|
||||||
(Keycode::LBracket, true, ctrl, alt) => Some(("{", false, false, ctrl, alt)),
|
(RBracket, false) => partial("]"),
|
||||||
(Keycode::Backslash, false, ctrl, alt) => Some(("\\", false, false, ctrl, alt)),
|
(RBracket, true) => partial("}"),
|
||||||
(Keycode::Backslash, true, ctrl, alt) => Some(("|", false, false, ctrl, alt)),
|
(Caret, _) => normal("^"),
|
||||||
(Keycode::RBracket, false, ctrl, alt) => Some(("]", false, false, ctrl, alt)),
|
(Grave, false) => partial("`"),
|
||||||
(Keycode::RBracket, true, ctrl, alt) => Some(("}", false, false, ctrl, alt)),
|
(Grave, true) => partial("~"),
|
||||||
(Keycode::Caret, shift, ctrl, alt) => Some(("^", false, shift, ctrl, alt)),
|
(A, _) => normal("a"),
|
||||||
(Keycode::Grave, false, ctrl, alt) => Some(("`", false, false, ctrl, alt)),
|
(B, _) => normal("b"),
|
||||||
(Keycode::Grave, true, ctrl, alt) => Some(("~", false, false, ctrl, alt)),
|
(C, _) => normal("c"),
|
||||||
(Keycode::A, shift, ctrl, alt) => Some(("a", false, shift, ctrl, alt)),
|
(D, _) => normal("d"),
|
||||||
(Keycode::B, shift, ctrl, alt) => Some(("b", false, shift, ctrl, alt)),
|
(E, _) => normal("e"),
|
||||||
(Keycode::C, shift, ctrl, alt) => Some(("c", false, shift, ctrl, alt)),
|
(F, _) => normal("f"),
|
||||||
(Keycode::D, shift, ctrl, alt) => Some(("d", false, shift, ctrl, alt)),
|
(G, _) => normal("g"),
|
||||||
(Keycode::E, shift, ctrl, alt) => Some(("e", false, shift, ctrl, alt)),
|
(H, _) => normal("h"),
|
||||||
(Keycode::F, shift, ctrl, alt) => Some(("f", false, shift, ctrl, alt)),
|
(I, _) => normal("i"),
|
||||||
(Keycode::G, shift, ctrl, alt) => Some(("g", false, shift, ctrl, alt)),
|
(J, _) => normal("j"),
|
||||||
(Keycode::H, shift, ctrl, alt) => Some(("h", false, shift, ctrl, alt)),
|
(K, _) => normal("k"),
|
||||||
(Keycode::I, shift, ctrl, alt) => Some(("i", false, shift, ctrl, alt)),
|
(L, _) => normal("l"),
|
||||||
(Keycode::J, shift, ctrl, alt) => Some(("j", false, shift, ctrl, alt)),
|
(M, _) => normal("m"),
|
||||||
(Keycode::K, shift, ctrl, alt) => Some(("k", false, shift, ctrl, alt)),
|
(N, _) => normal("n"),
|
||||||
(Keycode::L, shift, ctrl, alt) => Some(("l", false, shift, ctrl, alt)),
|
(O, _) => normal("o"),
|
||||||
(Keycode::M, shift, ctrl, alt) => Some(("m", false, shift, ctrl, alt)),
|
(P, _) => normal("p"),
|
||||||
(Keycode::N, shift, ctrl, alt) => Some(("n", false, shift, ctrl, alt)),
|
(Q, _) => normal("q"),
|
||||||
(Keycode::O, shift, ctrl, alt) => Some(("o", false, shift, ctrl, alt)),
|
(R, _) => normal("r"),
|
||||||
(Keycode::P, shift, ctrl, alt) => Some(("p", false, shift, ctrl, alt)),
|
(S, _) => normal("s"),
|
||||||
(Keycode::Q, shift, ctrl, alt) => Some(("q", false, shift, ctrl, alt)),
|
(T, _) => normal("t"),
|
||||||
(Keycode::R, shift, ctrl, alt) => Some(("r", false, shift, ctrl, alt)),
|
(U, _) => normal("u"),
|
||||||
(Keycode::S, shift, ctrl, alt) => Some(("s", false, shift, ctrl, alt)),
|
(V, _) => normal("v"),
|
||||||
(Keycode::T, shift, ctrl, alt) => Some(("t", false, shift, ctrl, alt)),
|
(W, _) => normal("w"),
|
||||||
(Keycode::U, shift, ctrl, alt) => Some(("u", false, shift, ctrl, alt)),
|
(X, _) => normal("x"),
|
||||||
(Keycode::V, shift, ctrl, alt) => Some(("v", false, shift, ctrl, alt)),
|
(Y, _) => normal("y"),
|
||||||
(Keycode::W, shift, ctrl, alt) => Some(("w", false, shift, ctrl, alt)),
|
(Z, _) => normal("z"),
|
||||||
(Keycode::X, shift, ctrl, alt) => Some(("x", false, shift, ctrl, alt)),
|
(Delete, _) => special("Delete"),
|
||||||
(Keycode::Y, shift, ctrl, alt) => Some(("y", false, shift, ctrl, alt)),
|
(F1, _) => special("F1"),
|
||||||
(Keycode::Z, shift, ctrl, alt) => Some(("z", false, shift, ctrl, alt)),
|
(F2, _) => special("F2"),
|
||||||
(Keycode::Delete, shift, ctrl, alt) => Some(("Delete", true, shift, ctrl, alt)),
|
(F3, _) => special("F3"),
|
||||||
(Keycode::F1, shift, ctrl, alt) => Some(("F1", true, shift, ctrl, alt)),
|
(F4, _) => special("F4"),
|
||||||
(Keycode::F2, shift, ctrl, alt) => Some(("F2", true, shift, ctrl, alt)),
|
(F5, _) => special("F5"),
|
||||||
(Keycode::F3, shift, ctrl, alt) => Some(("F3", true, shift, ctrl, alt)),
|
(F6, _) => special("F6"),
|
||||||
(Keycode::F4, shift, ctrl, alt) => Some(("F4", true, shift, ctrl, alt)),
|
(F7, _) => special("F7"),
|
||||||
(Keycode::F5, shift, ctrl, alt) => Some(("F5", true, shift, ctrl, alt)),
|
(F8, _) => special("F8"),
|
||||||
(Keycode::F6, shift, ctrl, alt) => Some(("F6", true, shift, ctrl, alt)),
|
(F9, _) => special("F9"),
|
||||||
(Keycode::F7, shift, ctrl, alt) => Some(("F7", true, shift, ctrl, alt)),
|
(F10, _) => special("F10"),
|
||||||
(Keycode::F8, shift, ctrl, alt) => Some(("F8", true, shift, ctrl, alt)),
|
(F11, _) => special("F11"),
|
||||||
(Keycode::F9, shift, ctrl, alt) => Some(("F9", true, shift, ctrl, alt)),
|
(F12, _) => special("F12"),
|
||||||
(Keycode::F10, shift, ctrl, alt) => Some(("F10", true, shift, ctrl, alt)),
|
(Insert, _) => special("Insert"),
|
||||||
(Keycode::F11, shift, ctrl, alt) => Some(("F11", true, shift, ctrl, alt)),
|
(Home, _) => special("Home"),
|
||||||
(Keycode::F12, shift, ctrl, alt) => Some(("F12", true, shift, ctrl, alt)),
|
(PageUp, _) => special("PageUp"),
|
||||||
(Keycode::Snapshot, _, _, _) => unsupported_key(Keycode::Snapshot),
|
(End, _) => special("End"),
|
||||||
(Keycode::Pause, _, _, _) => unsupported_key(Keycode::Pause),
|
(PageDown, _) => special("PageDown"),
|
||||||
(Keycode::Insert, shift, ctrl, alt) => Some(("Insert", true, shift, ctrl, alt)),
|
(Right, _) => special("Right"),
|
||||||
(Keycode::Home, shift, ctrl, alt) => Some(("Home", true, shift, ctrl, alt)),
|
(Left, _) => special("Left"),
|
||||||
(Keycode::PageUp, shift, ctrl, alt) => Some(("PageUp", true, shift, ctrl, alt)),
|
(Down, _) => special("Down"),
|
||||||
(Keycode::End, shift, ctrl, alt) => Some(("End", true, shift, ctrl, alt)),
|
(Up, _) => special("Up"),
|
||||||
(Keycode::PageDown, shift, ctrl, alt) => Some(("PageDown", true, shift, ctrl, alt)),
|
(Numpad0, _) => normal("0"),
|
||||||
(Keycode::Right, shift, ctrl, alt) => Some(("Right", true, shift, ctrl, alt)),
|
(Numpad1, _) => normal("1"),
|
||||||
(Keycode::Left, shift, ctrl, alt) => Some(("Left", true, shift, ctrl, alt)),
|
(Numpad2, _) => normal("2"),
|
||||||
(Keycode::Down, shift, ctrl, alt) => Some(("Down", true, shift, ctrl, alt)),
|
(Numpad3, _) => normal("3"),
|
||||||
(Keycode::Up, shift, ctrl, alt) => Some(("Up", true, shift, ctrl, alt)),
|
(Numpad4, _) => normal("4"),
|
||||||
(Keycode::Numpad0, shift, ctrl, alt) => Some(("0", false, shift, ctrl, alt)),
|
(Numpad5, _) => normal("5"),
|
||||||
(Keycode::Numpad1, shift, ctrl, alt) => Some(("1", false, shift, ctrl, alt)),
|
(Numpad6, _) => normal("6"),
|
||||||
(Keycode::Numpad2, shift, ctrl, alt) => Some(("2", false, shift, ctrl, alt)),
|
(Numpad7, _) => normal("7"),
|
||||||
(Keycode::Numpad3, shift, ctrl, alt) => Some(("3", false, shift, ctrl, alt)),
|
(Numpad8, _) => normal("8"),
|
||||||
(Keycode::Numpad4, shift, ctrl, alt) => Some(("4", false, shift, ctrl, alt)),
|
(Numpad9, _) => normal("9"),
|
||||||
(Keycode::Numpad5, shift, ctrl, alt) => Some(("5", false, shift, ctrl, alt)),
|
(F13, _) => special("F13"),
|
||||||
(Keycode::Numpad6, shift, ctrl, alt) => Some(("6", false, shift, ctrl, alt)),
|
(F14, _) => special("F14"),
|
||||||
(Keycode::Numpad7, shift, ctrl, alt) => Some(("7", false, shift, ctrl, alt)),
|
(F15, _) => special("F15"),
|
||||||
(Keycode::Numpad8, shift, ctrl, alt) => Some(("8", false, shift, ctrl, alt)),
|
(F16, _) => special("F16"),
|
||||||
(Keycode::Numpad9, shift, ctrl, alt) => Some(("9", false, shift, ctrl, alt)),
|
(F17, _) => special("F17"),
|
||||||
(Keycode::Apps, _, _, _) => unsupported_key(Keycode::Apps),
|
(F18, _) => special("F18"),
|
||||||
(Keycode::Power, _, _, _) => unsupported_key(Keycode::Power),
|
(F19, _) => special("F19"),
|
||||||
(Keycode::F13, shift, ctrl, alt) => Some(("F13", true, shift, ctrl, alt)),
|
(F20, _) => special("F20"),
|
||||||
(Keycode::F14, shift, ctrl, alt) => Some(("F14", true, shift, ctrl, alt)),
|
(F21, _) => special("F21"),
|
||||||
(Keycode::F15, shift, ctrl, alt) => Some(("F15", true, shift, ctrl, alt)),
|
(F22, _) => special("F22"),
|
||||||
(Keycode::F16, shift, ctrl, alt) => Some(("F16", true, shift, ctrl, alt)),
|
(F23, _) => special("F23"),
|
||||||
(Keycode::F17, shift, ctrl, alt) => Some(("F17", true, shift, ctrl, alt)),
|
(F24, _) => special("F24"),
|
||||||
(Keycode::F18, shift, ctrl, alt) => Some(("F18", true, shift, ctrl, alt)),
|
(LControl, _) => None,
|
||||||
(Keycode::F19, shift, ctrl, alt) => Some(("F19", true, shift, ctrl, alt)),
|
(LShift, _) => None,
|
||||||
(Keycode::F20, shift, ctrl, alt) => Some(("F20", true, shift, ctrl, alt)),
|
(LAlt, _) => None,
|
||||||
(Keycode::F21, shift, ctrl, alt) => Some(("F21", true, shift, ctrl, alt)),
|
(RControl, _) => None,
|
||||||
(Keycode::F22, shift, ctrl, alt) => Some(("F22", true, shift, ctrl, alt)),
|
(RShift, _) => None,
|
||||||
(Keycode::F23, shift, ctrl, alt) => Some(("F23", true, shift, ctrl, alt)),
|
(RAlt, _) => None,
|
||||||
(Keycode::F24, shift, ctrl, alt) => Some(("F24", true, shift, ctrl, alt)),
|
(keycode, _) => unsupported_key(keycode),
|
||||||
(Keycode::Cut, _, _, _) => unsupported_key(Keycode::Cut),
|
|
||||||
(Keycode::Copy, _, _, _) => unsupported_key(Keycode::Copy),
|
|
||||||
(Keycode::Paste, _, _, _) => unsupported_key(Keycode::Paste),
|
|
||||||
(Keycode::Mute, _, _, _) => unsupported_key(Keycode::Mute),
|
|
||||||
(Keycode::VolumeUp, _, _, _) => unsupported_key(Keycode::VolumeUp),
|
|
||||||
(Keycode::VolumeDown, _, _, _) => unsupported_key(Keycode::VolumeDown),
|
|
||||||
(Keycode::Sysrq, _, _, _) => unsupported_key(Keycode::Sysrq),
|
|
||||||
(Keycode::LControl, _, _, _) => None,
|
|
||||||
(Keycode::LShift, _, _, _) => None,
|
|
||||||
(Keycode::LAlt, _, _, _) => None,
|
|
||||||
(Keycode::RControl, _, _, _) => None,
|
|
||||||
(Keycode::RShift, _, _, _) => None,
|
|
||||||
(Keycode::RAlt, _, _, _) => None,
|
|
||||||
(Keycode::MediaStop, _, _, _) => unsupported_key(Keycode::MediaStop),
|
|
||||||
(Keycode::MediaSelect, _, _, _) => unsupported_key(Keycode::MediaSelect),
|
|
||||||
(Keycode::Calculator, _, _, _) => unsupported_key(Keycode::Calculator),
|
|
||||||
(Keycode::MyComputer, _, _, _) => unsupported_key(Keycode::MyComputer),
|
|
||||||
(Keycode::WebSearch, _, _, _) => unsupported_key(Keycode::WebSearch),
|
|
||||||
(Keycode::WebHome, _, _, _) => unsupported_key(Keycode::WebHome),
|
|
||||||
(Keycode::WebBack, _, _, _) => unsupported_key(Keycode::WebBack),
|
|
||||||
(Keycode::WebForward, _, _, _) => unsupported_key(Keycode::WebForward),
|
|
||||||
(Keycode::NavigateBackward, _, _, _) => unsupported_key(Keycode::NavigateBackward),
|
|
||||||
(Keycode::NavigateForward, _, _, _) => unsupported_key(Keycode::NavigateForward),
|
|
||||||
(Keycode::WebStop, _, _, _) => unsupported_key(Keycode::WebStop),
|
|
||||||
(Keycode::WebRefresh, _, _, _) => unsupported_key(Keycode::WebRefresh),
|
|
||||||
(Keycode::Sleep, _, _, _) => unsupported_key(Keycode::Sleep),
|
|
||||||
_ => None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue