Skip to content

Commit

Permalink
Don't apply creation window flags to external windows.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Jul 26, 2024
1 parent 2137e6e commit 21411c6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 21411c6

Please sign in to comment.