Merge pull request #25 from feross/fix-fullscreen-state
Start in correct full screen state
This commit is contained in:
@@ -15,7 +15,7 @@ app.on('before-quit', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function createMainWindow (menu) {
|
function createMainWindow (menu) {
|
||||||
windows.main = new electron.BrowserWindow({
|
var win = windows.main = new electron.BrowserWindow({
|
||||||
backgroundColor: '#282828',
|
backgroundColor: '#282828',
|
||||||
darkTheme: true,
|
darkTheme: true,
|
||||||
minWidth: 375,
|
minWidth: 375,
|
||||||
@@ -26,23 +26,28 @@ function createMainWindow (menu) {
|
|||||||
width: 450,
|
width: 450,
|
||||||
height: 300
|
height: 300
|
||||||
})
|
})
|
||||||
windows.main.loadURL(config.INDEX)
|
win.loadURL(config.INDEX)
|
||||||
windows.main.webContents.on('did-finish-load', function () {
|
|
||||||
|
win.webContents.on('dom-ready', function () {
|
||||||
|
menu.onToggleFullScreen()
|
||||||
|
})
|
||||||
|
|
||||||
|
win.webContents.on('did-finish-load', function () {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
debug('startup time: %sms', Date.now() - app.startTime)
|
debug('startup time: %sms', Date.now() - app.startTime)
|
||||||
windows.main.show()
|
win.show()
|
||||||
}, 50)
|
}, 50)
|
||||||
})
|
})
|
||||||
windows.main.on('enter-full-screen', menu.onToggleFullScreen)
|
win.on('enter-full-screen', menu.onToggleFullScreen)
|
||||||
windows.main.on('leave-full-screen', menu.onToggleFullScreen)
|
win.on('leave-full-screen', menu.onToggleFullScreen)
|
||||||
windows.main.on('close', function (e) {
|
win.on('close', function (e) {
|
||||||
if (process.platform === 'darwin' && !isQuitting) {
|
if (process.platform === 'darwin' && !isQuitting) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
windows.main.hide()
|
win.hide()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
windows.main.once('closed', function () {
|
win.once('closed', function () {
|
||||||
windows.main = null
|
win = null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ var state = global.state = {
|
|||||||
// history: [], /* track how we got to the current view. enables Back button */
|
// history: [], /* track how we got to the current view. enables Back button */
|
||||||
// historyIndex: 0,
|
// historyIndex: 0,
|
||||||
isFocused: true,
|
isFocused: true,
|
||||||
|
isFullScreen: false,
|
||||||
mainWindowBounds: null, /* x y width height */
|
mainWindowBounds: null, /* x y width height */
|
||||||
title: 'WebTorrent' /* current window title */
|
title: 'WebTorrent' /* current window title */
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user