src/video/windows/SDL_windowsevents.c
changeset 7813 d8fb783475d5
parent 7678 286c42d7c5ed
child 7816 f16e342b167a
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Sun Oct 13 19:51:58 2013 -0700
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Sun Oct 13 19:59:40 2013 -0700
     1.3 @@ -466,10 +466,20 @@
     1.4  
     1.5      case WM_MOUSEWHEEL:
     1.6          {
     1.7 -            /* FIXME: This may need to accumulate deltas up to WHEEL_DELTA */
     1.8 -            short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
     1.9 +            static short s_AccumulatedMotion;
    1.10  
    1.11 -            SDL_SendMouseWheel(data->window, 0, 0, motion);
    1.12 +            s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
    1.13 +            if (s_AccumulatedMotion > 0) {
    1.14 +                while (s_AccumulatedMotion >= WHEEL_DELTA) {
    1.15 +                    SDL_SendMouseWheel(data->window, 0, 0, 1);
    1.16 +                    s_AccumulatedMotion -= WHEEL_DELTA;
    1.17 +                }
    1.18 +            } else {
    1.19 +                while (s_AccumulatedMotion <= -WHEEL_DELTA) {
    1.20 +                    SDL_SendMouseWheel(data->window, 0, 0, -1);
    1.21 +                    s_AccumulatedMotion += WHEEL_DELTA;
    1.22 +                }
    1.23 +            }
    1.24              break;
    1.25          }
    1.26