From fd2dca4c5a2efeef2b85cb2b4df3fb5ef71e1c71 Mon Sep 17 00:00:00 2001 From: William Lemon Date: Sun, 9 Feb 2020 14:37:16 +1100 Subject: [PATCH] Fixes a crash relating to the mousewheel with CoreUI --- OpenGL.Net.CoreUI/NativeWindowMouseEventArgs.cs | 1 + OpenGL.Net.CoreUI/NativeWindowWinNT.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenGL.Net.CoreUI/NativeWindowMouseEventArgs.cs b/OpenGL.Net.CoreUI/NativeWindowMouseEventArgs.cs index bbaa524d4..df9b2adb7 100644 --- a/OpenGL.Net.CoreUI/NativeWindowMouseEventArgs.cs +++ b/OpenGL.Net.CoreUI/NativeWindowMouseEventArgs.cs @@ -74,6 +74,7 @@ internal NativeWindowMouseEventArgs(DeviceContext deviceContext, IntPtr renderCo { Location = location; Buttons = buttons; + WheelTicks = wheelTicks; } #endregion diff --git a/OpenGL.Net.CoreUI/NativeWindowWinNT.cs b/OpenGL.Net.CoreUI/NativeWindowWinNT.cs index c7929dfc8..a9c848d5c 100644 --- a/OpenGL.Net.CoreUI/NativeWindowWinNT.cs +++ b/OpenGL.Net.CoreUI/NativeWindowWinNT.cs @@ -243,7 +243,7 @@ private IntPtr WindowsWndProc_BUTTONDOUBLECLICK(IntPtr hWnd, IntPtr wParam, IntP private IntPtr WindowsWndProc_MOUSEWHEEL(IntPtr hWnd, IntPtr wParam, IntPtr lParam) { - short wheelTicks = (short)(((wParam.ToInt32() >> 16) & 0xFFFF) / /* WHEEL_DELTA */ 120); + short wheelTicks = (short)(((wParam.ToInt64() >> 16) & 0xFFFF) / /* WHEEL_DELTA */ 120); OnMouseWheel(WindowsWndProc_GetMouseLocation(lParam), WindowsWndProc_GetMouseButtons(wParam), wheelTicks); @@ -263,7 +263,7 @@ private Point WindowsWndProc_GetMouseLocation(IntPtr lParam) private static MouseButton WindowsWndProc_GetMouseButtons(IntPtr wParam) { MouseButton buttons = MouseButton.None; - int wParamValue = wParam.ToInt32() & 0xFFFF; + int wParamValue = wParam.ToInt64() & 0xFFFF; if ((wParamValue & 0x0001) != 0) buttons |= MouseButton.Left;