tmp commit, for debug

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-01 19:30:22 +08:00
parent ae53ec877b
commit 021939a6a6
2 changed files with 14 additions and 10 deletions

View File

@@ -1,8 +1,6 @@
use super::*;
#[cfg(target_os = "linux")]
use crate::common::IS_X11;
#[cfg(target_os = "windows")]
use crate::platform::windows::get_char_from_unicode;
#[cfg(target_os = "macos")]
use dispatch::Queue;
use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable};
@@ -1294,13 +1292,12 @@ fn translate_keyboard_mode(evt: &KeyEvent) {
#[cfg(target_os = "windows")]
fn simulate_win2win_hotkey(code: u32, down: bool) {
let mut simulated = false;
let unicode: u16 = (code & 0x0000FFFF) as u16;
if unicode != 0 {
if down {
// Try convert unicode to virtual keycode first.
// https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-vkkeyscanw
let res = unsafe { winapi::um::winuser::VkKeyScanW(unicode) };
println!("REMOVE ME =============================== VkKeyScanW {} {}", unicode, res);
if res as u16 != 0xFFFF {
let vk = res & 0x00FF;
let flag = res >> 8;
@@ -1319,14 +1316,13 @@ fn simulate_win2win_hotkey(code: u32, down: bool) {
allow_err!(rdev::simulate(&EventType::KeyRelease(modifiers[rpos])));
}
}
simulated = true;
return;
}
}
if simulated {
let keycode: u16 = ((code >> 16) & 0x0000FFFF) as u16;
allow_err!(rdev::simulate_code(Some(keycode), None, down));
}
let keycode: u16 = ((code >> 16) & 0x0000FFFF) as u16;
println!("REMOVE ME =============================== simulate_win2win_hotkey down {} {},{}", down, unicode, keycode);
allow_err!(rdev::simulate_code(Some(keycode), None, down));
}
pub fn handle_key_(evt: &KeyEvent) {