macos, win, translate mode,
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
		
							parent
							
								
									e24f5e7eed
								
							
						
					
					
						commit
						50ce57024c
					
				| @ -787,6 +787,7 @@ fn is_hot_key_modifiers_down() -> bool { | ||||
| 
 | ||||
| pub fn translate_vk_scan_code(event: &Event, mut key_event: KeyEvent) -> Option<KeyEvent> { | ||||
|     let mut key_event = map_keyboard_mode(event, key_event)?; | ||||
|     #[cfg(target_os = "windows")] | ||||
|     key_event.set_chr((key_event.chr() & 0x0000FFFF) | ((event.code as u32) << 16)); | ||||
|     Some(key_event) | ||||
| } | ||||
|  | ||||
| @ -1082,9 +1082,14 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { | ||||
| } | ||||
| 
 | ||||
| #[cfg(target_os = "windows")] | ||||
| fn translate_process_virtual_keycode(vk: u32, down: bool) { | ||||
| fn translate_process_code(code: u32, down: bool) { | ||||
|     crate::platform::windows::try_change_desktop(); | ||||
|     sim_rdev_rawkey_virtual(vk, down); | ||||
|     let vk_code = 
 | ||||
| 
 | ||||
|     match code >> 16 { | ||||
|         0 => sim_rdev_rawkey_position(code, down), | ||||
|         vk_code => sim_rdev_rawkey_virtual(vk_code, down), | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| fn translate_keyboard_mode(evt: &KeyEvent) { | ||||
| @ -1095,7 +1100,9 @@ fn translate_keyboard_mode(evt: &KeyEvent) { | ||||
|         Some(key_event::Union::Chr(..)) => | ||||
|         { | ||||
|             #[cfg(target_os = "windows")] | ||||
|             translate_process_virtual_keycode(evt.chr(), evt.down) | ||||
|             translate_process_code(evt.chr(), evt.down); | ||||
|             #[cfg(not(target_os = "windows"))] | ||||
|             sim_rdev_rawkey_position(code, down); | ||||
|         } | ||||
|         Some(key_event::Union::Unicode(..)) => { | ||||
|             // Do not handle unicode for now.
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user