From b14dcb6f49e7bbcd3f7f1de5093b8bdba286ef38 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Tue, 9 Jul 2024 20:39:08 +0200 Subject: [PATCH] simplify --- input-capture/src/windows.rs | 6 +----- input-emulation/src/libei.rs | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/input-capture/src/windows.rs b/input-capture/src/windows.rs index 76fd57e..bfbf6c3 100644 --- a/input-capture/src/windows.rs +++ b/input-capture/src/windows.rs @@ -145,11 +145,7 @@ fn to_mouse_event(wparam: WPARAM, lparam: LPARAM) -> Option { let (ex, ey) = ENTRY_POINT; let (dx, dy) = (x - ex, y - ey); let (dx, dy) = (dx as f64, dy as f64); - Some(PointerEvent::Motion { - time: 0, - dx: dx as f64, - dy: dy as f64, - }) + Some(PointerEvent::Motion { time: 0, dx, dy }) }, WPARAM(p) if p == WM_MOUSEWHEEL as usize => Some(PointerEvent::AxisDiscrete120 { axis: 0, diff --git a/input-emulation/src/libei.rs b/input-emulation/src/libei.rs index 6dc92a0..824fe4b 100644 --- a/input-emulation/src/libei.rs +++ b/input-emulation/src/libei.rs @@ -115,8 +115,8 @@ impl LibeiEmulation { .await?; let events = EiConvertEventStream::new(events, handshake.serial); let devices = Devices::default(); - let ei_task = - tokio::task::spawn_local(ei_event_handler(events, context.clone(), devices.clone())); + let ei_handler = ei_event_handler(events, context.clone(), devices.clone()); + let ei_task = tokio::task::spawn_local(ei_handler); let serial = AtomicU32::new(handshake.serial);