src/video/windows/SDL_windowsevents.c
changeset 7911 a9135f92ddba
parent 7816 f16e342b167a
child 7912 10eff60470b3
equal deleted inserted replaced
7910:261addaa47d0 7911:a9135f92ddba
    64 #ifndef WM_INPUT
    64 #ifndef WM_INPUT
    65 #define WM_INPUT 0x00ff
    65 #define WM_INPUT 0x00ff
    66 #endif
    66 #endif
    67 #ifndef WM_TOUCH
    67 #ifndef WM_TOUCH
    68 #define WM_TOUCH 0x0240
    68 #define WM_TOUCH 0x0240
       
    69 #endif
       
    70 #ifndef WM_MOUSEHWHEEL
       
    71 #define WM_MOUSEHWHEEL 0x020E
    69 #endif
    72 #endif
    70 
    73 
    71 static SDL_Scancode
    74 static SDL_Scancode
    72 WindowsScanCodeToSDLScanCode( LPARAM lParam, WPARAM wParam )
    75 WindowsScanCodeToSDLScanCode( LPARAM lParam, WPARAM wParam )
    73 {
    76 {
   479                 }
   482                 }
   480             }
   483             }
   481             break;
   484             break;
   482         }
   485         }
   483 
   486 
       
   487     case WM_MOUSEHWHEEL:
       
   488         {
       
   489             static short s_AccumulatedMotion;
       
   490 
       
   491             s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
       
   492             if (s_AccumulatedMotion > 0) {
       
   493                 while (s_AccumulatedMotion >= WHEEL_DELTA) {
       
   494                     SDL_SendMouseWheel(data->window, 0, 1, 0, timestamp);
       
   495                     s_AccumulatedMotion -= WHEEL_DELTA;
       
   496                 }
       
   497             } else {
       
   498                 while (s_AccumulatedMotion <= -WHEEL_DELTA) {
       
   499                     SDL_SendMouseWheel(data->window, 0, -1, 0, timestamp);
       
   500                     s_AccumulatedMotion += WHEEL_DELTA;
       
   501                 }
       
   502             }
       
   503             break;
       
   504         }
       
   505 
   484 #ifdef WM_MOUSELEAVE
   506 #ifdef WM_MOUSELEAVE
   485     case WM_MOUSELEAVE:
   507     case WM_MOUSELEAVE:
   486         if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode) {
   508         if (SDL_GetMouseFocus() == data->window && !SDL_GetMouse()->relative_mode) {
   487             POINT cursorPos;
   509             POINT cursorPos;
   488             GetCursorPos(&cursorPos);
   510             GetCursorPos(&cursorPos);