From 9f1a371152fc5cf16e77351dc9e29dceb9a7b3c8 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 16 Jun 2025 20:40:03 -0500 Subject: [PATCH] server updates --- client/src/input/mouse.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/input/mouse.rs b/client/src/input/mouse.rs index 4aa7b03..57edbfc 100644 --- a/client/src/input/mouse.rs +++ b/client/src/input/mouse.rs @@ -14,6 +14,7 @@ pub struct MouseAggregator { dev_mode: bool, buttons: u8, + last_buttons: u8, dx: i8, dy: i8, wheel: i8, @@ -27,6 +28,7 @@ impl MouseAggregator { dev_mode, buttons: 0, + last_buttons: 0, dx: 0, dy: 0, wheel: 0, @@ -101,7 +103,13 @@ impl MouseAggregator { /// Build & send HID packet, then clear deltas fn flush_report(&mut self) { /* Nothing changed ⇒ nothing to send */ - if self.dx == 0 && self.dy == 0 && self.wheel == 0 { return; } + if self.dx == 0 + && self.dy == 0 + && self.wheel == 0 + && self.buttons == self.last_buttons + { + return; + } let report = [ self.buttons, @@ -120,6 +128,9 @@ impl MouseAggregator { } /* reset deltas for next frame */ - self.dx = 0; self.dy = 0; self.wheel = 0; + self.dx = 0; + self.dy = 0; + self.wheel = 0; + self.last_buttons = self.buttons; } }