Merge pull request #2959 from fufesou/fix/win_accent_shift_6

fix win, local detect some dead code
This commit is contained in:
RustDesk 2023-01-28 09:58:31 +08:00 committed by GitHub
commit 83b7e5761b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

2
Cargo.lock generated
View File

@ -4371,7 +4371,7 @@ dependencies = [
[[package]] [[package]]
name = "rdev" name = "rdev"
version = "0.5.0-2" version = "0.5.0-2"
source = "git+https://github.com/fufesou/rdev#1be26c7e8ed0d43cebdd8331d467bb61130a2e6e" source = "git+https://github.com/fufesou/rdev#238c9778da40056e2efda1e4264355bc89fb6358"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"core-foundation 0.9.3", "core-foundation 0.9.3",

View File

@ -245,8 +245,14 @@ pub fn session_get_keyboard_mode(id: String) -> Option<String> {
} }
pub fn session_set_keyboard_mode(id: String, value: String) { pub fn session_set_keyboard_mode(id: String, value: String) {
let mut _mode_updated = false;
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) { if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
session.save_keyboard_mode(value); session.save_keyboard_mode(value);
_mode_updated = true;
}
#[cfg(windows)]
if _mode_updated {
crate::keyboard::update_grab_get_key_name();
} }
} }
@ -1182,7 +1188,9 @@ pub fn main_update_me() -> SyncReturn<bool> {
} }
pub fn set_cur_session_id(id: String) { pub fn set_cur_session_id(id: String) {
super::flutter::set_cur_session_id(id) super::flutter::set_cur_session_id(id);
#[cfg(windows)]
crate::keyboard::update_grab_get_key_name();
} }
pub fn install_show_run_without_install() -> SyncReturn<bool> { pub fn install_show_run_without_install() -> SyncReturn<bool> {

View File

@ -64,6 +64,8 @@ pub mod client {
match state { match state {
GrabState::Ready => {} GrabState::Ready => {}
GrabState::Run => { GrabState::Run => {
#[cfg(windows)]
update_grab_get_key_name();
#[cfg(any(target_os = "windows", target_os = "macos"))] #[cfg(any(target_os = "windows", target_os = "macos"))]
KEYBOARD_HOOKED.swap(true, Ordering::SeqCst); KEYBOARD_HOOKED.swap(true, Ordering::SeqCst);
@ -184,6 +186,15 @@ pub mod client {
} }
} }
#[cfg(windows)]
pub fn update_grab_get_key_name() {
match get_keyboard_mode_enum() {
KeyboardMode::Map => rdev::set_get_key_name(false),
KeyboardMode::Translate => rdev::set_get_key_name(true),
_ => {}
};
}
pub fn start_grab_loop() { pub fn start_grab_loop() {
#[cfg(any(target_os = "windows", target_os = "macos"))] #[cfg(any(target_os = "windows", target_os = "macos"))]
std::thread::spawn(move || { std::thread::spawn(move || {