Refactor to remove warning

This commit is contained in:
Asura 2022-07-18 17:42:02 +08:00
parent 72273f4546
commit 80b01a96db
2 changed files with 4 additions and 6 deletions

View File

@ -3,7 +3,7 @@ use super::*;
use dispatch::Queue;
use enigo::{Enigo, Key, KeyboardControllable, MouseButton, MouseControllable};
use hbb_common::{config::COMPRESS_LEVEL, protobuf::ProtobufEnumOrUnknown};
use rdev::{simulate, EventType, EventType::*, Key as RdevKey, SimulateError};
use rdev::{simulate, EventType, Key as RdevKey};
use std::{
convert::TryFrom,
sync::atomic::{AtomicBool, Ordering},

View File

@ -283,8 +283,6 @@ impl Handler {
}
log::info!("keyboard hooked");
let mut me = self.clone();
let peer = self.peer_platform();
let is_win = peer == "Windows";
#[cfg(windows)]
crate::platform::windows::enable_lowlevel_keyboard(std::ptr::null_mut() as _);
std::thread::spawn(move || {
@ -308,7 +306,7 @@ impl Handler {
{
return;
}
let (key, down) = match evt.event_type {
let (_key, down) = match evt.event_type {
KeyPress(k) => {
// keyboard long press
if MUTEX_SPECIAL_KEYS.lock().unwrap().contains_key(&k) {
@ -330,9 +328,9 @@ impl Handler {
};
#[cfg(target_os = "windows")]
let key = rdev::get_win_key(evt.code.into(), evt.scan_code);
let _key = rdev::get_win_key(evt.code.into(), evt.scan_code);
me.key_down_or_up(down, key, evt);
me.key_down_or_up(down, _key, evt);
};
if let Err(error) = rdev::listen(func) {
log::error!("rdev: {:?}", error);