2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-06-17 11:22:20 +00:00

Fix #59 Fullscreen goes to a black screen when clicking close

This commit is contained in:
Jia Hao 2016-01-23 14:47:32 +08:00
parent aa384dc317
commit 40da693cb5

View File

@ -92,15 +92,24 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
setDockBadge(''); setDockBadge('');
}); });
mainWindow.on('close', (e) => { mainWindow.on('close', event => {
if (isOSX()) { if (mainWindow.isFullScreen()) {
// this is called when exiting from clicking the cross button on the window mainWindow.setFullScreen(false);
e.preventDefault(); mainWindow.once('leave-full-screen', maybeHideWindow.bind(this, mainWindow, event));
mainWindow.hide();
} }
maybeHideWindow(mainWindow, event)
}); });
return mainWindow; return mainWindow;
} }
function maybeHideWindow(window, event) {
if (isOSX()) {
// this is called when exiting from clicking the cross button on the window
event.preventDefault();
window.hide();
}
// will close the window on other platforms
}
module.exports = createMainWindow; module.exports = createMainWindow;