From 44fd438df521b26bb360fca7d4fee512415a5ddb Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 1 Feb 2024 17:35:00 +0100 Subject: [PATCH] window - mitigate macOS fullscreen issue with custom title (#203986) --- src/vs/platform/windows/electron-main/windowImpl.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/windows/electron-main/windowImpl.ts b/src/vs/platform/windows/electron-main/windowImpl.ts index c63139f8668..6a237f67d77 100644 --- a/src/vs/platform/windows/electron-main/windowImpl.ts +++ b/src/vs/platform/windows/electron-main/windowImpl.ts @@ -408,7 +408,14 @@ export abstract class BaseWindow extends Disposable implements IBaseWindow { this.transientIsNativeFullScreen = undefined; this.joinNativeFullScreenTransition = undefined; - if (!transitioned && fullscreen && fromRestore) { + // There is one interesting gotcha on macOS: when you are opening a new + // window from a fullscreen window, that new window will immediately + // open fullscreen and emit the `enter-full-screen` event even before we + // reach this method. In that case, we actually will timeout after 10s + // for detecting the transition and as such it is important that we only + // signal to leave fullscreen if the window reports as not being in fullscreen. + + if (!transitioned && fullscreen && fromRestore && this.win && !this.win.isFullScreen()) { // We have seen requests for fullscreen failing eventually after some // time, for example when an OS update was performed and windows restore.