Fix windows created with SDL_WINDOW_MINIMIZED having inconsistent SDL_WINDOW_HIDDEN flag on Windows

- Windows created minimized are shown with SW_SHOWMINNOACTIVE which does not send WM_SHOWWINDOW leaving the window visible (but minimized)
  on desktop but still with the SDL_WINDOW_HIDDEN flag set. Now the hidden flag is cleared in this case but noted that this means it's not currently possible
  to create a window that is initially hidden that then is minimized once shown.
main
Sam Lantinga 2023-07-06 18:14:27 -07:00
parent be79f62cb7
commit 565e95ac4e
1 changed files with 5 additions and 0 deletions

View File

@ -567,6 +567,11 @@ int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE);
if (window->flags & SDL_WINDOW_MINIMIZED) {
/* TODO: We have to clear SDL_WINDOW_HIDDEN here to ensure the window flags match the window state. The
window is already shown after this and windows with WS_MINIMIZE do not generate a WM_SHOWWINDOW. This
means you can't currently create a window that is initially hidden and is minimized when shown.
*/
window->flags &= ~SDL_WINDOW_HIDDEN;
ShowWindow(hwnd, SW_SHOWMINNOACTIVE);
}