fix: move window buttons in-place on macOS #30322
Merged
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.
Description of Change
Close #30039.
The refactor #27489 put window buttons in a custom view to make it possible to dynamically control position and visibility of window buttons. With this approach macOS no longer synchronize window states with the window buttons, and we have been doing manual updates to work around it.
However for issue #30039, I find no way to fix it without using private APIs. So in this PR I removed the custom view, and controlled the window buttons without changing their view hierarchy instead. The downside of this approach is, we have to deal with internal view structure of NSWindow, but this is what we used to do before #27489 anyway.
This PR does not remove the benefits brought by #27489, and makes code of
NativeWindowMac
cleaner.Release Notes
Notes: Fix
documentEdited
status not updating close button for frameless window on macOS.