Repository navigation
Move the macOS window buttons in from the window edge - #56
Merged
Merged
Conversation
The close, minimise and zoom buttons sat at AppKit's default 9 pt from the top-left corner, tight against the edge and above the header's title row. Centre them on the title row instead: 17 pt clear of the left and top edges at 100 % interface zoom, following the zoom like the rest of the header. AppKit lays the titlebar out again on resize, focus and display changes, so the placement is re-applied on those window events.
…de error winit's last resize of the full-screen exit arrives while the window is still in full screen, so AppKit's own layout put the buttons back at the top edge until the next focus change. Observe NSWindowDidExitFullScreenNotification and place them again then (and once more after the next layout pass). The placement maths is only used by the macOS path and the tests, so allow dead code on other platforms.
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.
What
On macOS the main window's close, minimise and zoom buttons sat at AppKit's default position, 9 pt from the window's top-left corner: tight against the edge and above the header's title row.
They now sit on the header's title row, 17 pt clear of the left and top edges at 100 % interface zoom (close button centred 24 pt from the corner), and the inset follows View › Zoom like the rest of the header.
crates/dstudio-app/src/window_buttons.rs: grows the titlebar container so the buttons stay clickable and moves the three buttons, keeping AppKit's own spacing between them. Skipped in full screen. No-op off macOS.NSWindowDidExitFullScreenNotification(winit's last resize of a full-screen exit arrives while the window is still in full screen). When the buttons are already in place it only reads frames.Checked on macOS (debug build, 1x display): close button at 17 pt / 17 pt after launch, after resizing (1200×760, 1500×900), switching apps and back, minimise and restore, Zoom In (18 pt at 105 %) and Reset Zoom, and after three full-screen exits (toggle and green button). Hovering still shows the button glyphs.
Screenshots
Top-left corner, before and after:
Benchmarks
No render-path change: the placement runs only on resize, focus, display, zoom and full-screen-exit events, never per frame.
Docs