Skip to content

Commit

Permalink
Fix window maximization when using splash screen
Browse files Browse the repository at this point in the history
Avoid eager restore of maximized state in `TheiaElectronWindow.init`
when a splash screen is configured (i.e. `preventAutomaticShow` config
option is false)
Calling `window.maximize()` implicity also makes the window visibile.
If `preventAutomaticShow` is true we have to make sure to invoke
`restoreMaximizeState` after the main window is ready.
Otherwise both the splashscreen and the preload window will be visible
at the same time

Fixes #14218
  • Loading branch information
tortmayr committed Sep 25, 2024
1 parent 19556f4 commit d969dc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/electron-main/theia-electron-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export class TheiaElectronWindow {
this._window.setMenuBarVisibility(false);
if (!this.options.preventAutomaticShow) {
this.attachReadyToShow();
this.restoreMaximizedState();
}
this.restoreMaximizedState();
this.attachCloseListeners();
this.trackApplicationState();
this.attachReloadListener();
Expand Down Expand Up @@ -196,6 +196,9 @@ export class TheiaElectronWindow {
protected trackApplicationState(): void {
this.toDispose.push(TheiaRendererAPI.onApplicationStateChanged(this.window.webContents, state => {
this.applicationState = state;
if (state === 'ready' && this.options.preventAutomaticShow) {
this.restoreMaximizedState();
}
}));
}

Expand Down

0 comments on commit d969dc1

Please sign in to comment.