fix: setMaximizable to be true if window is resizable & maximizable (#14648)
* setMaximizable to be true if window is resizable & maximizable * Fix linting * Add regressive test to verify maxmizable state * Leaves maximizable state of window alone if setResizable is called * Fix exclusive test * Fix crashing text * SetMaximizable unconditionally * Remember former maximizable state * Fix accidental mac variable deletion * Logic modification * Lint * Remove unneeded test * Remove unneeded variable since only Windows is effect
This commit is contained in:
parent
c9bc3471e7
commit
560b1c17af
2 changed files with 8 additions and 2 deletions
|
@ -591,6 +591,7 @@ void NativeWindowViews::SetResizable(bool resizable) {
|
||||||
// both the minimum and maximum size to the window size to achieve it.
|
// both the minimum and maximum size to the window size to achieve it.
|
||||||
if (resizable) {
|
if (resizable) {
|
||||||
SetContentSizeConstraints(old_size_constraints_);
|
SetContentSizeConstraints(old_size_constraints_);
|
||||||
|
SetMaximizable(maximizable_);
|
||||||
} else {
|
} else {
|
||||||
old_size_constraints_ = GetContentSizeConstraints();
|
old_size_constraints_ = GetContentSizeConstraints();
|
||||||
resizable_ = false;
|
resizable_ = false;
|
||||||
|
@ -603,7 +604,6 @@ void NativeWindowViews::SetResizable(bool resizable) {
|
||||||
if (has_frame() && thick_frame_)
|
if (has_frame() && thick_frame_)
|
||||||
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME);
|
FlipWindowStyle(GetAcceleratedWidget(), resizable, WS_THICKFRAME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
resizable_ = resizable;
|
resizable_ = resizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2620,9 +2620,15 @@ describe('BrowserWindow module', () => {
|
||||||
// Only implemented on windows.
|
// Only implemented on windows.
|
||||||
if (process.platform !== 'win32') return
|
if (process.platform !== 'win32') return
|
||||||
|
|
||||||
it('is set to false when resizable state is set to false', () => {
|
it('is reset to its former state', () => {
|
||||||
|
w.setMaximizable(false)
|
||||||
w.setResizable(false)
|
w.setResizable(false)
|
||||||
|
w.setResizable(true)
|
||||||
assert.strictEqual(w.isMaximizable(), false)
|
assert.strictEqual(w.isMaximizable(), false)
|
||||||
|
w.setMaximizable(true)
|
||||||
|
w.setResizable(false)
|
||||||
|
w.setResizable(true)
|
||||||
|
assert.strictEqual(w.isMaximizable(), true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue