diff --git a/input-emulation/src/wlroots.rs b/input-emulation/src/wlroots.rs index 6049c1d..df18ed1 100644 --- a/input-emulation/src/wlroots.rs +++ b/input-emulation/src/wlroots.rs @@ -5,6 +5,7 @@ use async_trait::async_trait; use std::collections::HashMap; use std::io; use std::os::fd::{AsFd, OwnedFd}; +use std::time::{SystemTime, UNIX_EPOCH}; use wayland_client::backend::WaylandError; use wayland_client::WEnum; @@ -177,6 +178,11 @@ struct VirtualInput { impl VirtualInput { fn consume_event(&self, event: Event) -> Result<(), ()> { + let now: u32 = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as u32; + match event { Event::Pointer(e) => { match e { @@ -197,7 +203,7 @@ impl VirtualInput { PointerEvent::AxisDiscrete120 { axis, value } => { let axis: Axis = (axis as u32).try_into()?; self.pointer - .axis_discrete(0, axis, value as f64 / 6., value / 120); + .axis_discrete(now, axis, value as f64 / 6., value / 120); self.pointer.frame(); } }