win32: avoid showing hidden windows when applying window state#4575
Open
YelovSK wants to merge 1 commit into
Open
win32: avoid showing hidden windows when applying window state#4575YelovSK wants to merge 1 commit into
YelovSK wants to merge 1 commit into
Conversation
joe-loach
added a commit
to joe-loach/winit
that referenced
this pull request
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows,
ShowWindow(SW_MAXIMIZE)andShowWindow(SW_MINIMIZE)can make a hidden window visible.This currently causes a problem when a window is configured while hidden. For example, eframe creates its window hidden, applies the persisted maximized state, renders the first frame, and only then shows the window. But when winit applies the maximized state, it calls
ShowWindow(SW_MAXIMIZE)even though the target state is still hidden. The window can briefly appear before the first frame is rendered, causing a white flash.This change avoids calling the show/maximize/minimize
ShowWindowcommands while the target window state is hidden. If the window is supposed to become visible and maximized/minimized, that state is applied when it is shown.It also avoids doing a normal
SW_SHOWfirst when the target state is maximized or minimized, so the window is shown directly in the intended state.Tested with:
cargo +nightly fmtcargo check -p winit-win32Also tested downstream in an eframe app on Windows, where this fixes the startup flash when reopening a persisted maximized window. An example of the flicker/flash is shown in this egui issue - emilk/egui#7746.
changelogmodule if knowledge of this change could be valuable to users