Skip to content

Commit 53c09a8

Browse files
authored
fix: window maximization when using splash screen (#14219)
Avoids eager restore of maximized state in TheiaElectronWindow. Calling `window.maximize()` implicitly also makes the window visible. Therefore we have to check if the window is already visible before restoring the maximizeState. If the window is not yet visible yet we restore the state once the window is shown. Fixes #14218
1 parent f6d6da0 commit 53c09a8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/core/src/electron-main/theia-electron-window.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,18 @@ export class TheiaElectronWindow {
186186
}
187187

188188
protected restoreMaximizedState(): void {
189-
if (this.options.isMaximized) {
190-
this._window.maximize();
189+
const restore = () => {
190+
if (this.options.isMaximized) {
191+
this._window.maximize();
192+
} else {
193+
this._window.unmaximize();
194+
}
195+
};
196+
197+
if (this._window.isVisible()) {
198+
restore();
191199
} else {
192-
this._window.unmaximize();
200+
this._window.once('show', () => restore());
193201
}
194202
}
195203

0 commit comments

Comments
 (0)