From 8445b3357fcbfcc3abd3d7b399da3d2c0463d02c Mon Sep 17 00:00:00 2001 From: x1244 Date: Sat, 15 Mar 2025 12:37:39 +0800 Subject: [PATCH] Detect the throw feature of the trackball within milliseconds On the Windows platform, the move and release events of a mouse button are not tagged identically. To accommodate the throw feature, the detection threshold for the timestamps of these two events is set within a 1-millisecond range. This configuration also supports the handling of events with identical timestamps under Xcb/X11. --- src/vsg/app/Trackball.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vsg/app/Trackball.cpp b/src/vsg/app/Trackball.cpp index f748b7b4e2..c384ad66af 100644 --- a/src/vsg/app/Trackball.cpp +++ b/src/vsg/app/Trackball.cpp @@ -192,7 +192,9 @@ void Trackball::apply(ButtonReleaseEvent& buttonRelease) if (!windowOffsets.empty() && windowOffsets.count(buttonRelease.window) == 0) return; - if (supportsThrow) _thrown = _previousPointerEvent && (buttonRelease.time == _previousPointerEvent->time); + if (supportsThrow) _thrown = _previousPointerEvent && + (std::chrono::duration_cast( + buttonRelease.time - _previousPointerEvent->time).count() == 0); _lastPointerEventWithinRenderArea = withinRenderArea(buttonRelease); _hasPointerFocus = false;