low polling rate edge case

This commit is contained in:
Quaternions 2025-01-15 00:29:45 -08:00
parent d393f9f187
commit fea5bf4398

View File

@ -90,8 +90,17 @@ impl MouseInterpolator{
let buffer_state=core::mem::replace(&mut self.buffer_state,BufferState::Unbuffered);
match buffer_state{
BufferState::Unbuffered=>(),
BufferState::Initializing(_time,mouse_state)
|BufferState::Buffered(_time,mouse_state)=>{
BufferState::Initializing(_time,mouse_state)=>{
// only a single mouse move was sent in 10ms, this is very much an edge case!
self.push_mouse_and_flush_buffer(TimedInstruction{
time:mouse_state.time,
instruction:MouseInstruction::ReplaceMouse{
m1:MouseState{pos:mouse_state.pos,time},
m0:mouse_state,
},
});
}
BufferState::Buffered(_time,mouse_state)=>{
// convert to BufferState::Unbuffered
// use the first instruction which should be a mouse instruction
// to push a ReplaceMouse instruction