Skip to content

winit-win32: Fix Window focus after showing hidden maximized window#4587

Open
rhysd wants to merge 1 commit into
rust-windowing:masterfrom
rhysd:issue-4586
Open

winit-win32: Fix Window focus after showing hidden maximized window#4587
rhysd wants to merge 1 commit into
rust-windowing:masterfrom
rhysd:issue-4586

Conversation

@rhysd
Copy link
Copy Markdown
Contributor

@rhysd rhysd commented Jun 4, 2026

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

Fixes #4586

Previously winit could call ShowWindow(SW_MAXIMIZE) while the window was still hidden. It could disturb Win32’s focus state. The fix delays the call until the window is actually shown avoiding calling it twice.

@rhysd
Copy link
Copy Markdown
Contributor Author

rhysd commented Jun 4, 2026

CI failed inside winit-x11, which should not be related to this PR's change.

error: iterating on a map's values
    --> winit-x11/src/event_processor.rs:1760:31
     |
1760 |                 for window in self.target.windows.borrow().iter().filter_map(|(_, w)| w.upgrade()) {
     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.target.windows.borrow().values().filter_map(|w| w.upgrade())`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#iter_kv_map
     = note: `-D clippy::iter-kv-map` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::iter_kv_map)]`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Focus is broken when an invisible window is created with maximized

1 participant