Cache browser visibility state & emit visibilitychange event on change

Fixes #3788
This commit is contained in:
Arek Sredzki 2016-03-07 01:26:36 -08:00
parent 377a8eefb2
commit ee61ab2d26
4 changed files with 35 additions and 12 deletions

View file

@ -88,6 +88,18 @@ BrowserWindow.prototype._init = function() {
};
})(this));
// Evented visibilityState changes
this.on('minimize', (function(_this) {
return function() {
return _this.webContents.send('ATOM_RENDERER_WINDOW_VISIBILITY_CHANGE', false);
};
})(this));
this.on('restore', (function(_this) {
return function() {
return _this.webContents.send('ATOM_RENDERER_WINDOW_VISIBILITY_CHANGE', true);
};
})(this));
// Notify the creation of the window.
app.emit('browser-window-created', {}, this);