You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BrowserWindow min-width and min-height not set consistently with width and height properties #1806
I'm seeing two problems with the min-width and min-height properties.
First, when opening a window that includes the native window chrome, the window width and height that is set when creating the window includes the width and height of the native window chrome. So if I set width to 800px and height to 600px, the entire window is 800 x 600. However, if we also set min-width to 800px and min-height to 600px, these measurements seem to exclude the native chrome. So if I try to resize it at all (or even to drag the window on Windows), it will resize itself so that the contents (excluding the chrome) are 800 x 600. The window will get bigger by the size of the chrome, which is the height of the header on OSX and about 15px x 38px on Windows.
Secondly, on Windows only, if you have auto-scaling turned on, this is being applied once when opening the BrowserWindow with a specified width and height, but is being applied a second time when evaluating min-width and min height. For example, my PC has a screen resolution of 3200 x 1800, and the recommended scaling is 200%. With these settings, if we create a browser window as 400px wide and 300px high, then it's actually created as 800 x 600, which is what I'd expect with 200% scaling. However, it seems that if I also set the min-width to 400 and the min-height to 300, and drag or attempt to resize the window, then the minimum dimensions are evaluated, and doubled again, so I end up with a window that jumps to twice the expected size (1626 x 1271). While I can get around this by turning off auto-scaling (setting scaling to 100%), because the recommended setting for my resolution is to have this turned on, I would expect that a lot of Windows users with high-resolution monitors would run into a similar problem.
The second issue with scaling on Windows is still an issue in 0.31.1.
EDIT: Possibly related to that issue; on scaled desktops, window.outerHeight / outerWidth are set incorrectly. They appear to be scaled down based on the windows desktop scale ratio. So if you have desktop scaling set to 200%, a window 800px wide will have a outerWidth of 400.
Users of my application are experiencing this too. I'm setting height and width, and min-height and min-width all to the same value. When they try to resize, or drag, it doubles in size (Windows).
I've tried clamping it to nearest 0.25 values to get around the extra pixels the window chrome adds but depending on your monitor the exact value of this ratio may not be a perfectly round decimal.
Activity
ToadKing commentedon Sep 1, 2015
The second issue with scaling on Windows is still an issue in 0.31.1.
EDIT: Possibly related to that issue; on scaled desktops, window.outerHeight / outerWidth are set incorrectly. They appear to be scaled down based on the windows desktop scale ratio. So if you have desktop scaling set to 200%, a window 800px wide will have a outerWidth of 400.
ToadKing commentedon Sep 8, 2015
It only appears to happen if you change the DPI settings on the main monitor. Changing it for secondary monitors does not break min-width/height.
smebberson commentedon Sep 16, 2015
Users of my application are experiencing this too. I'm setting height and width, and min-height and min-width all to the same value. When they try to resize, or drag, it doubles in size (Windows).
ToadKing commentedon Sep 22, 2015
Right now I've been working around this with this hack. On systems with minimal to no window chrome it works well enough for my application.
I've tried clamping it to nearest 0.25 values to get around the extra pixels the window chrome adds but depending on your monitor the exact value of this ratio may not be a perfectly round decimal.
Fix calculating min/max size in frameless views
ToadKing commentedon Oct 7, 2015
There is still an issue with high-dpi desktops on Windows even in 0.33.6 with #2979 applied.
etiktin commentedon Oct 7, 2015
v0.33.6 doesn't include the fix. If you go the releases page and click "X commits to master since this release", you'll see it's still waiting.
ToadKing commentedon Oct 7, 2015
Oops, my bad. I thought that meant commits since last release.