From ce6b05174a068c37c4d770bd1ab0c7371fd5088a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 14 Dec 2023 19:30:03 +0100 Subject: [PATCH] Also call SendMouseDeltaAxis directly from NativeMouseDelta for lower latency. --- UI/NativeApp.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index eac395444e..3f22acd0af 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1324,15 +1324,7 @@ void NativeAxis(const AxisInput *axes, size_t count) { } } -void NativeMouseDelta(float dx, float dy) { - // Remap, shared code. Then send it as a regular axis event. - if (!g_Config.bMouseControl) - return; - - MouseEventProcessor::ProcessDelta(time_now_d(), dx, dy); -} - -// Called from NativeFrame. +// Called from NativeFrame and from NativeMouseDelta. static void SendMouseDeltaAxis() { float mx, my; MouseEventProcessor::MouseDeltaToAxes(time_now_d(), &mx, &my); @@ -1356,6 +1348,16 @@ static void SendMouseDeltaAxis() { } } +void NativeMouseDelta(float dx, float dy) { + // Remap, shared code. Then send it as a regular axis event. + if (!g_Config.bMouseControl) + return; + + MouseEventProcessor::ProcessDelta(time_now_d(), dx, dy); + + SendMouseDeltaAxis(); +} + void NativeAccelerometer(float tiltX, float tiltY, float tiltZ) { if (g_Config.iTiltInputType == TILT_NULL) { // if tilt events are disabled, don't do anything special.