From 70d2ee909dc835e9c45dfb7b057445a07251e258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Wed, 14 Feb 2018 14:36:39 +0100 Subject: [PATCH] Test fullscreen loader --- src/main/app.js | 38 ++++++++++++++++++++++++-------------- static/preload-window.html | 4 ++-- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/main/app.js b/src/main/app.js index cd498c9b..6820f6e3 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -118,7 +118,10 @@ function createMainWindow() { }) }) - return window + return { + w: window, + options: windowOptions, + } } function createDevWindow() { @@ -153,6 +156,7 @@ function createDevWindow() { saveWindowSettings(window) window.loadURL(`${url}/#/dev`) + window.setMenu(null) window.on('close', handleCloseWindow(window)) @@ -169,29 +173,19 @@ function createDevWindow() { function createPreloadWindow() { // Preload renderer of main windows - mainWindow = createMainWindow() + const { w, options } = createMainWindow() - const [x, y] = mainWindow.getPosition() + mainWindow = w if (__DEV__) { devWindow = createDevWindow() } - const height = 144 - const width = 256 - const windowOptions = { - ...defaultWindowOptions, - ...getWindowPosition(height, width, screen.getDisplayNearestPoint({ x, y })), + ...options, alwaysOnTop: true, closable: false, - frame: false, fullscreenable: false, - height, - resizable: false, - show: false, - skipTaskbar: true, - width, } const window = new BrowserWindow(windowOptions) @@ -199,9 +193,25 @@ function createPreloadWindow() { window.name = 'PreloadWindow' window.loadURL(`file://${__static}/preload-window.html`) + window.setMenu(null) + + window.on('resize', () => { + const [width, height] = window.getSize() + if (mainWindow) { + mainWindow.setSize(width, height) + } + }) + + window.on('move', () => { + const [x, y] = window.getPosition() + if (mainWindow) { + mainWindow.setPosition(x, y) + } + }) window.on('ready-to-show', () => { window.show() + setImmediate(() => window && window.focus()) }) return window diff --git a/static/preload-window.html b/static/preload-window.html index 55c07b82..1e75b04f 100644 --- a/static/preload-window.html +++ b/static/preload-window.html @@ -23,8 +23,8 @@ } #app video { - height: 100%; - width: 100%; + height: 144px; + width: 256px; }