Skip to content

fix(gpui-windows): keep an owned window maximized across its owner's minimize and restore - #135

Merged
guyverino merged 1 commit into
masterfrom
fix/owned-window-keeps-maximized
Oct 30, 2026
Merged

guyverino merged 1 commit into
masterfrom
fix/owned-window-keeps-maximized

Conversation

@guyverino

Copy link
Copy Markdown
Collaborator

Problem

A maximized owned window (a detached panel or tool window owned by an application window) comes back un-maximized, at its restore rectangle, every time its owner is minimized and restored.

This is stock Windows behaviour, not GPUI's. When the owner is minimized, Windows hides its owned windows. On restore it re-shows them with WM_SHOWWINDOW(TRUE, SW_PARENTOPENING), and DefWindowProc answers that with SW_SHOWNOACTIVATE, which drops a maximized window to its restore rectangle. A bare Win32 window pair with no GPUI involved shows the same thing (showCmd 3 → 1 after one owner minimize/restore), on the owner's monitor as well as on a second one.

Fix

handle_window_visibility_changed (moon-gpui-windows/src/events.rs) now receives lparam. For SW_PARENTOPENING on a window that is maximized and not iconic, it shows the window with SW_SHOWNA, which keeps its current state, and returns 0. The nested show sends a plain WM_SHOWWINDOW(TRUE, 0), which takes the existing path and draws.

Every other show keeps the default path unchanged: normal windows, fullscreen windows (is_maximized excludes them), and an owned window the user minimized on its own.

The change is recorded in docs/MOON_PATCH_QUEUE.md under the Zed bugfix candidates, with a re-sync note.

Verification

  • The same SW_PARENTOPENING → SW_SHOWNA handling on the bare Win32 pair keeps the owned window maximized across owner minimize/restore, on both monitors.
  • MoonTerminal built against this branch through a local [patch]: a maximized detached panel on a second monitor stays maximized across repeated main-window minimize/restore (checked live).
  • The MoonTerminal workspace tests pass against it (8776 passed, 0 failed).
  • cargo fmt --all -- --check passes. cargo clippy -p moon-gpui-windows reports nothing in the changed function.

…minimize and restore

When an owner window is minimized, Windows hides its owned windows and, on
restore, re-shows them with WM_SHOWWINDOW(TRUE, SW_PARENTOPENING).
DefWindowProc answers that with SW_SHOWNOACTIVATE, which drops a maximized
window to its restore rectangle, so every owner restore silently
un-maximized a detached panel or tool window.

A maximized, non-iconic window now takes SW_SHOWNA, which shows it in its
current state, and the message returns 0. Every other show, including an
owned window the user minimized on its own, keeps the default path.

Recorded in docs/MOON_PATCH_QUEUE.md as a Zed bugfix candidate.
@guyverino
guyverino merged commit 798359a into master Oct 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant