Add translte mode in input_service
This commit is contained in:
		
							parent
							
								
									d08931c317
								
							
						
					
					
						commit
						25525cda3f
					
				
							
								
								
									
										110
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										110
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -638,21 +638,6 @@ dependencies = [ | ||||
|  "cc", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "cocoa" | ||||
| version = "0.22.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "667fdc068627a2816b9ff831201dd9864249d6ee8d190b9532357f1fc0f61ea7" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "block", | ||||
|  "core-foundation 0.9.3", | ||||
|  "core-graphics 0.21.0", | ||||
|  "foreign-types", | ||||
|  "libc", | ||||
|  "objc", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "cocoa" | ||||
| version = "0.24.0" | ||||
| @ -770,18 +755,6 @@ dependencies = [ | ||||
|  "libc", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "core-graphics" | ||||
| version = "0.21.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "52a67c4378cf203eace8fb6567847eb641fd6ff933c1145a115c6ee820ebb978" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "core-foundation 0.9.3", | ||||
|  "foreign-types", | ||||
|  "libc", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "core-graphics" | ||||
| version = "0.22.3" | ||||
| @ -1336,6 +1309,16 @@ dependencies = [ | ||||
|  "termcolor", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "epoll" | ||||
| version = "4.3.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "libc", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "err-derive" | ||||
| version = "0.3.1" | ||||
| @ -1370,6 +1353,29 @@ dependencies = [ | ||||
|  "nix 0.23.1", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "evdev-rs" | ||||
| version = "0.5.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "d7db51abf6b3205a6e6e8dd68d7a5414d7c50d61736a6f4c9b97df86ef5567cf" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "evdev-sys", | ||||
|  "libc", | ||||
|  "log", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "evdev-sys" | ||||
| version = "0.2.5" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "14ead42b547b15d47089c1243d907bcf0eb94e457046d3b315a26ac9c9e9ea6d" | ||||
| dependencies = [ | ||||
|  "cc", | ||||
|  "libc", | ||||
|  "pkg-config", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "event-listener" | ||||
| version = "2.5.2" | ||||
| @ -2342,6 +2348,28 @@ dependencies = [ | ||||
|  "hashbrown", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "inotify" | ||||
| version = "0.10.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "abf888f9575c290197b2c948dc9e9ff10bd1a39ad1ea8585f734585fa6b9d3f9" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "futures-core", | ||||
|  "inotify-sys", | ||||
|  "libc", | ||||
|  "tokio", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "inotify-sys" | ||||
| version = "0.1.5" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" | ||||
| dependencies = [ | ||||
|  "libc", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "instant" | ||||
| version = "0.1.12" | ||||
| @ -3767,15 +3795,19 @@ dependencies = [ | ||||
| [[package]] | ||||
| name = "rdev" | ||||
| version = "0.5.0-2" | ||||
| source = "git+https://github.com/asur4s/rdev#548d1194dd6863ab004d59299b995eb64cf21c3d" | ||||
| source = "git+https://github.com/asur4s/rdev#c3a896bcb4a10d171dee1aa685c90abadf8946d2" | ||||
| dependencies = [ | ||||
|  "cocoa 0.22.0", | ||||
|  "core-foundation 0.7.0", | ||||
|  "core-foundation-sys 0.7.0", | ||||
|  "core-graphics 0.19.2", | ||||
|  "cocoa", | ||||
|  "core-foundation 0.9.3", | ||||
|  "core-foundation-sys 0.8.3", | ||||
|  "core-graphics 0.22.3", | ||||
|  "enum-map", | ||||
|  "epoll", | ||||
|  "evdev-rs", | ||||
|  "inotify", | ||||
|  "lazy_static", | ||||
|  "libc", | ||||
|  "widestring 1.0.2", | ||||
|  "winapi 0.3.9", | ||||
|  "x11", | ||||
| ] | ||||
| @ -3994,7 +4026,7 @@ dependencies = [ | ||||
|  "cfg-if 1.0.0", | ||||
|  "clap 3.2.12", | ||||
|  "clipboard", | ||||
|  "cocoa 0.24.0", | ||||
|  "cocoa", | ||||
|  "core-foundation 0.9.3", | ||||
|  "core-graphics 0.22.3", | ||||
|  "cpal", | ||||
| @ -4936,7 +4968,7 @@ version = "0.7.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "76863575f7842ed64fda361f417a787efa82811b4617267709066969cd4ccf3b" | ||||
| dependencies = [ | ||||
|  "cocoa 0.24.0", | ||||
|  "cocoa", | ||||
|  "core-graphics 0.22.3", | ||||
|  "gtk", | ||||
|  "libappindicator", | ||||
| @ -5348,6 +5380,12 @@ version = "0.4.3" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "widestring" | ||||
| version = "1.0.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "winapi" | ||||
| version = "0.2.8" | ||||
| @ -5421,7 +5459,7 @@ checksum = "0c643e10139d127d30d6d753398c8a6f0a43532e8370f6c9d29ebbff29b984ab" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "err-derive", | ||||
|  "widestring", | ||||
|  "widestring 0.4.3", | ||||
|  "winapi 0.3.9", | ||||
| ] | ||||
| 
 | ||||
| @ -5548,7 +5586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" | ||||
| dependencies = [ | ||||
|  "bitflags", | ||||
|  "cocoa 0.24.0", | ||||
|  "cocoa", | ||||
|  "core-foundation 0.9.3", | ||||
|  "core-graphics 0.22.3", | ||||
|  "core-video-sys", | ||||
|  | ||||
| @ -156,7 +156,6 @@ impl KeyboardControllable for Enigo { | ||||
|     } | ||||
|     fn key_up(&mut self, key: Key) { | ||||
|         if self.is_x11 { | ||||
|             dbg!(key); | ||||
|             if self.pynput.send_pynput(&key, false) { | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @ -819,6 +819,11 @@ fn legacy_keyboard_mode(evt: &KeyEvent) { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| fn translate_keyboard_mode(evt: &KeyEvent) { | ||||
|     dbg!(evt.chr()); | ||||
|     let chr = char::from_u32(evt.chr()).unwrap_or_default(); | ||||
|     rdev::simulate_char(chr, evt.down); | ||||
| } | ||||
| 
 | ||||
| fn handle_key_(evt: &KeyEvent) { | ||||
|     if EXITING.load(Ordering::SeqCst) { | ||||
| @ -832,6 +837,9 @@ fn handle_key_(evt: &KeyEvent) { | ||||
|         KeyboardMode::Map => { | ||||
|             map_keyboard_mode(evt); | ||||
|         } | ||||
|         KeyboardMode::Translate => { | ||||
|             translate_keyboard_mode(evt); | ||||
|         } | ||||
|         _ => { | ||||
|             legacy_keyboard_mode(evt); | ||||
|         } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user