From 90b36795ea7545254fdda34cfdfeb9c51d08bd61 Mon Sep 17 00:00:00 2001 From: Asura Date: Tue, 2 Aug 2022 10:48:56 -0700 Subject: [PATCH] Listening for char in Linux --- Cargo.lock | 5 +++-- src/ui/remote.rs | 12 +++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24418f0a5..af872e57d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/asur4s/rdev#c1175a394d811473e87ea79cb9a511a0f9b71764" +source = "git+https://github.com/asur4s/rdev#d6499d2e582bf3549aa4ba33cfd3fbbdfce10947" dependencies = [ "cocoa", "core-foundation 0.9.3", @@ -4760,10 +4760,11 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tfc" 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 = [ "core-graphics 0.22.3", "unicode-segmentation", + "winapi 0.3.9", ] [[package]] diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 203a20614..994cd04b2 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1034,10 +1034,10 @@ impl Handler { } } - fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, evt: Option) { + fn map_keyboard_mode(&mut self, down_or_up: bool, key: RdevKey, _evt: Option) { // map mode(1): Send keycode according to the peer platform. #[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) } else { key @@ -1080,13 +1080,7 @@ impl Handler { #[cfg(target_os = "windows")] let is_dead = keyboard.last_is_dead; #[cfg(target_os = "linux")] - let is_dead = unsafe { - CStr::from_ptr(XKeysymToString(*keyboard.keysym)) - .to_str() - .unwrap_or_default() - .to_owned() - .starts_with("dead") - }; + let is_dead = keyboard.is_dead(); if is_dead && string == "" { return; }