Переглянути джерело

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.
Sam Lantinga 2 роки тому
батько
коміт
565e95ac4e
1 змінених файлів з 5 додано та 0 видалено
  1. 5 0
      src/video/windows/SDL_windowswindow.c

+ 5 - 0
src/video/windows/SDL_windowswindow.c

@@ -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);
     }