Merge pull request #829 from johankwarnmarksymphony/sda-1610-2

fix: Don't search for the main window use this.mainWindow, use getDisplayM…
This commit is contained in:
Johan Kwarnmark 2019-12-12 11:07:44 +01:00 committed by GitHub
commit 0ccf690ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -435,14 +435,8 @@ export class WindowHandler {
* Move window to the same screen as main window * Move window to the same screen as main window
*/ */
public moveWindow(windowToMove: BrowserWindow) { public moveWindow(windowToMove: BrowserWindow) {
const allWindows = BrowserWindow.getAllWindows(); if (this.mainWindow && windowExists(this.mainWindow)) {
const display = electron.screen.getDisplayMatching(this.mainWindow.getBounds());
const parentWindow = allWindows.find((window) => {
return (window as ICustomBrowserWindow).winName === 'main';
});
if (parentWindow && windowExists(parentWindow)) {
const display = electron.screen.getDisplayNearestPoint({x: parentWindow.getBounds().x, y: parentWindow.getBounds().y});
logger.info('window-handler: moveWindow, display: ' + JSON.stringify(display.workArea)); logger.info('window-handler: moveWindow, display: ' + JSON.stringify(display.workArea));
logger.info('window-handler: moveWindow, windowToMove: ' + JSON.stringify(windowToMove.getBounds())); logger.info('window-handler: moveWindow, windowToMove: ' + JSON.stringify(windowToMove.getBounds()));