fix(electron): onboarding display issue on Windows (#5320)

This commit is contained in:
Peng Xiao 2023-12-19 09:32:12 +00:00
parent 128f8066c3
commit d03567f689
No known key found for this signature in database
GPG Key ID: 23F23D9E8B3971ED

View File

@ -29,11 +29,12 @@ async function createOnboardingWindow(additionalArguments: string[]) {
resizable: false,
closable: false,
minimizable: false,
movable: false,
titleBarStyle: 'hidden',
maximizable: false,
fullscreenable: false,
// skipTaskbar: true,
transparent: true,
backgroundColor: '#00FFFFFF',
hasShadow: false,
webPreferences: {
webgl: true,
@ -42,7 +43,19 @@ async function createOnboardingWindow(additionalArguments: string[]) {
},
});
// workaround for the phantom title bar on windows when losing focus
// see https://github.com/electron/electron/issues/39959#issuecomment-1758736966
browserWindow.on('focus', () => {
browserWindow.setBackgroundColor('#00000000');
});
browserWindow.on('blur', () => {
browserWindow.setBackgroundColor('#00000000');
});
browserWindow.on('ready-to-show', () => {
// forcing zoom factor to 1 to avoid onboarding display issues
browserWindow.webContents.setZoomFactor(1);
// TODO: add a timeout to avoid flickering, window is ready, but dom is not ready
setTimeout(() => {
browserWindow.show();