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; } }