working on keysym

This commit is contained in:
open-trade
2022-01-07 18:03:55 +08:00
parent 9df1fcb783
commit 26d161f827
7 changed files with 48 additions and 12 deletions

View File

@@ -418,6 +418,8 @@ pub enum Key {
Layout(char),
/// raw keycode eg 0x38
Raw(u16),
/// VNC keysym
KeySym(u32),
}
/// Representing an interface and a set of keyboard functions every

View File

@@ -181,6 +181,9 @@ impl MouseControllable for Enigo {
}
}
fn keysequence<'a>(key: Key) -> Cow<'a, str> {
if let Key::KeySym(sym) = key {
return Cow::Owned("");
}
if let Key::Layout(c) = key {
return Cow::Owned(format!("U{:X}", c as u32));
}

View File

@@ -426,6 +426,7 @@ impl Enigo {
Key::Raw(raw_keycode) => raw_keycode,
Key::Layout(c) => self.map_key_board(c),
Key::KeySym(sym) => 0 as _,
Key::Super | Key::Command | Key::Windows | Key::Meta => kVK_Command,
_ => 0,

View File

@@ -340,6 +340,7 @@ impl Enigo {
Key::Raw(raw_keycode) => raw_keycode,
Key::Layout(c) => self.get_layoutdependent_keycode(c.to_string()),
Key::Super | Key::Command | Key::Windows | Key::Meta => EVK_LWIN,
Key::KeySym(sym) => 0,
}
}