src/video/windows/SDL_windowsevents.c
changeset 8212 d278747da408
parent 8149 681eb46b8ac4
child 8218 cf153cc95173
equal deleted inserted replaced
8211:089bc02a5e4b 8212:d278747da408
   257             WIN_CheckWParamMouseButton(  !(rawButtons & RI_MOUSE_BUTTON_5_UP), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
   257             WIN_CheckWParamMouseButton(  !(rawButtons & RI_MOUSE_BUTTON_5_UP), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
   258         data->mouse_button_flags = rawButtons;
   258         data->mouse_button_flags = rawButtons;
   259     }
   259     }
   260 }
   260 }
   261 
   261 
       
   262 void
       
   263 WIN_CheckAsyncMouseRelease( SDL_WindowData *data )
       
   264 {
       
   265     Uint32 mouseFlags;
       
   266     SHORT keyState;
       
   267 
       
   268     /* mouse buttons may have changed state here, we need to resync them,
       
   269        but we will get a WM_MOUSEMOVE right away which will fix things up if in non raw mode also
       
   270     */
       
   271     mouseFlags = SDL_GetMouseState( NULL, NULL );
       
   272 
       
   273     keyState = GetAsyncKeyState( VK_LBUTTON );
       
   274     WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), ( mouseFlags & SDL_BUTTON_LMASK ), data, SDL_BUTTON_LEFT );
       
   275     keyState = GetAsyncKeyState( VK_RBUTTON );
       
   276     WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), ( mouseFlags & SDL_BUTTON_RMASK ), data, SDL_BUTTON_RIGHT );
       
   277     keyState = GetAsyncKeyState( VK_MBUTTON );
       
   278     WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), ( mouseFlags & SDL_BUTTON_MMASK ), data, SDL_BUTTON_MIDDLE );
       
   279     keyState = GetAsyncKeyState( VK_XBUTTON1 );
       
   280     WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), ( mouseFlags & SDL_BUTTON_X1MASK ), data, SDL_BUTTON_X1 );
       
   281     keyState = GetAsyncKeyState( VK_XBUTTON2 );
       
   282     WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), ( mouseFlags & SDL_BUTTON_X2MASK ), data, SDL_BUTTON_X2 );
       
   283     data->mouse_button_flags = 0;
       
   284 }
       
   285 
   262 SDL_FORCE_INLINE BOOL
   286 SDL_FORCE_INLINE BOOL
   263 WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text)
   287 WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text)
   264 {
   288 {
   265     if (codepoint <= 0x7F) {
   289     if (codepoint <= 0x7F) {
   266         text[0] = (char) codepoint;
   290         text[0] = (char) codepoint;
   342         {
   366         {
   343             BOOL minimized;
   367             BOOL minimized;
   344 
   368 
   345             minimized = HIWORD(wParam);
   369             minimized = HIWORD(wParam);
   346             if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   370             if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   347                 Uint32 mouseFlags;
       
   348                 SHORT keyState;
       
   349 
       
   350                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   371                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   351                 if (SDL_GetKeyboardFocus() != data->window) {
   372                 if (SDL_GetKeyboardFocus() != data->window) {
   352                     SDL_SetKeyboardFocus(data->window);
   373                     SDL_SetKeyboardFocus(data->window);
   353                 }
   374                 }
   354                 /* mouse buttons may have changed state here, we need
       
   355                 to resync them, but we will get a WM_MOUSEMOVE right away which will fix
       
   356                 things up if in non raw mode also
       
   357                 */
       
   358                 mouseFlags = SDL_GetMouseState( NULL, NULL );
       
   359 
       
   360                 keyState = GetAsyncKeyState( VK_LBUTTON );
       
   361                 WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
       
   362                 keyState = GetAsyncKeyState( VK_RBUTTON );
       
   363                 WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
       
   364                 keyState = GetAsyncKeyState( VK_MBUTTON );
       
   365                 WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
       
   366                 keyState = GetAsyncKeyState( VK_XBUTTON1 );
       
   367                 WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
       
   368                 keyState = GetAsyncKeyState( VK_XBUTTON2 );
       
   369                 WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
       
   370                 data->mouse_button_flags = 0;
       
   371 
       
   372                 WIN_UpdateClipCursor(data->window);
   375                 WIN_UpdateClipCursor(data->window);
       
   376                 WIN_CheckAsyncMouseRelease(data);
   373 
   377 
   374                 /*
   378                 /*
   375                  * FIXME: Update keyboard state
   379                  * FIXME: Update keyboard state
   376                  */
   380                  */
   377                 WIN_CheckClipboardUpdate(data->videodata);
   381                 WIN_CheckClipboardUpdate(data->videodata);
   576     case WM_EXITSIZEMOVE:
   580     case WM_EXITSIZEMOVE:
   577     case WM_EXITMENULOOP:
   581     case WM_EXITMENULOOP:
   578         {
   582         {
   579             data->in_modal_loop = SDL_FALSE;
   583             data->in_modal_loop = SDL_FALSE;
   580             WIN_UpdateClipCursor(data->window);
   584             WIN_UpdateClipCursor(data->window);
       
   585 
       
   586             /* The mouse may have been released during the modal loop */
       
   587             WIN_CheckAsyncMouseRelease(data);
   581         }
   588         }
   582         break;
   589         break;
   583 
   590 
   584 #ifdef WM_GETMINMAXINFO
   591 #ifdef WM_GETMINMAXINFO
   585     case WM_GETMINMAXINFO:
   592     case WM_GETMINMAXINFO: