This commit is contained in:
absidue 2024-11-21 09:00:40 +00:00 committed by GitHub
commit 0dcf53348b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -626,6 +626,8 @@ function runApp() {
}
}
const htmlFullscreenWindowIds = new Set()
async function createWindow(
{
replaceMainWindow = true,
@ -801,7 +803,18 @@ function runApp() {
}
})
newWindow.on('enter-html-full-screen', () => {
htmlFullscreenWindowIds.add(newWindow.id)
})
newWindow.on('leave-html-full-screen', () => {
htmlFullscreenWindowIds.delete(newWindow.id)
})
newWindow.once('close', async () => {
// returns true if the element existed in the set
const htmlFullscreen = htmlFullscreenWindowIds.delete(newWindow.id)
if (BrowserWindow.getAllWindows().length !== 1) {
return
}
@ -809,7 +822,9 @@ function runApp() {
const value = {
...newWindow.getNormalBounds(),
maximized: newWindow.isMaximized(),
fullScreen: newWindow.isFullScreen()
// Don't save the full screen state if it was triggered by an HTML API e.g. the video player
fullScreen: newWindow.isFullScreen() && !htmlFullscreen
}
await baseHandlers.settings._updateBounds(value)