Correctly set initial visibilityState
This commit is contained in:
parent
07a4c52919
commit
43c44da50b
8 changed files with 37 additions and 17 deletions
|
@ -79,7 +79,7 @@ BrowserWindow.prototype._init = function () {
|
|||
})
|
||||
|
||||
// Subscribe to visibilityState changes and pass to renderer process.
|
||||
let isVisible = false
|
||||
let isVisible = this.isVisible() && !this.isMinimized()
|
||||
let visibilityChanged = () => {
|
||||
let newState = this.isVisible() && !this.isMinimized()
|
||||
if (isVisible != newState) {
|
||||
|
@ -94,7 +94,8 @@ BrowserWindow.prototype._init = function () {
|
|||
this.on('maximize', visibilityChanged)
|
||||
|
||||
// Make renderer process have correct initial state.
|
||||
visibilityChanged()
|
||||
if (!isVisible)
|
||||
this.webContents.mergeWebPreferences({visibilityState: 'hidden'})
|
||||
|
||||
// Notify the creation of the window.
|
||||
app.emit('browser-window-created', {}, this)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue