fix: resizable: false
should disable fullscreen button at start (#39086)
fix: resizable should disable fullscreen button at start
This commit is contained in:
parent
455f57322f
commit
12548294c0
2 changed files with 26 additions and 6 deletions
|
@ -198,10 +198,6 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||||
SetSizeConstraints(size_constraints);
|
SetSizeConstraints(size_constraints);
|
||||||
}
|
}
|
||||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
|
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
|
||||||
bool resizable;
|
|
||||||
if (options.Get(options::kResizable, &resizable)) {
|
|
||||||
SetResizable(resizable);
|
|
||||||
}
|
|
||||||
bool closable;
|
bool closable;
|
||||||
if (options.Get(options::kClosable, &closable)) {
|
if (options.Get(options::kClosable, &closable)) {
|
||||||
SetClosable(closable);
|
SetClosable(closable);
|
||||||
|
@ -223,6 +219,7 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||||
if (options.Get(options::kAlwaysOnTop, &top) && top) {
|
if (options.Get(options::kAlwaysOnTop, &top) && top) {
|
||||||
SetAlwaysOnTop(ui::ZOrderLevel::kFloatingWindow);
|
SetAlwaysOnTop(ui::ZOrderLevel::kFloatingWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fullscreenable = true;
|
bool fullscreenable = true;
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen) {
|
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen) {
|
||||||
|
@ -231,12 +228,18 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
|
||||||
fullscreenable = false;
|
fullscreenable = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Overridden by 'fullscreenable'.
|
|
||||||
options.Get(options::kFullScreenable, &fullscreenable);
|
options.Get(options::kFullScreenable, &fullscreenable);
|
||||||
SetFullScreenable(fullscreenable);
|
SetFullScreenable(fullscreenable);
|
||||||
if (fullscreen) {
|
|
||||||
|
if (fullscreen)
|
||||||
SetFullScreen(true);
|
SetFullScreen(true);
|
||||||
|
|
||||||
|
bool resizable;
|
||||||
|
if (options.Get(options::kResizable, &resizable)) {
|
||||||
|
SetResizable(resizable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool skip;
|
bool skip;
|
||||||
if (options.Get(options::kSkipTaskbar, &skip)) {
|
if (options.Get(options::kSkipTaskbar, &skip)) {
|
||||||
SetSkipTaskbar(skip);
|
SetSkipTaskbar(skip);
|
||||||
|
|
|
@ -818,7 +818,24 @@ void NativeWindowMac::MoveTop() {
|
||||||
void NativeWindowMac::SetResizable(bool resizable) {
|
void NativeWindowMac::SetResizable(bool resizable) {
|
||||||
ScopedDisableResize disable_resize;
|
ScopedDisableResize disable_resize;
|
||||||
SetStyleMask(resizable, NSWindowStyleMaskResizable);
|
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);
|
SetCanResize(resizable);
|
||||||
|
if (!resizable) {
|
||||||
|
SetFullScreenable(true);
|
||||||
|
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:false];
|
||||||
|
} else {
|
||||||
|
SetFullScreenable(true);
|
||||||
|
[[window_ standardWindowButton:NSWindowZoomButton]
|
||||||
|
setEnabled:IsFullScreenable()];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeWindowMac::IsResizable() {
|
bool NativeWindowMac::IsResizable() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue