diff options
Diffstat (limited to 'gui/src/main/window-controller.ts')
| -rw-r--r-- | gui/src/main/window-controller.ts | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/gui/src/main/window-controller.ts b/gui/src/main/window-controller.ts index cdb7102afb..1904383475 100644 --- a/gui/src/main/window-controller.ts +++ b/gui/src/main/window-controller.ts @@ -151,7 +151,7 @@ export default class WindowController { return this.webContentsValue.isDestroyed() ? undefined : this.webContentsValue; } - constructor(windowValue: BrowserWindow, private tray: Tray, unpinnedWindow: boolean) { + constructor(windowValue: BrowserWindow, tray: Tray, unpinnedWindow: boolean) { const [width, height] = windowValue.getSize(); this.width = width; this.height = height; @@ -165,24 +165,6 @@ export default class WindowController { this.installHideHandler(); } - public replaceWindow(windowValue: BrowserWindow, unpinnedWindow: boolean) { - this.window?.destroy(); - - const [width, height] = windowValue.getSize(); - this.width = width; - this.height = height; - this.windowValue = windowValue; - this.webContentsValue = windowValue.webContents; - - this.windowPositioning = unpinnedWindow - ? new StandaloneWindowPositioning() - : new AttachedToTrayWindowPositioning(this.tray); - - this.installDisplayMetricsHandler(); - this.installHideHandler(); - this.updatePosition(); - } - public show(whenReady = true) { if (whenReady) { this.executeWhenWindowIsReady(() => this.showImmediately()); @@ -216,6 +198,12 @@ export default class WindowController { this.notifyUpdateWindowShape(); } + public destroy() { + if (this.window && !this.window.isDestroyed()) { + this.window.destroy(); + } + } + private installHideHandler() { this.window?.addListener('hide', () => this.windowPositioningScheduler.cancel()); this.window?.addListener('closed', () => this.windowPositioningScheduler.cancel()); |
