fix block_on runtime

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-12-09 15:53:51 +08:00
parent ed5b844b77
commit 03fc91e557

View File

@ -245,16 +245,18 @@ pub async fn setup_uinput(minx: i32, maxx: i32, miny: i32, maxy: i32) -> ResultT
pub async fn update_mouse_resolution(minx: i32, maxx: i32, miny: i32, maxy: i32) -> ResultType<()> {
set_uinput_resolution(minx, maxx, miny, maxy).await?;
if let Some(mouse) = ENIGO.lock().unwrap().get_custom_mouse() {
if let Some(mouse) = mouse
.as_mut_any()
.downcast_mut::<super::uinput::client::UInputMouse>()
{
allow_err!(mouse.send_refresh());
} else {
log::error!("failed downcast uinput mouse");
std::thread::spawn(|| {
if let Some(mouse) = ENIGO.lock().unwrap().get_custom_mouse() {
if let Some(mouse) = mouse
.as_mut_any()
.downcast_mut::<super::uinput::client::UInputMouse>()
{
allow_err!(mouse.send_refresh());
} else {
log::error!("failed downcast uinput mouse");
}
}
}
});
Ok(())
}