From 1e469c89493215cda7bcaad189677457f300a81c Mon Sep 17 00:00:00 2001 From: driver1998 Date: Thu, 21 Mar 2019 01:15:55 +0800 Subject: [PATCH] fix rawmouse input regression for regular relative mouse movement --- src/win/win_mouse_rawinput.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/win/win_mouse_rawinput.cpp b/src/win/win_mouse_rawinput.cpp index a5a4def94..fc983d24d 100644 --- a/src/win/win_mouse_rawinput.cpp +++ b/src/win/win_mouse_rawinput.cpp @@ -103,12 +103,8 @@ win_mouse_handle(LPARAM lParam, int infocus) mousestate.dwheel += (SHORT)state.usButtonData / 120; } - - if (state.usFlags & MOUSE_MOVE_RELATIVE) { - /* relative mouse, i.e. regular mouse */ - mousestate.dx += state.lLastX; - mousestate.dy += state.lLastY; - } else if (state.usFlags & MOUSE_MOVE_ABSOLUTE) { + + if (state.usFlags & MOUSE_MOVE_ABSOLUTE) { /* absolute mouse, i.e. RDP or VNC * seems to work fine for RDP on Windows 10 * Not sure about other environments. @@ -118,6 +114,10 @@ win_mouse_handle(LPARAM lParam, int infocus) mousestate.dy += (state.lLastY - y)/100; x=state.lLastX; y=state.lLastY; + } else { + /* relative mouse, i.e. regular mouse */ + mousestate.dx += state.lLastX; + mousestate.dy += state.lLastY; } err: @@ -148,7 +148,7 @@ mouse_poll(void) mousestate.dx=0; mousestate.dy=0; mousestate.dwheel=0; - + //pclog("dx=%d, dy=%d, dwheel=%d\n", mouse_x, mouse_y, mouse_z); }