Maximize window visual glitch on Windows fix (fix #1447) (PR #1448)

Fix for [Maximize window visual glitch on Windows · Issue #1447 · nativefier/nativefier](https://github.com/nativefier/nativefier/issues/1447)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
This commit is contained in:
Adam777 2022-11-07 23:55:11 +01:00 committed by GitHub
parent 1fd046798d
commit f046b61a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -73,7 +73,10 @@ export async function createMainWindow(
// Whether the window should always stay on top of other windows. Default is false.
alwaysOnTop: options.alwaysOnTop,
titleBarStyle: options.titleBarStyle ?? 'default',
show: options.tray !== 'start-in-tray',
// Maximize window visual glitch on Windows fix
// We want a consistent behavior on all OSes, but Windows needs help to not glitch.
// So, we manually mainWindow.show() later, see a few lines below
show: options.tray !== 'start-in-tray' && process.platform !== 'win32',
backgroundColor: options.backgroundColor,
...getDefaultWindowOptions(outputOptionsToWindowOptions(options)),
});
@ -94,6 +97,9 @@ export async function createMainWindow(
if (options.tray === 'start-in-tray') {
mainWindow.hide();
} else if (process.platform === 'win32') {
// See other "Maximize window visual glitch on Windows fix" comment above.
mainWindow.show();
}
const windowOptions = outputOptionsToWindowOptions(options);