mirror of
https://github.com/mii443/vrclipboard-ime-gui.git
synced 2025-08-22 16:15:32 +00:00
add tsf availability check
This commit is contained in:
24
src-tauri/src/tsf_availability.rs
Normal file
24
src-tauri/src/tsf_availability.rs
Normal file
@ -0,0 +1,24 @@
|
||||
use anyhow::Result;
|
||||
use tracing::{error, info};
|
||||
|
||||
use crate::tsf::{search_candidate_provider::SearchCandidateProvider, set_thread_local_input_settings};
|
||||
|
||||
pub fn check_tsf_availability() -> Result<bool> {
|
||||
info!("Checking TSF availability");
|
||||
|
||||
if let Err(e) = set_thread_local_input_settings(true) {
|
||||
error!("Failed to set thread local input settings: {:?}", e);
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
match SearchCandidateProvider::create() {
|
||||
Ok(_) => {
|
||||
info!("TSF is available");
|
||||
Ok(true)
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Failed to create SearchCandidateProvider: {:?}", e);
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user