Fixed accumulating mouse wheel motion for the Microsoft Wireless Mouse 5000

main
Sam Lantinga 2013-10-13 19:59:40 -07:00
parent 080c919b79
commit 8ec3ba3829
1 changed files with 13 additions and 3 deletions

View File

@ -466,10 +466,20 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:
{ {
/* FIXME: This may need to accumulate deltas up to WHEEL_DELTA */ static short s_AccumulatedMotion;
short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
SDL_SendMouseWheel(data->window, 0, 0, motion); s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
if (s_AccumulatedMotion > 0) {
while (s_AccumulatedMotion >= WHEEL_DELTA) {
SDL_SendMouseWheel(data->window, 0, 0, 1);
s_AccumulatedMotion -= WHEEL_DELTA;
}
} else {
while (s_AccumulatedMotion <= -WHEEL_DELTA) {
SDL_SendMouseWheel(data->window, 0, 0, -1);
s_AccumulatedMotion += WHEEL_DELTA;
}
}
break; break;
} }