From 40b7af63999addc56e7d44ba10349817fcaaf2c6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Aug 2013 00:10:31 -0700 Subject: [PATCH] Fixed incorrect window state if the window is created grabbed. We don't want to activate the window if it isn't shown yet. --- src/video/windows/SDL_windowswindow.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 156d0f445..d11a6c0e0 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -559,7 +559,7 @@ WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) HWND top; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; - UINT flags = SWP_NOMOVE | SWP_NOSIZE; + UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE; if ( SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS ) ) { top = HWND_TOPMOST; @@ -568,6 +568,10 @@ WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) flags |= SWP_NOZORDER; } + if (!(window->flags & SDL_WINDOW_SHOWN)) { + flags |= SWP_NOACTIVATE; + } + SetWindowPos(hwnd, top, 0, 0, 0, 0, flags); } }