server updates
This commit is contained in:
parent
95088f7040
commit
9f1a371152
@ -14,6 +14,7 @@ pub struct MouseAggregator {
|
|||||||
dev_mode: bool,
|
dev_mode: bool,
|
||||||
|
|
||||||
buttons: u8,
|
buttons: u8,
|
||||||
|
last_buttons: u8,
|
||||||
dx: i8,
|
dx: i8,
|
||||||
dy: i8,
|
dy: i8,
|
||||||
wheel: i8,
|
wheel: i8,
|
||||||
@ -27,6 +28,7 @@ impl MouseAggregator {
|
|||||||
dev_mode,
|
dev_mode,
|
||||||
|
|
||||||
buttons: 0,
|
buttons: 0,
|
||||||
|
last_buttons: 0,
|
||||||
dx: 0,
|
dx: 0,
|
||||||
dy: 0,
|
dy: 0,
|
||||||
wheel: 0,
|
wheel: 0,
|
||||||
@ -101,7 +103,13 @@ impl MouseAggregator {
|
|||||||
/// Build & send HID packet, then clear deltas
|
/// Build & send HID packet, then clear deltas
|
||||||
fn flush_report(&mut self) {
|
fn flush_report(&mut self) {
|
||||||
/* Nothing changed ⇒ nothing to send */
|
/* 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 = [
|
let report = [
|
||||||
self.buttons,
|
self.buttons,
|
||||||
@ -120,6 +128,9 @@ impl MouseAggregator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reset deltas for next frame */
|
/* 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user