Add MOUSEEVENTF_HWHEEL define if not found in windows.h
authorArmin Novak <armin.novak@thincast.com>
Tue, 10 Sep 2019 07:28:48 +0000 (09:28 +0200)
committerArmin Novak <armin.novak@thincast.com>
Tue, 10 Sep 2019 07:35:32 +0000 (09:35 +0200)
server/shadow/Win/win_shadow.c

index e01f7b8..e54bbd1 100644 (file)
 
 #define TAG SERVER_TAG("shadow.win")
 
+/* https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-mouse_event
+ * does not mention this flag is only supported if building for _WIN32_WINNT >= 0x0600
+ */
+#ifndef MOUSEEVENTF_HWHEEL
+#define MOUSEEVENTF_HWHEEL 0x1000
+#endif
+
 static BOOL win_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem,
         rdpShadowClient* client, UINT32 flags)
 {
@@ -104,6 +111,15 @@ static BOOL win_shadow_input_mouse_event(rdpShadowSubsystem* subsystem,
                        event.mi.mouseData *= -1;
 
                rc = SendInput(1, &event, sizeof(INPUT));
+
+               /* The build target is a system that did not support MOUSEEVENTF_HWHEEL
+                * but it may run on newer systems supporting it.
+                * Ignore the return value in these cases.
+                */
+#if (_WIN32_WINNT < 0x0600)
+               if (flags & PTR_FLAGS_HWHEEL)
+                       rc = 1;
+#endif
        }
        else
        {