Listening for char in Linux

This commit is contained in:
Asura 2022-08-02 10:48:56 -07:00
parent 5dfc41a7b8
commit 90b36795ea
2 changed files with 6 additions and 11 deletions

5
Cargo.lock generated
View File

@ -3795,7 +3795,7 @@ dependencies = [
[[package]] [[package]]
name = "rdev" name = "rdev"
version = "0.5.0-2" version = "0.5.0-2"
source = "git+https://github.com/asur4s/rdev#c1175a394d811473e87ea79cb9a511a0f9b71764" source = "git+https://github.com/asur4s/rdev#d6499d2e582bf3549aa4ba33cfd3fbbdfce10947"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"core-foundation 0.9.3", "core-foundation 0.9.3",
@ -4760,10 +4760,11 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]] [[package]]
name = "tfc" name = "tfc"
version = "0.6.1" version = "0.6.1"
source = "git+https://github.com/asur4s/The-Fat-Controller#35ed0bc8dd8516bdb99e45ebfc94409637a92c6b" source = "git+https://github.com/asur4s/The-Fat-Controller#6587681075fa312a0d69587721d1ff84d8fa2970"
dependencies = [ dependencies = [
"core-graphics 0.22.3", "core-graphics 0.22.3",
"unicode-segmentation", "unicode-segmentation",
"winapi 0.3.9",
] ]
[[package]] [[package]]

View File

@ -1034,10 +1034,10 @@ impl Handler {
} }
} }
fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Option<Event>) { fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, _evt: Option<Event>) {
// map mode(1): Send keycode according to the peer platform. // map mode(1): Send keycode according to the peer platform.
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let key = if let Some(e) = evt { let key = if let Some(e) = _evt {
rdev::get_win_key(e.code.into(), e.scan_code) rdev::get_win_key(e.code.into(), e.scan_code)
} else { } else {
key key
@ -1080,13 +1080,7 @@ impl Handler {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let is_dead = keyboard.last_is_dead; let is_dead = keyboard.last_is_dead;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let is_dead = unsafe { let is_dead = keyboard.is_dead();
CStr::from_ptr(XKeysymToString(*keyboard.keysym))
.to_str()
.unwrap_or_default()
.to_owned()
.starts_with("dead")
};
if is_dead && string == "" { if is_dead && string == "" {
return; return;
} }