Fix simulate in wayland
This commit is contained in:
		
							parent
							
								
									15b8a5592d
								
							
						
					
					
						commit
						bec8daafb9
					
				@ -49,7 +49,7 @@ packages:
 | 
				
			|||||||
      name: async
 | 
					      name: async
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "2.8.2"
 | 
					    version: "2.9.0"
 | 
				
			||||||
  back_button_interceptor:
 | 
					  back_button_interceptor:
 | 
				
			||||||
    dependency: "direct main"
 | 
					    dependency: "direct main"
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -147,7 +147,7 @@ packages:
 | 
				
			|||||||
      name: characters
 | 
					      name: characters
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.2.0"
 | 
					    version: "1.2.1"
 | 
				
			||||||
  charcode:
 | 
					  charcode:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -168,7 +168,7 @@ packages:
 | 
				
			|||||||
      name: clock
 | 
					      name: clock
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.1.0"
 | 
					    version: "1.1.1"
 | 
				
			||||||
  code_builder:
 | 
					  code_builder:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -324,7 +324,7 @@ packages:
 | 
				
			|||||||
      name: fake_async
 | 
					      name: fake_async
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.3.0"
 | 
					    version: "1.3.1"
 | 
				
			||||||
  ffi:
 | 
					  ffi:
 | 
				
			||||||
    dependency: "direct main"
 | 
					    dependency: "direct main"
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -621,14 +621,14 @@ packages:
 | 
				
			|||||||
      name: matcher
 | 
					      name: matcher
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "0.12.11"
 | 
					    version: "0.12.12"
 | 
				
			||||||
  material_color_utilities:
 | 
					  material_color_utilities:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
      name: material_color_utilities
 | 
					      name: material_color_utilities
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "0.1.4"
 | 
					    version: "0.1.5"
 | 
				
			||||||
  menu_base:
 | 
					  menu_base:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -642,7 +642,7 @@ packages:
 | 
				
			|||||||
      name: meta
 | 
					      name: meta
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.7.0"
 | 
					    version: "1.8.0"
 | 
				
			||||||
  mime:
 | 
					  mime:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -719,7 +719,7 @@ packages:
 | 
				
			|||||||
      name: path
 | 
					      name: path
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.8.1"
 | 
					    version: "1.8.2"
 | 
				
			||||||
  path_provider:
 | 
					  path_provider:
 | 
				
			||||||
    dependency: "direct main"
 | 
					    dependency: "direct main"
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -856,9 +856,11 @@ packages:
 | 
				
			|||||||
  screen_retriever:
 | 
					  screen_retriever:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
      name: screen_retriever
 | 
					      path: "."
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      ref: "406b9b0"
 | 
				
			||||||
    source: hosted
 | 
					      resolved-ref: "406b9b038b2c1d779f1e7bf609c8c248be247372"
 | 
				
			||||||
 | 
					      url: "https://github.com/Kingtous/rustdesk_screen_retriever.git"
 | 
				
			||||||
 | 
					    source: git
 | 
				
			||||||
    version: "0.1.2"
 | 
					    version: "0.1.2"
 | 
				
			||||||
  scroll_pos:
 | 
					  scroll_pos:
 | 
				
			||||||
    dependency: "direct main"
 | 
					    dependency: "direct main"
 | 
				
			||||||
@ -969,7 +971,7 @@ packages:
 | 
				
			|||||||
      name: source_span
 | 
					      name: source_span
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.8.2"
 | 
					    version: "1.9.0"
 | 
				
			||||||
  sqflite:
 | 
					  sqflite:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -1011,7 +1013,7 @@ packages:
 | 
				
			|||||||
      name: string_scanner
 | 
					      name: string_scanner
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.1.0"
 | 
					    version: "1.1.1"
 | 
				
			||||||
  synchronized:
 | 
					  synchronized:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -1025,14 +1027,14 @@ packages:
 | 
				
			|||||||
      name: term_glyph
 | 
					      name: term_glyph
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "1.2.0"
 | 
					    version: "1.2.1"
 | 
				
			||||||
  test_api:
 | 
					  test_api:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
      name: test_api
 | 
					      name: test_api
 | 
				
			||||||
      url: "https://pub.flutter-io.cn"
 | 
					      url: "https://pub.flutter-io.cn"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "0.4.9"
 | 
					    version: "0.4.12"
 | 
				
			||||||
  timing:
 | 
					  timing:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -1242,11 +1244,11 @@ packages:
 | 
				
			|||||||
    dependency: "direct main"
 | 
					    dependency: "direct main"
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
      path: "."
 | 
					      path: "."
 | 
				
			||||||
      ref: "799ef079e87938c3f4340591b4330c2598f38bb9"
 | 
					      ref: "4627ba808ed08ff0c08706b01a7f9cc8b747accd"
 | 
				
			||||||
      resolved-ref: "799ef079e87938c3f4340591b4330c2598f38bb9"
 | 
					      resolved-ref: "4627ba808ed08ff0c08706b01a7f9cc8b747accd"
 | 
				
			||||||
      url: "https://github.com/Kingtous/rustdesk_window_manager"
 | 
					      url: "https://github.com/Kingtous/rustdesk_window_manager"
 | 
				
			||||||
    source: git
 | 
					    source: git
 | 
				
			||||||
    version: "0.2.6"
 | 
					    version: "0.2.7"
 | 
				
			||||||
  xdg_directories:
 | 
					  xdg_directories:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
 | 
				
			|||||||
@ -58,7 +58,7 @@ dependencies:
 | 
				
			|||||||
    window_manager:
 | 
					    window_manager:
 | 
				
			||||||
        git:
 | 
					        git:
 | 
				
			||||||
            url: https://github.com/Kingtous/rustdesk_window_manager
 | 
					            url: https://github.com/Kingtous/rustdesk_window_manager
 | 
				
			||||||
            ref: 799ef079e87938c3f4340591b4330c2598f38bb9
 | 
					            ref: 4627ba808ed08ff0c08706b01a7f9cc8b747accd
 | 
				
			||||||
    desktop_multi_window:
 | 
					    desktop_multi_window:
 | 
				
			||||||
        git:
 | 
					        git:
 | 
				
			||||||
            url: https://github.com/Kingtous/rustdesk_desktop_multi_window
 | 
					            url: https://github.com/Kingtous/rustdesk_desktop_multi_window
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,9 @@
 | 
				
			|||||||
use crate::ResultType;
 | 
					use crate::ResultType;
 | 
				
			||||||
 | 
					use std::sync::Mutex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					lazy_static::lazy_static! {
 | 
				
			||||||
 | 
					    pub static ref IS_X11: Mutex<bool> = Mutex::new("x11" == get_display_server());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn get_display_server() -> String {
 | 
					pub fn get_display_server() -> String {
 | 
				
			||||||
    let session = get_value_of_seat0(0);
 | 
					    let session = get_value_of_seat0(0);
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@ use super::*;
 | 
				
			|||||||
#[cfg(target_os = "macos")]
 | 
					#[cfg(target_os = "macos")]
 | 
				
			||||||
use dispatch::Queue;
 | 
					use dispatch::Queue;
 | 
				
			||||||
use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable};
 | 
					use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable};
 | 
				
			||||||
 | 
					use hbb_common::platform::linux::IS_X11;
 | 
				
			||||||
use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown};
 | 
					use hbb_common::{config::COMPRESS_LEVEL, protobuf::EnumOrUnknown};
 | 
				
			||||||
use rdev::{simulate, EventType, Key as RdevKey};
 | 
					use rdev::{simulate, EventType, Key as RdevKey};
 | 
				
			||||||
use std::{
 | 
					use std::{
 | 
				
			||||||
@ -673,13 +674,13 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) {
 | 
				
			|||||||
    if let Key::Layout(chr) = key {
 | 
					    if let Key::Layout(chr) = key {
 | 
				
			||||||
        log::info!("tfc_key_down_or_up :{:?}", chr);
 | 
					        log::info!("tfc_key_down_or_up :{:?}", chr);
 | 
				
			||||||
        if down {
 | 
					        if down {
 | 
				
			||||||
            if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){
 | 
					            if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr) {
 | 
				
			||||||
                log::error!("Failed to press char {:?}", chr);
 | 
					                log::error!("Failed to press char {:?}", chr);
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if up {
 | 
					        if up {
 | 
				
			||||||
            if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr){
 | 
					            if let Err(_) = TFC_CONTEXT.lock().unwrap().unicode_char_down(chr) {
 | 
				
			||||||
                log::error!("Failed to press char {:?}",chr);
 | 
					                log::error!("Failed to press char {:?}", chr);
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@ -753,12 +754,12 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    log::info!("tfc_key_down_or_up: {:?}", key);
 | 
					    log::info!("tfc_key_down_or_up: {:?}", key);
 | 
				
			||||||
    if down {
 | 
					    if down {
 | 
				
			||||||
        if let Err(_) = TFC_CONTEXT.lock().unwrap().key_down(key){
 | 
					        if let Err(_) = TFC_CONTEXT.lock().unwrap().key_down(key) {
 | 
				
			||||||
            log::error!("Failed to press char {:?}", key);
 | 
					            log::error!("Failed to press char {:?}", key);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if up {
 | 
					    if up {
 | 
				
			||||||
        if let Err(_) = TFC_CONTEXT.lock().unwrap().key_up(key){
 | 
					        if let Err(_) = TFC_CONTEXT.lock().unwrap().key_up(key) {
 | 
				
			||||||
            log::error!("Failed to press char {:?}", key);
 | 
					            log::error!("Failed to press char {:?}", key);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -771,16 +772,18 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
 | 
				
			|||||||
    crate::platform::windows::try_change_desktop();
 | 
					    crate::platform::windows::try_change_desktop();
 | 
				
			||||||
    let mut en = ENIGO.lock().unwrap();
 | 
					    let mut en = ENIGO.lock().unwrap();
 | 
				
			||||||
    if click_capslock {
 | 
					    if click_capslock {
 | 
				
			||||||
        #[cfg(target_os = "linux")]
 | 
					        if *IS_X11.lock().unwrap() {
 | 
				
			||||||
        tfc_key_down_or_up(Key::CapsLock, true, true);
 | 
					            tfc_key_down_or_up(Key::CapsLock, true, true);
 | 
				
			||||||
        #[cfg(not(target_os = "linux"))]
 | 
					        } else {
 | 
				
			||||||
        en.key_click(Key::CapsLock);
 | 
					            en.key_click(Key::CapsLock);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if click_numlock {
 | 
					    if click_numlock {
 | 
				
			||||||
        #[cfg(target_os = "linux")]
 | 
					        if *IS_X11.lock().unwrap() {
 | 
				
			||||||
        tfc_key_down_or_up(Key::NumLock, true, true);
 | 
					            tfc_key_down_or_up(Key::NumLock, true, true);
 | 
				
			||||||
        #[cfg(not(target_os = "linux"))]
 | 
					        } else {
 | 
				
			||||||
        en.key_click(Key::NumLock);
 | 
					            en.key_click(Key::NumLock);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // disable numlock if press home etc when numlock is on,
 | 
					    // disable numlock if press home etc when numlock is on,
 | 
				
			||||||
    // because we will get numpad value (7,8,9 etc) if not
 | 
					    // because we will get numpad value (7,8,9 etc) if not
 | 
				
			||||||
@ -834,10 +837,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        if !get_modifier_state(key.clone(), &mut en) {
 | 
					                        if !get_modifier_state(key.clone(), &mut en) {
 | 
				
			||||||
                            #[cfg(target_os = "linux")]
 | 
					                            if *IS_X11.lock().unwrap() {
 | 
				
			||||||
                            tfc_key_down_or_up(key.clone(), true, false);
 | 
					                                tfc_key_down_or_up(key.clone(), true, false);
 | 
				
			||||||
                            #[cfg(not(target_os = "linux"))]
 | 
					                            } else {
 | 
				
			||||||
                            en.key_down(key.clone()).ok();
 | 
					                                en.key_down(key.clone()).ok();
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                            modifier_sleep();
 | 
					                            modifier_sleep();
 | 
				
			||||||
                            to_release.push(key);
 | 
					                            to_release.push(key);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@ -848,12 +852,12 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    #[cfg(not(target_os = "macos"))]
 | 
					    #[cfg(not(target_os = "macos"))]
 | 
				
			||||||
    if has_cap != en.get_key_state(Key::CapsLock) {
 | 
					    if has_cap != en.get_key_state(Key::CapsLock) {
 | 
				
			||||||
        #[cfg(target_os = "linux")]
 | 
					        if *IS_X11.lock().unwrap() {
 | 
				
			||||||
        tfc_key_down_or_up(Key::CapsLock, true, true);
 | 
					            tfc_key_down_or_up(Key::CapsLock, true, true);
 | 
				
			||||||
        #[cfg(not(target_os = "linux"))]
 | 
					        } else {
 | 
				
			||||||
        en.key_down(Key::CapsLock).ok();
 | 
					            en.key_down(Key::CapsLock).ok();
 | 
				
			||||||
        #[cfg(not(target_os = "linux"))]
 | 
					            en.key_up(Key::CapsLock);
 | 
				
			||||||
        en.key_up(Key::CapsLock);
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    #[cfg(windows)]
 | 
					    #[cfg(windows)]
 | 
				
			||||||
    if crate::common::valid_for_numlock(evt) {
 | 
					    if crate::common::valid_for_numlock(evt) {
 | 
				
			||||||
@ -874,19 +878,21 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if evt.down {
 | 
					                if evt.down {
 | 
				
			||||||
                    #[cfg(target_os = "linux")]
 | 
					                    if *IS_X11.lock().unwrap() {
 | 
				
			||||||
                    tfc_key_down_or_up(key.clone(), true, false);
 | 
					                        tfc_key_down_or_up(key.clone(), true, false);
 | 
				
			||||||
                    #[cfg(not(target_os = "linux"))]
 | 
					                    } else {
 | 
				
			||||||
                    allow_err!(en.key_down(key.clone()));
 | 
					                        allow_err!(en.key_down(key.clone()));
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    KEYS_DOWN
 | 
					                    KEYS_DOWN
 | 
				
			||||||
                        .lock()
 | 
					                        .lock()
 | 
				
			||||||
                        .unwrap()
 | 
					                        .unwrap()
 | 
				
			||||||
                        .insert(ck.value() as _, Instant::now());
 | 
					                        .insert(ck.value() as _, Instant::now());
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    #[cfg(target_os = "linux")]
 | 
					                    if *IS_X11.lock().unwrap() {
 | 
				
			||||||
                    tfc_key_down_or_up(key.clone(), false, true);
 | 
					                        tfc_key_down_or_up(key.clone(), false, true);
 | 
				
			||||||
                    #[cfg(not(target_os = "linux"))]
 | 
					                    } else {
 | 
				
			||||||
                    en.key_up(key.clone());
 | 
					                        en.key_up(key.clone());
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    KEYS_DOWN.lock().unwrap().remove(&(ck.value() as _));
 | 
					                    KEYS_DOWN.lock().unwrap().remove(&(ck.value() as _));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else if ck.value() == ControlKey::CtrlAltDel.value() {
 | 
					            } else if ck.value() == ControlKey::CtrlAltDel.value() {
 | 
				
			||||||
@ -900,35 +906,36 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        Some(key_event::Union::Chr(chr)) => {
 | 
					        Some(key_event::Union::Chr(chr)) => {
 | 
				
			||||||
            if evt.down {
 | 
					            if evt.down {
 | 
				
			||||||
                #[cfg(target_os = "linux")]
 | 
					                if *IS_X11.lock().unwrap() {
 | 
				
			||||||
                tfc_key_down_or_up(get_layout(chr), true, false);
 | 
					                    tfc_key_down_or_up(get_layout(chr), true, false);
 | 
				
			||||||
                #[cfg(target_os = "linux")]
 | 
					                } else {
 | 
				
			||||||
 | 
					                    if en.key_down(get_layout(chr)).is_ok() {
 | 
				
			||||||
 | 
					                        KEYS_DOWN
 | 
				
			||||||
 | 
					                            .lock()
 | 
				
			||||||
 | 
					                            .unwrap()
 | 
				
			||||||
 | 
					                            .insert(chr as u64 + KEY_CHAR_START, Instant::now());
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        if let Ok(chr) = char::try_from(chr) {
 | 
				
			||||||
 | 
					                            let mut x = chr.to_string();
 | 
				
			||||||
 | 
					                            if get_modifier_state(Key::Shift, &mut en)
 | 
				
			||||||
 | 
					                                || get_modifier_state(Key::CapsLock, &mut en)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                x = x.to_uppercase();
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            en.key_sequence(&x);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                KEYS_DOWN
 | 
					                KEYS_DOWN
 | 
				
			||||||
                    .lock()
 | 
					                    .lock()
 | 
				
			||||||
                    .unwrap()
 | 
					                    .unwrap()
 | 
				
			||||||
                    .insert(chr as u64 + KEY_CHAR_START, Instant::now());
 | 
					                    .insert(chr as u64 + KEY_CHAR_START, Instant::now());
 | 
				
			||||||
                #[cfg(not(target_os = "linux"))]
 | 
					 | 
				
			||||||
                if en.key_down(get_layout(chr)).is_ok() {
 | 
					 | 
				
			||||||
                    KEYS_DOWN
 | 
					 | 
				
			||||||
                        .lock()
 | 
					 | 
				
			||||||
                        .unwrap()
 | 
					 | 
				
			||||||
                        .insert(chr as u64 + KEY_CHAR_START, Instant::now());
 | 
					 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                    if let Ok(chr) = char::try_from(chr) {
 | 
					 | 
				
			||||||
                        let mut x = chr.to_string();
 | 
					 | 
				
			||||||
                        if get_modifier_state(Key::Shift, &mut en)
 | 
					 | 
				
			||||||
                            || get_modifier_state(Key::CapsLock, &mut en)
 | 
					 | 
				
			||||||
                        {
 | 
					 | 
				
			||||||
                            x = x.to_uppercase();
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        en.key_sequence(&x);
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                #[cfg(target_os = "linux")]
 | 
					                if *IS_X11.lock().unwrap() {
 | 
				
			||||||
                tfc_key_down_or_up(get_layout(chr), false, true);
 | 
					                    tfc_key_down_or_up(get_layout(chr), false, true);
 | 
				
			||||||
                #[cfg(not(target_os = "linux"))]
 | 
					                } else {
 | 
				
			||||||
                en.key_up(get_layout(chr));
 | 
					                    en.key_up(get_layout(chr));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                KEYS_DOWN
 | 
					                KEYS_DOWN
 | 
				
			||||||
                    .lock()
 | 
					                    .lock()
 | 
				
			||||||
                    .unwrap()
 | 
					                    .unwrap()
 | 
				
			||||||
@ -947,10 +954,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    #[cfg(not(target_os = "macos"))]
 | 
					    #[cfg(not(target_os = "macos"))]
 | 
				
			||||||
    for key in to_release {
 | 
					    for key in to_release {
 | 
				
			||||||
        #[cfg(target_os = "linux")]
 | 
					        if *IS_X11.lock().unwrap() {
 | 
				
			||||||
        tfc_key_down_or_up(key.clone(), false, true);
 | 
					            tfc_key_down_or_up(key.clone(), false, true);
 | 
				
			||||||
        #[cfg(not(target_os = "linux"))]
 | 
					        } else {
 | 
				
			||||||
        en.key_up(key.clone());
 | 
					            en.key_up(key.clone());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    #[cfg(windows)]
 | 
					    #[cfg(windows)]
 | 
				
			||||||
    if disable_numlock {
 | 
					    if disable_numlock {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user