ELECTRON-1396 & ELECTRON-1429 - Fix window constructor opts (#744)

This commit is contained in:
Kiran Niranjan 2019-07-19 17:28:36 +05:30 committed by Vishwas Shashidhar
parent 1d9146ff02
commit f8ea6a778f

View File

@ -1,5 +1,5 @@
import * as electron from 'electron';
import { app, BrowserWindow, crashReporter, globalShortcut, ipcMain } from 'electron';
import { app, BrowserWindow, BrowserWindowConstructorOptions, crashReporter, globalShortcut, ipcMain } from 'electron';
import * as fs from 'fs';
import * as path from 'path';
import { format, parse } from 'url';
@ -397,10 +397,21 @@ export class WindowHandler {
return (window as ICustomBrowserWindow).winName === windowName;
});
this.aboutAppWindow = createComponentWindow(
'about-app',
selectedParentWindow ? { parent: selectedParentWindow } : {},
);
const opts: BrowserWindowConstructorOptions = this.getWindowOpts({
modal: true,
}, {
devTools: false,
});
if (this.mainWindow && windowExists(this.mainWindow) && this.mainWindow.isAlwaysOnTop()) {
opts.alwaysOnTop = true;
}
if (selectedParentWindow) {
opts.parent = selectedParentWindow;
}
this.aboutAppWindow = createComponentWindow('about-app', opts);
this.aboutAppWindow.setVisibleOnAllWorkspaces(true);
this.aboutAppWindow.webContents.once('did-finish-load', async () => {
if (!this.aboutAppWindow || !windowExists(this.aboutAppWindow)) {
@ -425,7 +436,17 @@ export class WindowHandler {
return;
}
this.moreInfoWindow = createComponentWindow('more-info', { width: 550, height: 500 });
const opts: BrowserWindowConstructorOptions = this.getWindowOpts({
width: 550,
height: 500,
}, {
devTools: false,
});
if (this.mainWindow && windowExists(this.mainWindow) && this.mainWindow.isAlwaysOnTop()) {
opts.alwaysOnTop = true;
}
this.moreInfoWindow = createComponentWindow('more-info', opts);
this.moreInfoWindow.webContents.once('did-finish-load', async () => {
if (!this.moreInfoWindow || !windowExists(this.moreInfoWindow)) {
return;
@ -448,16 +469,22 @@ export class WindowHandler {
this.screenPickerWindow.close();
}
const opts = this.getWindowOpts({
const opts: ICustomBrowserWindowConstructorOpts = this.getWindowOpts({
alwaysOnTop: true,
autoHideMenuBar: true,
frame: false,
modal: true,
height: isMac ? 519 : 523,
width: 580,
show: false,
}, {
devTools: false,
});
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow && windowExists(focusedWindow) && isWindowsOS) {
opts.parent = focusedWindow;
}
this.screenPickerWindow = createComponentWindow('screen-picker', opts);
this.screenPickerWindow.webContents.once('did-finish-load', () => {
if (!this.screenPickerWindow || !windowExists(this.screenPickerWindow)) {
@ -639,6 +666,7 @@ export class WindowHandler {
autoHideMenuBar: true,
resizable: false,
alwaysOnTop: true,
fullscreenable: false,
}, {
devTools: false,
}), ...{ winKey: streamId },