fix: resizable: false should disable fullscreen button at start (#39086)

fix: resizable should disable fullscreen button at start
This commit is contained in:
Shelley Vohr 2023-07-25 18:18:36 +02:00 committed by GitHub
parent 455f57322f
commit 12548294c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 6 deletions

View file

@ -818,7 +818,24 @@ void NativeWindowMac::MoveTop() {
void NativeWindowMac::SetResizable(bool resizable) {
ScopedDisableResize disable_resize;
SetStyleMask(resizable, NSWindowStyleMaskResizable);
// Right now, resizable and fullscreenable are decoupled in
// documentation and on Windows/Linux. Chromium disables
// fullscreenability if resizability is false on macOS as well
// as disabling the maximize traffic light unless the window
// is both resizable and maximizable. To work around this, we want
// to match behavior on other platforms by disabiliting the maximize
// button but keeping fullscreenability enabled.
// TODO(codebytere): refactor this once we have a better solution.
SetCanResize(resizable);
if (!resizable) {
SetFullScreenable(true);
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:false];
} else {
SetFullScreenable(true);
[[window_ standardWindowButton:NSWindowZoomButton]
setEnabled:IsFullScreenable()];
}
}
bool NativeWindowMac::IsResizable() {