Disable keyboard listen
This commit is contained in:
		
							parent
							
								
									a505b73a56
								
							
						
					
					
						commit
						675e199b35
					
				| @ -4,7 +4,7 @@ use std::{ | ||||
|     ops::{Deref, Not}, | ||||
|     sync::{atomic::AtomicBool, mpsc, Arc, Mutex, RwLock}, | ||||
| }; | ||||
| 
 | ||||
| use std::sync::atomic::Ordering; | ||||
| pub use async_trait::async_trait; | ||||
| #[cfg(not(any(target_os = "android", target_os = "linux")))] | ||||
| use cpal::{ | ||||
| @ -1891,3 +1891,7 @@ fn decode_id_pk(signed: &[u8], key: &sign::PublicKey) -> ResultType<(String, [u8 | ||||
|         bail!("Wrong public length"); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub fn disable_keyboard_listening() { | ||||
|     crate::ui_session_interface::KEYBOARD_HOOKED.store(false, Ordering::SeqCst); | ||||
| } | ||||
| @ -328,6 +328,7 @@ pub fn session_start_(id: &str, event_stream: StreamSink<EventToUI>) -> ResultTy | ||||
|         *session.event_stream.write().unwrap() = Some(event_stream); | ||||
|         let session = session.clone(); | ||||
|         std::thread::spawn(move || { | ||||
|             crate::client::disable_keyboard_listening(); | ||||
|             io_loop(session); | ||||
|         }); | ||||
|         Ok(()) | ||||
|  | ||||
| @ -22,7 +22,7 @@ use std::sync::{Arc, Mutex, RwLock}; | ||||
| 
 | ||||
| /// IS_IN KEYBOARD_HOOKED sciter only
 | ||||
| pub static IS_IN: AtomicBool = AtomicBool::new(false); | ||||
| static KEYBOARD_HOOKED: AtomicBool = AtomicBool::new(false); | ||||
| pub static KEYBOARD_HOOKED: AtomicBool = AtomicBool::new(true); | ||||
| 
 | ||||
| #[cfg(windows)] | ||||
| static mut IS_ALT_GR: bool = false; | ||||
| @ -1166,7 +1166,7 @@ impl<T: InvokeUiSession> Session<T> { | ||||
|         if self.is_port_forward() || self.is_file_transfer() { | ||||
|             return; | ||||
|         } | ||||
|         if KEYBOARD_HOOKED.swap(true, Ordering::SeqCst) { | ||||
|         if !KEYBOARD_HOOKED.load(Ordering::SeqCst){ | ||||
|             return; | ||||
|         } | ||||
|         log::info!("keyboard hooked"); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user