wm_mousewheel and wm_mousehwheel report mouse coordinates in screen space, not client space; fix to account fo rthat

This commit is contained in:
Ryan Fleury
2024-02-08 10:05:29 -08:00
parent 2967d8be2a
commit 6e3242848f
+12 -4
View File
@@ -440,8 +440,12 @@ w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
S16 wheel_delta = HIWORD(wParam);
OS_Event *event = w32_push_event(OS_EventKind_Scroll, window);
event->pos.x = (F32)LOWORD(lParam);
event->pos.y = (F32)HIWORD(lParam);
POINT p;
p.x = (S32)LOWORD(lParam);
p.y = (S32)HIWORD(lParam);
ScreenToClient(window->hwnd, &p);
event->pos.x = (F32)p.x;
event->pos.y = (F32)p.y;
event->delta = v2f32(0.f, -(F32)wheel_delta);
}break;
@@ -449,8 +453,12 @@ w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
S16 wheel_delta = HIWORD(wParam);
OS_Event *event = w32_push_event(OS_EventKind_Scroll, window);
event->pos.x = (F32)LOWORD(lParam);
event->pos.y = (F32)HIWORD(lParam);
POINT p;
p.x = (S32)LOWORD(lParam);
p.y = (S32)HIWORD(lParam);
ScreenToClient(window->hwnd, &p);
event->pos.x = (F32)p.x;
event->pos.y = (F32)p.y;
event->delta = v2f32((F32)wheel_delta, 0.f);
}break;