Add additional logging on before-quit event
This commit is contained in:
parent
3ea7fe6226
commit
155213b57f
1 changed files with 30 additions and 1 deletions
31
app/main.ts
31
app/main.ts
|
@ -990,6 +990,7 @@ async function createWindow() {
|
||||||
// Dereference the window object, usually you would store windows
|
// Dereference the window object, usually you would store windows
|
||||||
// in an array if your app supports multi windows, this is the time
|
// in an array if your app supports multi windows, this is the time
|
||||||
// when you should delete the corresponding element.
|
// when you should delete the corresponding element.
|
||||||
|
getLogger().info('main window closed event');
|
||||||
mainWindow = undefined;
|
mainWindow = undefined;
|
||||||
if (settingsChannel) {
|
if (settingsChannel) {
|
||||||
settingsChannel.setMainWindow(mainWindow);
|
settingsChannel.setMainWindow(mainWindow);
|
||||||
|
@ -1000,11 +1001,13 @@ async function createWindow() {
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.on('enter-full-screen', () => {
|
mainWindow.on('enter-full-screen', () => {
|
||||||
|
getLogger().info('mainWindow enter-full-screen event');
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
mainWindow.webContents.send('full-screen-change', true);
|
mainWindow.webContents.send('full-screen-change', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mainWindow.on('leave-full-screen', () => {
|
mainWindow.on('leave-full-screen', () => {
|
||||||
|
getLogger().info('mainWindow leave-full-screen event');
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
mainWindow.webContents.send('full-screen-change', false);
|
mainWindow.webContents.send('full-screen-change', false);
|
||||||
}
|
}
|
||||||
|
@ -2159,16 +2162,42 @@ async function requestShutdown() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('before-quit', () => {
|
function getWindowDebugInfo() {
|
||||||
|
const windows = BrowserWindow.getAllWindows();
|
||||||
|
|
||||||
|
return {
|
||||||
|
windowCount: windows.length,
|
||||||
|
mainWindowExists: windows.some(win => win === mainWindow),
|
||||||
|
mainWindowIsFullScreen: mainWindow?.isFullScreen(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on('before-quit', e => {
|
||||||
getLogger().info('before-quit event', {
|
getLogger().info('before-quit event', {
|
||||||
readyForShutdown: windowState.readyForShutdown(),
|
readyForShutdown: windowState.readyForShutdown(),
|
||||||
shouldQuit: windowState.shouldQuit(),
|
shouldQuit: windowState.shouldQuit(),
|
||||||
|
hasEventBeenPrevented: e.defaultPrevented,
|
||||||
|
...getWindowDebugInfo(),
|
||||||
});
|
});
|
||||||
|
|
||||||
systemTrayService?.markShouldQuit();
|
systemTrayService?.markShouldQuit();
|
||||||
windowState.markShouldQuit();
|
windowState.markShouldQuit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.on('will-quit', e => {
|
||||||
|
getLogger().info('will-quit event', {
|
||||||
|
hasEventBeenPrevented: e.defaultPrevented,
|
||||||
|
...getWindowDebugInfo(),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('quit', e => {
|
||||||
|
getLogger().info('quit event', {
|
||||||
|
hasEventBeenPrevented: e.defaultPrevented,
|
||||||
|
...getWindowDebugInfo(),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
getLogger().info('main process handling window-all-closed');
|
getLogger().info('main process handling window-all-closed');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue