Ensure window exits fullscreen before closing (#4376)

This commit is contained in:
82ba10b5e8dc 2020-06-30 09:41:29 -07:00 committed by GitHub
parent fd6358ac9d
commit 22a4cb079c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

16
main.js
View File

@ -403,7 +403,21 @@ async function createWindow() {
// Prevent the shutdown
e.preventDefault();
mainWindow.hide();
/**
* if the user is in fullscreen mode and closes the window, not the
* application, we need them leave fullscreen first before closing it to
* prevent a black screen.
*
* issue: https://github.com/signalapp/Signal-Desktop/issues/4348
*/
if (mainWindow.isFullScreen()) {
mainWindow.once('leave-full-screen', () => mainWindow.hide())
mainWindow.setFullScreen(false)
} else {
mainWindow.hide()
}
// On Mac, or on other platforms when the tray icon is in use, the window
// should be only hidden, not closed, when the user clicks the close button