[MM-58780] Don't account for scaleFactor on Windows when resizing if the matching screen is the primary monitor (#3072)

This commit is contained in:
Devin Binnie
2024-06-19 09:27:19 -04:00
committed by GitHub
parent 0d4800fd61
commit d3a76caeef
2 changed files with 33 additions and 7 deletions

View File

@@ -260,9 +260,10 @@ export class MainWindow extends EventEmitter {
}
// We check for the monitor's scale factor when we want to set these bounds
// But only if it's not the primary monitor, otherwise it works fine as is
// This is due to a long running Electron issue: https://github.com/electron/electron/issues/10862
// This only needs to be done on Windows, it causes strange behaviour on Mac otherwise
const scaleFactor = process.platform === 'win32' ? matchingScreen.scaleFactor : 1;
const scaleFactor = process.platform === 'win32' && matchingScreen.id !== screen.getPrimaryDisplay().id ? matchingScreen.scaleFactor : 1;
return {
...savedWindowState,
width: Math.floor(savedWindowState.width / scaleFactor),