tmp commit, for debug
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
		
							parent
							
								
									ae53ec877b
								
							
						
					
					
						commit
						021939a6a6
					
				| @ -517,6 +517,11 @@ pub fn event_to_key_events( | |||||||
|         } |         } | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     println!( | ||||||
|  |         "REMOVE ME ==================================== key_events {:?}", | ||||||
|  |         &key_events | ||||||
|  |     ); | ||||||
|  | 
 | ||||||
|     #[cfg(not(any(target_os = "android", target_os = "ios")))] |     #[cfg(not(any(target_os = "android", target_os = "ios")))] | ||||||
|     if keyboard_mode != KeyboardMode::Translate { |     if keyboard_mode != KeyboardMode::Translate { | ||||||
|         let is_numpad_key = is_numpad_key(&event); |         let is_numpad_key = is_numpad_key(&event); | ||||||
| @ -893,8 +898,10 @@ fn try_file_win2win_hotkey( | |||||||
|     events: &mut Vec<KeyEvent>, |     events: &mut Vec<KeyEvent>, | ||||||
| ) { | ) { | ||||||
|     if peer == OS_LOWER_WINDOWS && is_hot_key_modifiers_down() && unsafe { !IS_0X021D_DOWN } { |     if peer == OS_LOWER_WINDOWS && is_hot_key_modifiers_down() && unsafe { !IS_0X021D_DOWN } { | ||||||
|  |         let mut down = false; | ||||||
|         let win2win_hotkey = match event.event_type { |         let win2win_hotkey = match event.event_type { | ||||||
|             EventType::KeyPress(..) => { |             EventType::KeyPress(..) => { | ||||||
|  |                 down = true; | ||||||
|                 if let Some(unicode) = get_unicode_from_vk(event.platform_code as u32) { |                 if let Some(unicode) = get_unicode_from_vk(event.platform_code as u32) { | ||||||
|                     Some((unicode as u32 & 0x0000FFFF) | (event.platform_code << 16)) |                     Some((unicode as u32 & 0x0000FFFF) | (event.platform_code << 16)) | ||||||
|                 } else { |                 } else { | ||||||
| @ -907,6 +914,7 @@ fn try_file_win2win_hotkey( | |||||||
|         if let Some(code) = win2win_hotkey { |         if let Some(code) = win2win_hotkey { | ||||||
|             let mut evt = key_event.clone(); |             let mut evt = key_event.clone(); | ||||||
|             evt.set_win2win_hotkey(code); |             evt.set_win2win_hotkey(code); | ||||||
|  |             evt.down = down; | ||||||
|             events.push(evt); |             events.push(evt); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,8 +1,6 @@ | |||||||
| use super::*; | use super::*; | ||||||
| #[cfg(target_os = "linux")] | #[cfg(target_os = "linux")] | ||||||
| use crate::common::IS_X11; | use crate::common::IS_X11; | ||||||
| #[cfg(target_os = "windows")] |  | ||||||
| use crate::platform::windows::get_char_from_unicode; |  | ||||||
| #[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}; | ||||||
| @ -1294,13 +1292,12 @@ fn translate_keyboard_mode(evt: &KeyEvent) { | |||||||
| 
 | 
 | ||||||
| #[cfg(target_os = "windows")] | #[cfg(target_os = "windows")] | ||||||
| fn simulate_win2win_hotkey(code: u32, down: bool) { | fn simulate_win2win_hotkey(code: u32, down: bool) { | ||||||
|     let mut simulated = false; |  | ||||||
| 
 |  | ||||||
|     let unicode: u16 = (code & 0x0000FFFF) as u16; |     let unicode: u16 = (code & 0x0000FFFF) as u16; | ||||||
|     if unicode != 0 { |     if down { | ||||||
|         // Try convert unicode to virtual keycode first.
 |         // Try convert unicode to virtual keycode first.
 | ||||||
|         // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-vkkeyscanw
 |         // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-vkkeyscanw
 | ||||||
|         let res = unsafe { winapi::um::winuser::VkKeyScanW(unicode) }; |         let res = unsafe { winapi::um::winuser::VkKeyScanW(unicode) }; | ||||||
|  |         println!("REMOVE ME =============================== VkKeyScanW {} {}", unicode, res); | ||||||
|         if res as u16 != 0xFFFF { |         if res as u16 != 0xFFFF { | ||||||
|             let vk = res & 0x00FF; |             let vk = res & 0x00FF; | ||||||
|             let flag = res >> 8; |             let flag = res >> 8; | ||||||
| @ -1319,15 +1316,14 @@ fn simulate_win2win_hotkey(code: u32, down: bool) { | |||||||
|                     allow_err!(rdev::simulate(&EventType::KeyRelease(modifiers[rpos]))); |                     allow_err!(rdev::simulate(&EventType::KeyRelease(modifiers[rpos]))); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             simulated = true; |             return; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if simulated { |  | ||||||
|     let keycode: u16 = ((code >> 16) & 0x0000FFFF) as u16; |     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)); |     allow_err!(rdev::simulate_code(Some(keycode), None, down)); | ||||||
| } | } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| pub fn handle_key_(evt: &KeyEvent) { | pub fn handle_key_(evt: &KeyEvent) { | ||||||
|     if EXITING.load(Ordering::SeqCst) { |     if EXITING.load(Ordering::SeqCst) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user