-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Enable per-monitor DPI for Win10 #8786
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
Conversation
I will test this with my Surface Pro 4 and non-high-DPI external monitor. |
@groundwater have you had a chance to test this out yet? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider keeping the manifest entry instead of adding back the code.
@@ -32,7 +32,6 @@ | |||
|
|||
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> | |||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> | |||
<dpiAware>true</dpiAware> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use <dpiAware>True/PM</dpiAware>
instead of adding back the code
http://stackoverflow.com/questions/23551112/how-can-i-set-the-dpiaware-property-in-a-windows-application-manifest-to-per-mo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think setting this via manifest is preferrable. You can also combine the <dpiAware>
element with the new <dpiAwareness>
element for Windows 10 build 1607 and higher to enable additional per-monitor DPI features.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa374191.aspx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may also want to look at what we added in Windows 10 Creators update which is detailed here: https://blogs.windows.com/buildingapps/2017/04/04/high-dpi-scaling-improvements-desktop-applications-windows-10-creators-update/#HBK3Qfrm4qbzWAEV.97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-client area scaling is available via the following:
- PerMonitor tag + a call to EnableNonClinetDpiScaling() on 1607
- PerMonitorV2 on 1703 (no need for that additional API call)
You can also use a combination of tags that will be consumed differently on different versions of Windows:
true/pm (this will give you per-monitor (version 1) on >= 8.1 and system awareness on Vista to 8)
PerMonitorV2, PerMonitor will result in PerMonitorV2 on 1703 (Creators Update) and PerMonitor (version 1) on 1607 (Anniversary Update). When running on versions of Windows that consume this tag the tag will be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can probably work on this and I also have a combination of High/Low DPI screens running.
I think EnableNonClientDpiScaling
is really important (or permonitorv2
), i wouldn't go for true/pm
only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use True/PM instead of adding back the code
I didn't know this, it is much better!
PerMonitor tag + a call to EnableNonClinetDpiScaling() on 1607
PerMonitorV2 on 1703 (no need for that additional API call)
I agree it is important to have these, but I'm not sure whether they work well with Chromium's own UI framework. Can someone who has Windows running on multiple monitors test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually plan to have a look at this. Leave it to me then, I'll make it work across all the different scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alespergl You maybe be interested in: https://chromium.googlesource.com/chromium/src/+/b297db871b54cd58c32c96897a7a59af295ba796
That's included in Chromium 57.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep using the manifest and adjust the value to true/pm
47e7e90
to
c59ef0e
Compare
What do we think of merging this? I agree that we should ideally also have <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2, permonitor</dpiAwareness> ... but it would be nice to have at least |
Yeah, sounds good 🚢 We can follow this up with more changes as well as pulling in anything via the Chrome 58 upgrade. |
When is Chrome 58 coming in? The change @poiru mentioned would likely need to be backported if it's delayed. |
I believe @zcbenz is working through some offscreen window compilation issues right now that are being updated in #9116, no definite timeline at this time.
Understood, maybe we wait until the end of next week to see where Chrome 58 is then? |
@kevinsawicki I created a PR for the backport, just in case. |
On Win10 version 1607, this patch made the titlebar, scrollbars, etc. huge: Maybe |
So it looks like before this change the process ran as system aware
This will result in the following behavior:
Again, the non-client area will only scale if Windows is drawing it. I don't know how Electron draws its non-client area though. If its custom drawn, then Windows won't DPI scale it automatically. |
@poiru Yes, EnableNonClientDpiScaling fixes it. There's no way to make this work universally, unless custom non-client drawing is implemented, or we don't do per-monitor DPI pre Win10 1607. That would result in blurred client area. Other per-monitor apps work the same. I think it's reasonable to expect most users upgrading their Win10 systems to the latest version, so I wouldn't optimize too much for earlier versions. |
This fixes non-client area DPI scaling on recent Windows 10 versions. See discussion in #8786.
Close #5429.