Topic "Properly support per-monitor DPI awareness"

Author Message
josh3736
[View user's profile]

Joined: 2016-04-13
Posts: 2
The WinSCP 5.8 beta process claims to support per-monitor DPI awareness, but it does not actually support DPI scaling. When dragging WinSCP between monitors with different DPIs, the window is not resized in order to maintain physical dimensions nor does it scale its controls. This results in a comically large window when dragged from a high DPI screen to a low DPI screen.

From https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512.aspx

Quote:
Unlike the other awareness values, PROCESS_PER_MONITOR_DPI_AWARE should adapt to the display that it is on. This means that it is always rendered natively and is never scaled by the system. The responsibility is on the app to adjust the scale factor when receiving the WM_DPICHANGED message. Part of this message includes a suggested rect for the window. This suggestion is the current window scaled from the old DPI value to the new DPI value. For example, a window that is 500 by 500 on display A and moved to display B will receive a suggested window rect that is 1000 by 1000. If that same window is moved to display C, the suggested window rect attached to WM_DPICHANGED will be 1500 by 1500.


When an app receives WM_DPICHANGED, it is the app's responsibility to call SetWindowPos or similar AND scale the window's controls so that the window and its contents maintain the same physical size on monitors with different DPIs.

WinSCP should either scale its contents properly or declare itself system DPI aware only.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
We are aware of this.

Runtime scaling is difficult to implement.

On the other hand, if we declare WinSCP not to be per-monitor DPI aware, Windows with scale the WinSCP windows pixel-wise when moving between monitors. Depending on DPI ratio between the monitors, this can be bad or good. If it is like 125% vs. 150%, pixel-wise scaling gives imho worse experience than no scaling. If it is like 100% vs. 200%, pixel-wise scaling is probably better than none. So it's not easy choice.
josh3736
[View user's profile]

Joined: 2016-04-13
Posts: 2
martin wrote:
If we declare WinSCP not to be per-monitor DPI aware, Windows with scale the WinSCP windows pixel-wise when moving between monitors. Depending on DPI ratio between the monitors, this can be bad or good. If it is like 125% vs. 150%, pixel-wise scaling gives imho worse experience than no scaling. If it is like 100% vs. 200%, pixel-wise scaling is probably better than none. So it's not easy choice.


The problem is that with a wider delta between DPIs, the unscaled window becomes comically large and nearly unusable.

Compare these two videos showing a WinSCP window and a Chrome window being moved from a 4K, 200 DPI display to a regular 96 DPI display (apologies for the bad phone video):

WinSCP: https://www.youtube.com/watch?v=xeOevWR-J5U

Chrome: https://www.youtube.com/watch?v=OoJ1NxRTqGk

I believe that claiming to support per-monitor DPI awareness when the application does not actually support DPI scaling is way worse than a little bluriness due to bitmap scaling. I expect my windows to maintain their physical size when moving them between monitors, and it's difficult to use the app when its contents are 2x or more larger than they should be physically.

In the first version of Windows 10, efforts to implement per-monitor DPI scaling were hindered because Windows did not actually scale the non-client area (titlebar etc) of the window, so even if you scale the contents of your window, the window chrome still looks ridiculous on low-DPI displays (see this ConEmu issue).

The good news is the Windows 10 Anniversary Update (v1607) adds a new API: EnableNonClientDpiScaling(hWnd). Just call this once when the window is created and windows will automatically scale the non-client area for you. This means that you then need to listen for WM_DPICHANGED, use the suggested new pixel dimensions in lParam to call SetWindowPos (so that the window maintains the same physical [inch] dimensions on the new display), and then rescale the contents of the window.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Thanks for these details.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License