src/video/windows/SDL_windowsevents.c
changeset 7941 7c249ca44069
parent 7912 10eff60470b3
child 7975 1b49b680f319
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Sun Nov 10 11:51:06 2013 -0800
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Sun Nov 10 14:10:00 2013 -0800
     1.3 @@ -312,15 +312,15 @@
     1.4      }
     1.5  
     1.6  #ifdef WMMSG_DEBUG
     1.7 -	{
     1.8 -		char message[1024];
     1.9 -		if (msg > MAX_WMMSG) {
    1.10 -			SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
    1.11 -		} else {
    1.12 -			SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
    1.13 -		}
    1.14 -		OutputDebugStringA(message);
    1.15 -	}
    1.16 +    {
    1.17 +        char message[1024];
    1.18 +        if (msg > MAX_WMMSG) {
    1.19 +            SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam);
    1.20 +        } else {
    1.21 +            SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam);
    1.22 +        }
    1.23 +        OutputDebugStringA(message);
    1.24 +    }
    1.25  #endif /* WMMSG_DEBUG */
    1.26  
    1.27      if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata))
    1.28 @@ -348,12 +348,6 @@
    1.29                  SHORT keyState;
    1.30  
    1.31                  SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
    1.32 -                SDL_SendWindowEvent(data->window,
    1.33 -                                    SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.34 -                if (IsZoomed(hwnd)) {
    1.35 -                    SDL_SendWindowEvent(data->window,
    1.36 -                                        SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
    1.37 -                }
    1.38                  if (SDL_GetKeyboardFocus() != data->window) {
    1.39                      SDL_SetKeyboardFocus(data->window);
    1.40                  }
    1.41 @@ -400,10 +394,6 @@
    1.42                  if (SDL_GetKeyboardFocus() == data->window) {
    1.43                      SDL_SetKeyboardFocus(NULL);
    1.44                  }
    1.45 -                if (minimized) {
    1.46 -                    SDL_SendWindowEvent(data->window,
    1.47 -                                        SDL_WINDOWEVENT_MINIMIZED, 0, 0);
    1.48 -                }
    1.49              }
    1.50          }
    1.51          returnCode = 0;
    1.52 @@ -596,10 +586,14 @@
    1.53              BOOL menu;
    1.54              BOOL constrain_max_size;
    1.55  
    1.56 -            /* If we allow resizing, let the resize happen naturally */
    1.57              if (SDL_IsShapedWindow(data->window))
    1.58                  Win32_ResizeWindowShape(data->window);
    1.59  
    1.60 +            /* If this is an expected size change, allow it */
    1.61 +            if (data->expected_resize) {
    1.62 +                break;
    1.63 +            }
    1.64 +
    1.65              /* Get the current position of our window */
    1.66              GetWindowRect(hwnd, &size);
    1.67              x = size.left;
    1.68 @@ -693,6 +687,26 @@
    1.69          }
    1.70          break;
    1.71  
    1.72 +    case WM_SIZE:
    1.73 +        {
    1.74 +            switch (wParam)
    1.75 +            {
    1.76 +            case SIZE_MAXIMIZED:
    1.77 +                SDL_SendWindowEvent(data->window,
    1.78 +                    SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
    1.79 +                break;
    1.80 +            case SIZE_MINIMIZED:
    1.81 +                SDL_SendWindowEvent(data->window,
    1.82 +                    SDL_WINDOWEVENT_MINIMIZED, 0, 0);
    1.83 +                break;
    1.84 +            default:
    1.85 +                SDL_SendWindowEvent(data->window,
    1.86 +                    SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.87 +                break;
    1.88 +            }
    1.89 +        }
    1.90 +        break;
    1.91 +
    1.92      case WM_SETCURSOR:
    1.93          {
    1.94              Uint16 hittest;