Skip to content

macOS: use the native window frame and keep the restore geometry - #918

Open
nullifyr wants to merge 1 commit into
DreamSourceLab:masterfrom
LANScapes:up/macos-native-frame
Open

nullifyr wants to merge 1 commit into
DreamSourceLab:masterfrom
LANScapes:up/macos-native-frame

Conversation

@nullifyr

@nullifyr nullifyr commented Oct 1, 2026

Copy link
Copy Markdown

On macOS, DSView draws its own title bar on a frameless window. That window has no Window menu entry, no working traffic-light buttons, no native fullscreen, and does not move cleanly between displays.

This change uses the native window frame on macOS only, hiding the drawn title bar and borders there. Windows and Linux are unchanged.

With the native frame, the window's restore geometry needs care:

  • The normal (restore) rectangle is saved from move/resize events only while the window is in its normal state.
  • Native zoom and fullscreen resize the window before its state changes, so when the window becomes maximized or fullscreen the rectangle is taken from normalGeometry(), and fullscreen counts as "not normal" when settings are written at exit.
  • A window that starts maximized is first placed at the saved normal region, so un-maximizing returns it there.

Tested on macOS 26 (Apple silicon, Qt 6.11): move/resize then relaunch; fullscreen then quit then relaunch (the saved normal rectangle survives); zoom then quit (saved as maximized with the right restore rectangle); relaunch maximized then un-zoom (returns to the saved rectangle).

🤖 Generated with Claude Code

https://claude.ai/code/session_01S6AB69CNtvrecQVn1nyvL1

On macOS the frameless window with a drawn title bar breaks the Window
menu, the traffic-light buttons, fullscreen, and moving the window
between displays. Use the native frame there and hide the drawn title
bar and borders.

With the native frame, save the normal (restore) rectangle from move
and resize events only while the window is in its normal state. Native
zoom and fullscreen move and resize the window before its state
changes, so when it becomes maximized or fullscreen, take the rectangle
from normalGeometry() instead. Fullscreen also counts as not normal
when the settings are written at exit. The saved position is the frame
position (the title bar height is taken from the native frame margins)
and the saved size is the client size, matching how the window is
restored with move() and resize().

When the window starts maximized, show it at the saved normal region
and zoom it once the native window exists (Cocoa only restores a window
it zoomed after it was shown), so un-maximizing returns it there.

Other platforms are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6AB69CNtvrecQVn1nyvL1
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