Ensure window exits fullscreen before closing (#4376)
This commit is contained in:
parent
fd6358ac9d
commit
22a4cb079c
1 changed files with 15 additions and 1 deletions
16
main.js
16
main.js
|
@ -403,7 +403,21 @@ async function createWindow() {
|
||||||
|
|
||||||
// Prevent the shutdown
|
// Prevent the shutdown
|
||||||
e.preventDefault();
|
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
|
// 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
|
// should be only hidden, not closed, when the user clicks the close button
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue