mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-09-27 12:09:00 +00:00
Fix #59 Fullscreen goes to a black screen when clicking close
This commit is contained in:
parent
aa384dc317
commit
40da693cb5
@ -92,15 +92,24 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
setDockBadge('');
|
||||
});
|
||||
|
||||
mainWindow.on('close', (e) => {
|
||||
if (isOSX()) {
|
||||
// this is called when exiting from clicking the cross button on the window
|
||||
e.preventDefault();
|
||||
mainWindow.hide();
|
||||
mainWindow.on('close', event => {
|
||||
if (mainWindow.isFullScreen()) {
|
||||
mainWindow.setFullScreen(false);
|
||||
mainWindow.once('leave-full-screen', maybeHideWindow.bind(this, mainWindow, event));
|
||||
}
|
||||
maybeHideWindow(mainWindow, event)
|
||||
});
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user