(winName, { sizeable = true, noChrome = false, useCustomTitle = true, skipTaskbar = false, noSelect = true, show = true, parent = null, title = null, fixed = false, frame = true, move = true, preload = null, fixedOnTop = true} = {})
| 922 | */ |
| 923 | /* eslint-disable-next-line complexity */ |
| 924 | createSubWindow(winName, { sizeable = true, noChrome = false, useCustomTitle = true, skipTaskbar = false, noSelect = true, show = true, parent = null, title = null, fixed = false, frame = true, move = true, preload = null, fixedOnTop = true} = {}) { |
| 925 | const realCenter = this.getRealCenter(winName) |
| 926 | const winSettings = this.checkValidPlacement(this.#settings.get(`wins.${winName}`)) |
| 927 | const winTitle = ( title === null ) ? this.l10n.syncStringLookup('app_name') : title |
| 928 | const thisWindow = new BrowserWindow({ |
| 929 | alwaysOnTop : fixedOnTop && fixed, |
| 930 | autoHideMenuBar : true, |
| 931 | frame : frame, |
| 932 | fullscreenable : !fixed, |
| 933 | height : winSettings.h, |
| 934 | icon : this.#path.icon, |
| 935 | maximizable : !fixed, |
| 936 | minimizable : !fixed, |
| 937 | movable : move, |
| 938 | parent : ( parent === null || this.win[parent] === null ) ? null : this.win[parent], |
| 939 | resizable : sizeable, |
| 940 | show : show, |
| 941 | skipTaskbar : skipTaskbar, |
| 942 | title : winTitle, |
| 943 | width : winSettings.w, |
| 944 | x : winSettings.x > -1 ? Math.floor(winSettings.x) : realCenter.x, |
| 945 | y : winSettings.y > -1 ? Math.floor(winSettings.y) : realCenter.y, |
| 946 | |
| 947 | // titleBarOverlay : false, |
| 948 | |
| 949 | titleBarOverlay : noChrome ? false : { |
| 950 | color : this.#themeColors[this.#themeCurrentColor].background, |
| 951 | symbolColor : this.#themeColors[this.#themeCurrentColor].font, |
| 952 | height : 25, |
| 953 | }, |
| 954 | titleBarStyle : useCustomTitle ? 'hidden' : 'default', |
| 955 | |
| 956 | webPreferences : { |
| 957 | contextIsolation : true, |
| 958 | nodeIntegration : false, |
| 959 | preload : (preload === null ) ? null : path.join(this.#path.preload, `preload-${preload}.js`), |
| 960 | spellcheck : false, |
| 961 | }, |
| 962 | }) |
| 963 | |
| 964 | if ( noSelect ) { this.#handleSelectKeys(thisWindow) } |
| 965 | |
| 966 | if ( winName === 'mini' ) { |
| 967 | thisWindow.webContents.on('before-input-event', (event, input) => { |
| 968 | if ( input.control && input.code === 'Space' ) { |
| 969 | serveIPC.refFunc.gameLauncher() |
| 970 | event.preventDefault() |
| 971 | } |
| 972 | }) |
| 973 | } |
| 974 | |
| 975 | if ( winName !== 'splash' ) { this.#handleMoveResize(thisWindow, winName) } |
| 976 | |
| 977 | if ( !this.#debug ) { thisWindow.removeMenu() } |
| 978 | if ( winSettings.m ) { thisWindow.maximize() } |
| 979 | return thisWindow |
| 980 | } |
| 981 |
no test coverage detected