-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Window size not preserved correctly when multiple displays use different screen scaling (devicePixelRatio) #80
Comments
Adding this line after constructing the window seemed to result in the correct window size for me:
All this does is re-apply the stored size after the window has already been placed on the correct monitor, which somehow results in the scale applying correctly. @Marcus10110 I reckon your hunch about it being a bug with the BrowserWindow constructor is correct, though I'm less certain how electron-window-state could reliably fix this on its own. Perhaps the size could be re-applied when mainWindowState.manage() is called... EDIT: may need some more safety for the mainWindowState first time through, as x and y can be undefined (even though the types indicate otherwise). const bounds: Partial<Rectangle> = {
height: mainWindowState.height,
width: mainWindowState.width,
};
window.setBounds(bounds); |
Configuration:
Windows 10
2 monitors, side-by-side configuration.
Left monitor scaling set to 150%.
Right monitor scaling set to 200%.
Left monitor is primary display.
(other scale factors should produce the same results, as long as the two displays have different scale factors)
Steps to reproduce:
Problem description:
The X & Y location of the software is preserved correctly. However, the width and height of the application is now larger than it was when closed. The width and height were both scaled up by 33%.
Expected behavior:
The width and height are restored correctly.
This seems like a per-display scaling awareness problem, but I'm not sure if it's an issue with electron-window-state, or with the electron BrowserWindow constructor width & height arguments. It does seem likely however that the problem could be corrected in electron-window-state.
The text was updated successfully, but these errors were encountered: