1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:18:12 +00:00

WindowServer: Don't transform quick far-apart clicks into double-clicks

We now require that the two clicks that make up a double-click be no
more than 4px apart.

This fixes the annoying behavior where you'd often get incorrect
double-click events on GUI widgets.
This commit is contained in:
Andreas Kling 2019-09-08 10:15:08 +02:00
parent 33e6cb8b80
commit 423807d772
2 changed files with 41 additions and 25 deletions

View file

@ -205,18 +205,26 @@ private:
InlineLinkedList<WSWindow> m_windows_in_order;
struct DoubleClickInfo {
CElapsedTimer& click_clock(MouseButton);
struct ClickMetadata {
CElapsedTimer clock;
Point last_position;
};
ClickMetadata& metadata_for_button(MouseButton);
void reset()
{
m_left_click_clock = CElapsedTimer();
m_right_click_clock = CElapsedTimer();
m_middle_click_clock = CElapsedTimer();
m_left = {};
m_right = {};
m_middle = {};
}
WeakPtr<WSWindow> m_clicked_window;
CElapsedTimer m_left_click_clock;
CElapsedTimer m_right_click_clock;
CElapsedTimer m_middle_click_clock;
private:
ClickMetadata m_left;
ClickMetadata m_right;
ClickMetadata m_middle;
};
DoubleClickInfo m_double_click_info;
int m_double_click_speed { 0 };