[PATCH] DirectInput: send wheel events in absolute coords if requested

Szegeczki Imre szegeczki1 at gmail.com
Tue Feb 23 12:39:43 CST 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=14025
Signed-off-by: Szegeczki Imre <szegeczki1 at gmail.com>
---
 dlls/dinput/mouse.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index e50731fda41..73dd46c7249 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -379,8 +379,12 @@ void dinput_mouse_rawinput_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPA
     if (ri->data.mouse.usButtonFlags & RI_MOUSE_WHEEL)
     {
         This->m_state.lZ += (wdata = (SHORT)ri->data.mouse.usButtonData);
-        queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
-                     wdata, GetCurrentTime(), seq );
+        if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
+            queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
+                         This->m_state.lZ, GetCurrentTime(), seq );
+        else
+            queue_event( iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
+                         wdata, GetCurrentTime(), seq );
     }
 
     for (i = 0; i < ARRAY_SIZE(mouse_button_flags); ++i)
@@ -449,6 +453,8 @@ int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam
         case WM_MOUSEWHEEL:
             inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS;
             This->m_state.lZ += wdata = (short)HIWORD(hook->mouseData);
+            if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
+                wdata = This->m_state.lZ;
             /* FarCry crashes if it gets a mouse wheel message */
             /* FIXME: should probably filter out other messages too */
             ret = This->clipped;
-- 
2.30.1




More information about the wine-devel mailing list