fix format

This commit is contained in:
chiehw 2023-03-20 10:13:06 +08:00
parent 6ffa2cacb1
commit 44560b687e
3 changed files with 17 additions and 13 deletions

View File

@ -791,7 +791,8 @@ fn try_fill_unicode(event: &Event, key_event: &KeyEvent, events: &mut Vec<KeyEve
} }
} }
} }
None => { None =>
{
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
if is_hot_key_modifiers_down() && unsafe { !IS_0X021D_DOWN } { if is_hot_key_modifiers_down() && unsafe { !IS_0X021D_DOWN } {
if let Some(chr) = get_char_by_vk(event.code as u32) { if let Some(chr) = get_char_by_vk(event.code as u32) {
@ -802,7 +803,6 @@ fn try_fill_unicode(event: &Event, key_event: &KeyEvent, events: &mut Vec<KeyEve
} }
} }
} }
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]

View File

@ -17,7 +17,6 @@ pub mod delegate;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub mod linux; pub mod linux;
use crate::input_service::clear_remapped_keycode;
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
use hbb_common::{message_proto::CursorData, ResultType}; use hbb_common::{message_proto::CursorData, ResultType};
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
@ -44,7 +43,7 @@ pub fn is_xfce() -> bool {
pub fn breakdown_callback() { pub fn breakdown_callback() {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
clear_remapped_keycode() crate::input_service::clear_remapped_keycode()
} }
// Android // Android

View File

@ -27,8 +27,8 @@ use winapi::{
handleapi::CloseHandle, handleapi::CloseHandle,
minwinbase::STILL_ACTIVE, minwinbase::STILL_ACTIVE,
processthreadsapi::{ processthreadsapi::{
GetCurrentProcess, GetCurrentProcessId, GetCurrentThreadId, GetExitCodeProcess, GetCurrentProcess, GetCurrentProcessId, GetExitCodeProcess, OpenProcess,
OpenProcess, OpenProcessToken, PROCESS_INFORMATION, STARTUPINFOW, OpenProcessToken, PROCESS_INFORMATION, STARTUPINFOW,
}, },
securitybaseapi::GetTokenInformation, securitybaseapi::GetTokenInformation,
shellapi::ShellExecuteW, shellapi::ShellExecuteW,
@ -1948,7 +1948,8 @@ mod cert {
RegKey, RegKey,
}; };
const ROOT_CERT_STORE_PATH: &str = "SOFTWARE\\Microsoft\\SystemCertificates\\ROOT\\Certificates\\"; const ROOT_CERT_STORE_PATH: &str =
"SOFTWARE\\Microsoft\\SystemCertificates\\ROOT\\Certificates\\";
const THUMBPRINT_ALG: ALG_ID = CALG_SHA1; const THUMBPRINT_ALG: ALG_ID = CALG_SHA1;
const THUMBPRINT_LEN: DWORD = 20; const THUMBPRINT_LEN: DWORD = 20;
@ -1966,7 +1967,10 @@ mod cert {
&mut size, &mut size,
) == TRUE ) == TRUE
{ {
(thumbprint.to_vec(), hex::encode(thumbprint).to_ascii_uppercase()) (
thumbprint.to_vec(),
hex::encode(thumbprint).to_ascii_uppercase(),
)
} else { } else {
(thumbprint.to_vec(), "".to_owned()) (thumbprint.to_vec(), "".to_owned())
} }
@ -2074,9 +2078,9 @@ mod cert {
} }
pub fn get_char_by_vk(vk: u32) -> Option<char> { pub fn get_char_by_vk(vk: u32) -> Option<char> {
const BUF_LEN: i32 = 32;
let mut buff = [0_u16; BUF_LEN as usize]; let mut buff = [0_u16; BUF_LEN as usize];
let buff_ptr = buff.as_mut_ptr(); let buff_ptr = buff.as_mut_ptr();
const BUF_LEN: i32 = 32;
let len = unsafe { let len = unsafe {
let current_window_thread_id = GetWindowThreadProcessId(GetForegroundWindow(), null_mut()); let current_window_thread_id = GetWindowThreadProcessId(GetForegroundWindow(), null_mut());
let layout = GetKeyboardLayout(current_window_thread_id); let layout = GetKeyboardLayout(current_window_thread_id);
@ -2095,8 +2099,6 @@ pub fn get_char_by_vk(vk: u32) -> Option<char> {
if shift_left || shift_right { if shift_left || shift_right {
state[VK_SHIFT as usize] = press_state; state[VK_SHIFT as usize] = press_state;
} }
buff = [0; 32];
let buff_ptr = buff.as_mut_ptr();
ToUnicodeEx(vk, 0x00, &state as _, buff_ptr, BUF_LEN, 0, layout) ToUnicodeEx(vk, 0x00, &state as _, buff_ptr, BUF_LEN, 0, layout)
}; };
if len == 1 { if len == 1 {
@ -2123,7 +2125,10 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn test_install_cert() { fn test_install_cert() {
println!("install driver cert: {:?}", cert::install_cert("RustDeskIddDriver.cer")); println!(
"install driver cert: {:?}",
cert::install_cert("RustDeskIddDriver.cer")
);
} }
#[test] #[test]