Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a crash relating to the mousewheel with CoreUI #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OpenGL.Net.CoreUI/NativeWindowMouseEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ internal NativeWindowMouseEventArgs(DeviceContext deviceContext, IntPtr renderCo
{
Location = location;
Buttons = buttons;
WheelTicks = wheelTicks;
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions OpenGL.Net.CoreUI/NativeWindowWinNT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down