Skip to content

Commit

Permalink
Fixed accumulating mouse wheel motion for the Microsoft Wireless Mous…
Browse files Browse the repository at this point in the history
…e 5000
  • Loading branch information
slouken committed Oct 14, 2013
1 parent 080c919 commit 8ec3ba3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/video/windows/SDL_windowsevents.c
Expand Up @@ -466,10 +466,20 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

case WM_MOUSEWHEEL:
{
/* FIXME: This may need to accumulate deltas up to WHEEL_DELTA */
short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
static short s_AccumulatedMotion;

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;
}

Expand Down

0 comments on commit 8ec3ba3

Please sign in to comment.