Browse Source

Don't apply creation window flags to external windows.

Whoever provided the window has already set it up the way they want it.

Fixes SDL removing iconified or maximized state when creating a window from an existing OS window.
Sam Lantinga 1 năm trước cách đây
mục cha
commit
21411c6418
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      src/video/SDL_video.c

+ 8 - 3
src/video/SDL_video.c

@@ -2146,9 +2146,14 @@ static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags)
 static void SDL_FinishWindowCreation(SDL_Window *window, SDL_WindowFlags flags)
 {
     PrepareDragAndDropSupport(window);
-    ApplyWindowFlags(window, flags);
-    if (!(flags & SDL_WINDOW_HIDDEN)) {
-        SDL_ShowWindow(window);
+
+    if (window->flags & SDL_WINDOW_EXTERNAL) {
+        // Whoever has created the window has already applied whatever flags are needed
+    } else {
+        ApplyWindowFlags(window, flags);
+        if (!(flags & SDL_WINDOW_HIDDEN)) {
+            SDL_ShowWindow(window);
+        }
     }
 }