fix: fullscreen crashing with roundedCorners: false
(#35421)
This commit is contained in:
parent
70d6cbfb44
commit
a3a9463024
3 changed files with 11 additions and 2 deletions
|
@ -246,7 +246,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||||
* `trafficLightPosition` [Point](structures/point.md) (optional) _macOS_ -
|
* `trafficLightPosition` [Point](structures/point.md) (optional) _macOS_ -
|
||||||
Set a custom position for the traffic light buttons in frameless windows.
|
Set a custom position for the traffic light buttons in frameless windows.
|
||||||
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
* `roundedCorners` boolean (optional) _macOS_ - Whether frameless window
|
||||||
should have rounded corners on macOS. Default is `true`.
|
should have rounded corners on macOS. Default is `true`. Setting this property
|
||||||
|
to `false` will prevent the window from being fullscreenable.
|
||||||
* `fullscreenWindowTitle` boolean (optional) _macOS_ _Deprecated_ - Shows
|
* `fullscreenWindowTitle` boolean (optional) _macOS_ _Deprecated_ - Shows
|
||||||
the title in the title bar in full screen mode on macOS for `hiddenInset`
|
the title in the title bar in full screen mode on macOS for `hiddenInset`
|
||||||
titleBarStyle. Default is `false`.
|
titleBarStyle. Default is `false`.
|
||||||
|
|
|
@ -299,7 +299,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
|
||||||
bool rounded_corner = true;
|
bool rounded_corner = true;
|
||||||
options.Get(options::kRoundedCorners, &rounded_corner);
|
options.Get(options::kRoundedCorners, &rounded_corner);
|
||||||
if (!rounded_corner && !has_frame())
|
if (!rounded_corner && !has_frame())
|
||||||
styleMask = 0;
|
styleMask = NSWindowStyleMaskBorderless;
|
||||||
|
|
||||||
if (minimizable)
|
if (minimizable)
|
||||||
styleMask |= NSWindowStyleMaskMiniaturizable;
|
styleMask |= NSWindowStyleMaskMiniaturizable;
|
||||||
|
@ -691,6 +691,9 @@ bool NativeWindowMac::HandleDeferredClose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetFullScreen(bool fullscreen) {
|
void NativeWindowMac::SetFullScreen(bool fullscreen) {
|
||||||
|
if (!has_frame() && !HasStyleMask(NSWindowStyleMaskTitled))
|
||||||
|
return;
|
||||||
|
|
||||||
// [NSWindow -toggleFullScreen] is an asynchronous operation, which means
|
// [NSWindow -toggleFullScreen] is an asynchronous operation, which means
|
||||||
// that it's possible to call it while a fullscreen transition is currently
|
// that it's possible to call it while a fullscreen transition is currently
|
||||||
// in process. This can create weird behavior (incl. phantom windows),
|
// in process. This can create weird behavior (incl. phantom windows),
|
||||||
|
|
|
@ -1450,6 +1450,11 @@ describe('BrowserWindow module', () => {
|
||||||
expect(w.fullScreen).to.be.true();
|
expect(w.fullScreen).to.be.true();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not go fullscreen if roundedCorners are enabled', async () => {
|
||||||
|
w = new BrowserWindow({ frame: false, roundedCorners: false, fullscreen: true });
|
||||||
|
expect(w.fullScreen).to.be.false();
|
||||||
|
});
|
||||||
|
|
||||||
it('can be changed', () => {
|
it('can be changed', () => {
|
||||||
w.fullScreen = false;
|
w.fullScreen = false;
|
||||||
expect(w.fullScreen).to.be.false();
|
expect(w.fullScreen).to.be.false();
|
||||||
|
|
Loading…
Reference in a new issue