From ca48408aedc1129a9c0d40cb53c12bf80c3b3ab2 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Tue, 3 Sep 2024 15:43:36 +0200 Subject: [PATCH] Apply Guichan's changes from f0e7bcb9b32c2fddfcc8c76c16cbd06e136caa07 (Sept 10th 2008) Click count in mouse events should now work as expected if the time stamp supplied by back ends is a time stamp in milliseconds when the event occurred. --- TODO | 2 +- src/gui.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 6e6c6d9..ea2f8c6 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from f0e7bcb9b32c2fddfcc8c76c16cbd06e136caa07 +* Continue rebasing from 6725f3b08248d94e3ac11ce530aec42e3029fc62 * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/src/gui.cpp b/src/gui.cpp index 6e439f1..2b289d4 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -528,6 +528,16 @@ namespace gcn sourceWidget->requestFocus(); } + if (mouseInput.getTimeStamp() - mLastMousePressTimeStamp < 250 + && mLastMousePressButton == mouseInput.getButton()) + { + mClickCount++; + } + else + { + mClickCount = 1; + } + distributeMouseEvent(sourceWidget, MouseEvent::Pressed, mouseInput.getButton(), @@ -539,16 +549,6 @@ namespace gcn mFocusHandler->setDraggedWidget(sourceWidget); mLastMouseDragButton = mouseInput.getButton(); - if (mLastMousePressTimeStamp < 300 - && mLastMousePressButton == mouseInput.getButton()) - { - mClickCount++; - } - else - { - mClickCount = 1; - } - mLastMousePressButton = mouseInput.getButton(); mLastMousePressTimeStamp = mouseInput.getTimeStamp(); }