mIRC Home    About    Download    Register    News    Help

Print Thread
Per-monitor DPI scaling #267225 24/04/20 12:44 PM
Joined: Apr 2020
Posts: 1
W
wouterdek Offline OP
Mostly harmless
OP Offline
Mostly harmless
W
Joined: Apr 2020
Posts: 1
Hi!

Thank you for developing mIRC! It already supports system DPI scaling, but it doesn't seem to support per-monitor DPI scaling.

People that combine regular monitors with high DPI or small screens often increase the DPI scaling of only one monitor in Windows. Applications that support this properly get notified by Windows when the window switches screen and rerender using the correct scale. For applications that do not support this, Windows stretches the bitmap of the UI to the correct size. This, however, results in a blurry/pixelated UI.

I've linked a screenshot below. Make sure to view this at full resolution. Notice how the UI looks pixelated while Firefox in the background does not.
Screenshot: https://i.imgur.com/isTPDHP.png

The good news is that this is extremely easy to fix. I've manually replaced the exe manifest with a modified one, no other changes, and everything just works properly now.
I replaced

Code
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>


with

Code
<!-- Per Monitor V1 [OS >= Windows 8.1] 
     Values: False, True, Per-monitor, True/PM -->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<!-- Per Monitor V1 [OS >= Windows 10 Anniversary Update (1607, 10.0.14393, Redstone 1)]
      Values: Unaware, System, PerMonitor -->
<!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)]
      Value: PerMonitorV2 -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>


You can find the relevant documentation on DPI awareness here: https://docs.microsoft.com/en-us/wi...sktop-application-development-on-windows

Thank you!

Re: Per-monitor DPI scaling [Re: wouterdek] #267229 24/04/20 07:16 PM
Joined: Dec 2002
Posts: 4,736
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,736
Thanks for your bug report. This has been discussed a few times before, eg. most recently here. Unfortunately, DPI scaling support is complicated. The way measurements are made, from fonts to GDI drawing to dialogs, on a dynamic, per-monitor basis, requires changes to a huge amount of code. It is on my to-do list and I am slowly working through features that need to be changed. The setting you mention does not, sadly, resolve these issues and, as discussed in the thread linked to above, currently leads to other issues, so I'm afraid it cannot be used for now. If it works for you to resolve the specific issue that you are seeing, that's good to hear though.

Re: Per-monitor DPI scaling [Re: Khaled] #267241 25/04/20 07:25 PM
Joined: Dec 2002
Posts: 4,736
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,736
Following up on my post, for future reference:

There is a description of Per Monitor V2 here that states:

Quote
Warning: The Per Monitor V2 (and many of the other High-DPI features in Windows) have no support for the MDI child windows model. Microsoft has stopped addressing bugs reported for MDI, and we recommend migrating to a different multi-windows model (multiple floating windows, docked panes, tabbed windows, etc.)

I have been able to reproduce the MDI sizing issue with a basic sample MDI C++ application that has the permonitorv2 setting enabled in its manifest. So, as far as I can tell, it is not specific to how mIRC has implemented its MDI support. With this application, and mIRC, when an MDI window is maximized on a monitor that has 125% DPI enabled, and with only some resolutions, the window is sized incorrectly and the caption is actually visible.

There is a solution that involves hiding the MDI window caption when the window is maximized but it results in a fair bit of flickering. If I can find a way around it that works smoothly, I will use it.

That said, seeing that Microsoft has deprecated MDI, the only long-term solution may be to move away from MDI.