Skip to content

Fix mini window restoring to full size when moved after maximize#104

Merged
PhoenixNil merged 2 commits into
mainfrom
fix/mini-maximized-drag
Jul 19, 2026
Merged

Fix mini window restoring to full size when moved after maximize#104
PhoenixNil merged 2 commits into
mainfrom
fix/mini-maximized-drag

Conversation

@PhoenixNil

@PhoenixNil PhoenixNil commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Problem

Toggling mini mode while the window is maximized only shrinks the HWND with SetWindowSize — the internal zoomed (maximized) flag stays set. When the user then drags the mini window (WM_NCLBUTTONDOWN/HTCAPTION), Windows performs its standard restore-on-drag for maximized windows and snaps the window back to the saved restore rect (full-mode 950x600).

This also explains the reported symptoms: stable repro within one session (the restore rect keeps the pre-maximize size), gone after an app restart (fresh process has no maximize record).

Fix

  • Entering mini (ApplyWindowMode): if the presenter is Maximized, call presenter.Restore() before resizing. The zoomed flag is cleared, so dragging the mini window is a plain move.
  • Expanding back: entering mini from a maximized window sets _restoreMaximizedOnExpand; expanding then re-maximizes after the 950x600 windowed rect is applied. Mode round-trip is symmetric (maximized -> mini -> maximized), and because Maximize() runs after the windowed rect is set, the system-captured restore rect stays the windowed size — manually un-maximizing later yields a normal 950x600 window, not a mini-sized one.

Verification

Debug build passes (only pre-existing WMC1510 warnings in AppSettingsExpander.xaml). UIA runtime round-trip:

  1. maximize -> IsZoomed=True
  2. Toggle Mini -> IsZoomed=False, 330x136 DIP (drag can no longer trigger restore-on-drag)
  3. Expand -> IsZoomed=True (returns to maximized)
  4. manual un-maximize -> IsZoomed=False, 950x600 DIP (sane restore rect)

Fixes #102

🤖 Generated with Claude Code

PhoenixNil and others added 2 commits July 20, 2026 00:09
Resizing a maximized window keeps its zoomed flag set, so dragging the
mini window triggered the shell's restore-on-drag and snapped it back to
full-mode size. Restore the presenter first when entering mini mode.

Fixes #102

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Entering mini from a maximized window now remembers that state, and
expanding maximizes again after the windowed rect is applied - so the
restore rect stays the windowed size, not the mini rect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PhoenixNil
PhoenixNil merged commit ac3b1c9 into main Jul 19, 2026
3 checks passed
@PhoenixNil
PhoenixNil deleted the fix/mini-maximized-drag branch July 20, 2026 02:09
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.

一个问题/Bug

1 participant