Browse Source

Test fullscreen loader

master
Loëck Vézien 7 years ago
parent
commit
70d2ee909d
No known key found for this signature in database GPG Key ID: CBCDCE384E853AC4
  1. 38
      src/main/app.js
  2. 4
      static/preload-window.html

38
src/main/app.js

@ -118,7 +118,10 @@ function createMainWindow() {
}) })
}) })
return window return {
w: window,
options: windowOptions,
}
} }
function createDevWindow() { function createDevWindow() {
@ -153,6 +156,7 @@ function createDevWindow() {
saveWindowSettings(window) saveWindowSettings(window)
window.loadURL(`${url}/#/dev`) window.loadURL(`${url}/#/dev`)
window.setMenu(null) window.setMenu(null)
window.on('close', handleCloseWindow(window)) window.on('close', handleCloseWindow(window))
@ -169,29 +173,19 @@ function createDevWindow() {
function createPreloadWindow() { function createPreloadWindow() {
// Preload renderer of main windows // Preload renderer of main windows
mainWindow = createMainWindow() const { w, options } = createMainWindow()
const [x, y] = mainWindow.getPosition() mainWindow = w
if (__DEV__) { if (__DEV__) {
devWindow = createDevWindow() devWindow = createDevWindow()
} }
const height = 144
const width = 256
const windowOptions = { const windowOptions = {
...defaultWindowOptions, ...options,
...getWindowPosition(height, width, screen.getDisplayNearestPoint({ x, y })),
alwaysOnTop: true, alwaysOnTop: true,
closable: false, closable: false,
frame: false,
fullscreenable: false, fullscreenable: false,
height,
resizable: false,
show: false,
skipTaskbar: true,
width,
} }
const window = new BrowserWindow(windowOptions) const window = new BrowserWindow(windowOptions)
@ -199,9 +193,25 @@ function createPreloadWindow() {
window.name = 'PreloadWindow' window.name = 'PreloadWindow'
window.loadURL(`file://${__static}/preload-window.html`) 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.on('ready-to-show', () => {
window.show() window.show()
setImmediate(() => window && window.focus())
}) })
return window return window

4
static/preload-window.html

@ -23,8 +23,8 @@
} }
#app video { #app video {
height: 100%; height: 144px;
width: 100%; width: 256px;
} }
</style> </style>
</head> </head>

Loading…
Cancel
Save