Skip to content

Commit

Permalink
fix: window maximization when using splash screen (#14219)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tortmayr authored Dec 12, 2024
1 parent f6d6da0 commit 53c09a8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/core/src/electron-main/theia-electron-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,18 @@ export class TheiaElectronWindow {
}

protected restoreMaximizedState(): void {
if (this.options.isMaximized) {
this._window.maximize();
const restore = () => {
if (this.options.isMaximized) {
this._window.maximize();
} else {
this._window.unmaximize();
}
};

if (this._window.isVisible()) {
restore();
} else {
this._window.unmaximize();
this._window.once('show', () => restore());
}
}

Expand Down

0 comments on commit 53c09a8

Please sign in to comment.