Merge pull request #9814 from shubham2892/fix-fullscreen-with-resizable-flag
Fix full screen when resizable is set to true
This commit is contained in:
commit
c39f5f1fad
2 changed files with 24 additions and 0 deletions
|
@ -173,6 +173,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
atom::NativeWindowMac* shell_;
|
atom::NativeWindowMac* shell_;
|
||||||
bool is_zooming_;
|
bool is_zooming_;
|
||||||
int level_;
|
int level_;
|
||||||
|
bool is_resizable_;
|
||||||
}
|
}
|
||||||
- (id)initWithShell:(atom::NativeWindowMac*)shell;
|
- (id)initWithShell:(atom::NativeWindowMac*)shell;
|
||||||
@end
|
@end
|
||||||
|
@ -335,6 +336,9 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
|
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
|
||||||
|
// Setting resizable to true before entering fullscreen
|
||||||
|
is_resizable_ = shell_->IsResizable();
|
||||||
|
shell_->SetResizable(true);
|
||||||
// Hide the native toolbar before entering fullscreen, so there is no visual
|
// Hide the native toolbar before entering fullscreen, so there is no visual
|
||||||
// artifacts.
|
// artifacts.
|
||||||
if (base::mac::IsAtLeastOS10_10() &&
|
if (base::mac::IsAtLeastOS10_10() &&
|
||||||
|
@ -394,6 +398,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidExitFullScreen:(NSNotification*)notification {
|
- (void)windowDidExitFullScreen:(NSNotification*)notification {
|
||||||
|
shell_->SetResizable(is_resizable_);
|
||||||
shell_->NotifyWindowLeaveFullScreen();
|
shell_->NotifyWindowLeaveFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2180,6 +2180,25 @@ describe('BrowserWindow module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('fullscreen state with resizable set', function () {
|
||||||
|
// Only implemented on macOS.
|
||||||
|
if (process.platform !== 'darwin') return
|
||||||
|
|
||||||
|
it('resizable flag should be set to true and restored', function (done) {
|
||||||
|
w.destroy()
|
||||||
|
w = new BrowserWindow({ resizable: false })
|
||||||
|
w.once('enter-full-screen', () => {
|
||||||
|
assert.equal(w.isResizable(), true)
|
||||||
|
w.setFullScreen(false)
|
||||||
|
})
|
||||||
|
w.once('leave-full-screen', () => {
|
||||||
|
assert.equal(w.isResizable(), false)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.setFullScreen(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('fullscreen state', function () {
|
describe('fullscreen state', function () {
|
||||||
// Only implemented on macOS.
|
// Only implemented on macOS.
|
||||||
if (process.platform !== 'darwin') return
|
if (process.platform !== 'darwin') return
|
||||||
|
|
Loading…
Reference in a new issue