mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 18:35:06 +00:00
WSWindowManager: Fix a small whoopsie with double click delivery
We must reset the click clock to invalid after delivering the double click event. Otherwise, a subsequent click will make us (incorrectly) deliver another double click.
This commit is contained in:
parent
966c5d10b1
commit
c4610b825d
1 changed files with 9 additions and 4 deletions
|
@ -688,7 +688,9 @@ void WSWindowManager::deliver_mouse_event(WSWindow& window, WSMouseEvent& event)
|
|||
|
||||
// if the clock is invalid, we haven't clicked with this button on this
|
||||
// window yet, so there's nothing to do.
|
||||
if (clock.is_valid()) {
|
||||
if (!clock.is_valid()) {
|
||||
clock.start();
|
||||
} else {
|
||||
int elapsed_since_last_click = clock.elapsed();
|
||||
clock.start();
|
||||
|
||||
|
@ -699,12 +701,15 @@ void WSWindowManager::deliver_mouse_event(WSWindow& window, WSMouseEvent& event)
|
|||
dbgprintf("Transforming MouseUp to MouseDoubleClick!\n");
|
||||
#endif
|
||||
event = WSMouseEvent(WSEvent::MouseDoubleClick, event.position(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
|
||||
}
|
||||
}
|
||||
|
||||
// start (or re-start, if it was invalid) the double click timer again.
|
||||
// invalidate this now we've delivered a doubleclick, otherwise
|
||||
// tripleclick will deliver two doubleclick events (incorrectly).
|
||||
clock = CElapsedTimer();
|
||||
} else {
|
||||
// too slow; try again
|
||||
clock.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.event(event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue