From bc33e8933e413a77ca261cace18f25a560c21081 Mon Sep 17 00:00:00 2001 From: Johan Kwarnmark Date: Thu, 23 Jan 2020 16:15:21 +0100 Subject: [PATCH] SDA-1708 Move screen-sharing indicator to the same screen as Symphony Application --- src/app/window-handler.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 094dbb79..ed9fe119 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -440,7 +440,7 @@ export class WindowHandler { /** * Move window to the same screen as main window */ - public moveWindow(windowToMove: BrowserWindow) { + public moveWindow(windowToMove: BrowserWindow, fixedYPosition?: number) { if (this.mainWindow && windowExists(this.mainWindow)) { const display = electron.screen.getDisplayMatching(this.mainWindow.getBounds()); @@ -460,7 +460,14 @@ export class WindowHandler { positionX = display.workArea.x; } - let positionY = Math.trunc(display.workArea.y + display.workArea.height / 2 - windowToMove.getBounds().height / 2); + let positionY; + if (fixedYPosition) { + positionY = Math.trunc(display.workArea.y + fixedYPosition); + } else { + // Center the window in y-axis + positionY = Math.trunc(display.workArea.y + display.workArea.height / 2 - windowToMove.getBounds().height / 2); + } + if (positionY < display.workArea.y) { positionY = display.workArea.y; } @@ -785,6 +792,7 @@ export class WindowHandler { } this.screenSharingIndicatorWindow = createComponentWindow('screen-sharing-indicator', opts); + this.moveWindow(this.screenSharingIndicatorWindow, topPositionOfIndicatorScreen); this.screenSharingIndicatorWindow.setVisibleOnAllWorkspaces(true); this.screenSharingIndicatorWindow.webContents.once('did-finish-load', () => { if (!this.screenSharingIndicatorWindow || !windowExists(this.screenSharingIndicatorWindow)) {