src/video/windows/SDL_windowsevents.c
changeset 7941 7c249ca44069
parent 7912 10eff60470b3
child 7975 1b49b680f319
equal deleted inserted replaced
7940:6a69c9795484 7941:7c249ca44069
   310     if (!data) {
   310     if (!data) {
   311         return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
   311         return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
   312     }
   312     }
   313 
   313 
   314 #ifdef WMMSG_DEBUG
   314 #ifdef WMMSG_DEBUG
   315 	{
   315     {
   316 		char message[1024];
   316         char message[1024];
   317 		if (msg > MAX_WMMSG) {
   317         if (msg > MAX_WMMSG) {
   318 			SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
   318             SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
   319 		} else {
   319         } else {
   320 			SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
   320             SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
   321 		}
   321         }
   322 		OutputDebugStringA(message);
   322         OutputDebugStringA(message);
   323 	}
   323     }
   324 #endif /* WMMSG_DEBUG */
   324 #endif /* WMMSG_DEBUG */
   325 
   325 
   326     if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
   326     if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
   327         return 0;
   327         return 0;
   328 
   328 
   346             if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   346             if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   347                 Uint32 mouseFlags;
   347                 Uint32 mouseFlags;
   348                 SHORT keyState;
   348                 SHORT keyState;
   349 
   349 
   350                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   350                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   351                 SDL_SendWindowEvent(data->window,
       
   352                                     SDL_WINDOWEVENT_RESTORED, 0, 0);
       
   353                 if (IsZoomed(hwnd)) {
       
   354                     SDL_SendWindowEvent(data->window,
       
   355                                         SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
       
   356                 }
       
   357                 if (SDL_GetKeyboardFocus() != data->window) {
   351                 if (SDL_GetKeyboardFocus() != data->window) {
   358                     SDL_SetKeyboardFocus(data->window);
   352                     SDL_SetKeyboardFocus(data->window);
   359                 }
   353                 }
   360                 /* mouse buttons may have changed state here, we need
   354                 /* mouse buttons may have changed state here, we need
   361                 to resync them, but we will get a WM_MOUSEMOVE right away which will fix
   355                 to resync them, but we will get a WM_MOUSEMOVE right away which will fix
   397                  */
   391                  */
   398                 WIN_CheckClipboardUpdate(data->videodata);
   392                 WIN_CheckClipboardUpdate(data->videodata);
   399             } else {
   393             } else {
   400                 if (SDL_GetKeyboardFocus() == data->window) {
   394                 if (SDL_GetKeyboardFocus() == data->window) {
   401                     SDL_SetKeyboardFocus(NULL);
   395                     SDL_SetKeyboardFocus(NULL);
   402                 }
       
   403                 if (minimized) {
       
   404                     SDL_SendWindowEvent(data->window,
       
   405                                         SDL_WINDOWEVENT_MINIMIZED, 0, 0);
       
   406                 }
   396                 }
   407             }
   397             }
   408         }
   398         }
   409         returnCode = 0;
   399         returnCode = 0;
   410         break;
   400         break;
   594             int max_w, max_h;
   584             int max_w, max_h;
   595             int style;
   585             int style;
   596             BOOL menu;
   586             BOOL menu;
   597             BOOL constrain_max_size;
   587             BOOL constrain_max_size;
   598 
   588 
   599             /* If we allow resizing, let the resize happen naturally */
       
   600             if (SDL_IsShapedWindow(data->window))
   589             if (SDL_IsShapedWindow(data->window))
   601                 Win32_ResizeWindowShape(data->window);
   590                 Win32_ResizeWindowShape(data->window);
       
   591 
       
   592             /* If this is an expected size change, allow it */
       
   593             if (data->expected_resize) {
       
   594                 break;
       
   595             }
   602 
   596 
   603             /* Get the current position of our window */
   597             /* Get the current position of our window */
   604             GetWindowRect(hwnd, &size);
   598             GetWindowRect(hwnd, &size);
   605             x = size.left;
   599             x = size.left;
   606             y = size.top;
   600             y = size.top;
   688 
   682 
   689             w = rect.right - rect.left;
   683             w = rect.right - rect.left;
   690             h = rect.bottom - rect.top;
   684             h = rect.bottom - rect.top;
   691             SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w,
   685             SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w,
   692                                 h);
   686                                 h);
       
   687         }
       
   688         break;
       
   689 
       
   690     case WM_SIZE:
       
   691         {
       
   692             switch (wParam)
       
   693             {
       
   694             case SIZE_MAXIMIZED:
       
   695                 SDL_SendWindowEvent(data->window,
       
   696                     SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
       
   697                 break;
       
   698             case SIZE_MINIMIZED:
       
   699                 SDL_SendWindowEvent(data->window,
       
   700                     SDL_WINDOWEVENT_MINIMIZED, 0, 0);
       
   701                 break;
       
   702             default:
       
   703                 SDL_SendWindowEvent(data->window,
       
   704                     SDL_WINDOWEVENT_RESTORED, 0, 0);
       
   705                 break;
       
   706             }
   693         }
   707         }
   694         break;
   708         break;
   695 
   709 
   696     case WM_SETCURSOR:
   710     case WM_SETCURSOR:
   697         {
   711         {