Opened 7 years ago

Closed 7 years ago

#772 closed Bug / Defect (fixed)

GUI looks blurred on high-dpi displays

Reported by: Selva Nair Owned by: Heiko Hund
Priority: minor Milestone: release 2.4
Component: Windows GUI Version: OpenVPN 2.4_alpha2 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords: GUI, dpi, Windows
Cc: supergregg, Samuli Seppänen

Description

OpenVPN GUI is currently not dpi-aware. As Windows automatically scales non-dpi aware applications on displays with dpi different from the default, fonts and images appear blurred. This is especially bad when scaling is 150% or more.

Originally reported by @supergregg in here

A proposed patch is in PR99 and test executable is here

Change History (11)

comment:1 Changed 7 years ago by Gert Döring

Cc: Samuli Seppänen added
Milestone: release 2.4

comment:2 Changed 7 years ago by Selva Nair

Moving the discussion here from https://community.openvpn.net/openvpn/ticket/718#comment:14
Replying to @supergregg:

@selvanair
It works and looks good.

I'm nitpicking here but I noticed the icon in the task bar became a bit fuzzy with the High-DPI aware exe.
I have attached a PNG. The top icon is from the high-DPI exe and the bottom one is the original 2.4 icon.
Also, if the icon is ment to be in line with Windows 10 design, It probably doesn't need a black outer border?
But I'm really nitpicking here, sorry!

Nitpicking is most welcome. Your png images do show some fuzziness but I cant reproduce it on my 144 dpi display (do not have a 192dpi one to test on). Small icons at 200% need 32x32 icons and we do have them included. But because of the way we load icons there is some scaling involved both in dpi-unaware and dpi-aware situations. One could be working better for your particular case. To improve this for all common dpi settings, we need more icon sizes, so let's revisit it if/when we get more sizes generated by the original icon designer(s).

We use the same set of icons on all platforms, and on the status window title bar, so the black outline is needed for clarity.

One thing to keep in mind: the code is only made system-dpi aware which means: (i) if you have multiple monitors with different dpi settings connected, one of them may show some blurriness due to scaling; (ii) if you change the dpi setting, the system dpi will not change until you logout and login again. So until then the OS will do scaling from the dpi value at login to the new value which may not look good.

comment:3 Changed 7 years ago by Samuli Seppänen

Can I read this as "the current fix is good enough"?

comment:4 Changed 7 years ago by Selva Nair

The fix addresses blurry fonts due automatic scaling by Windows which was the biggest eye-sore. But icons are still scaled up and down to match the dpi.

Some improvements in how we load icons is possible -- we currently load all at the default large-icon size and let Windows display them at right size. For the tray icon this involves a scaling up first followed by a scaling down depending on DPI. Changing this could improve it for 192 dpi (used by @supregregg) as we do have tray icons at 32x32 size which is what 192dpi setting needs. But it won't help all common dpi settings as we have the tray icon at only 16x16 and 32x32 sizes.

So I suggest we consider the icon loading fix after we try to get icons generated at intermediate sizes required for common dpi settings of 120, 144, 192 (and possibly 168?).

comment:5 Changed 7 years ago by Samuli Seppänen

Ok. Then I propose the following:

  1. Merge PR#99 (useful in itself)
  2. Ask the author of the new icons to add intermediate sizes to each .ico file. Having the vector-format master icon in the repository would be also good.
  3. Improve icon loading procedure

Thoughts?

comment:6 Changed 7 years ago by Selva Nair

Sounds good.

Microsoft docs on icons is rather confusing, some recommendations are vista specific, assumes that icons may be scaled on the fly so not all sizes are really required etc. While in practice many icons do not look good when scaled, especially on high-dpi displays.

So I would suggest that we specifically ask for 16x16, 20x20, 24x24 and 32x32 sizes for small tray icons (from the high dpi table in the link you posted). We already have 16x16 and 32x32. Getting the vector graphics into our repo is an excellent idea.

Then we can change the load icon code to dynamically query system metric and load most appropriately sized icon to eliminate/reduce the need for scaling.

comment:7 Changed 7 years ago by Selva Nair

Replying to @supergregg:

@selvanair
It works and looks good.
I'm nitpicking here but I noticed the icon in the task bar became a bit fuzzy with >the High-DPI aware exe.
I have attached a PNG. The top icon is from the high-DPI exe and the bottom one is >the original 2.4 icon.

I have uploaded a new test version here with tray icons loaded at sizes given by the system-metric at run-time. Also we now have icon sizes to support 96, 120, 144 and 192 dpi without scaling. Could you please give it a test-drive? Thanks.

comment:8 Changed 7 years ago by supergregg

@selvanair

Works great @ 200% scaling in Win10! Looks perfekt.

comment:9 Changed 7 years ago by Selva Nair

Excellent. Thanks for testing.

comment:10 Changed 7 years ago by Selva Nair

Component: Generic / unclassifiedWindows GUI
Owner: set to Heiko Hund

PR 107 resolves this.

comment:11 Changed 7 years ago by Selva Nair

Resolution: fixed
Status: newclosed

Resolved by PR 99 and 107. Fixed GUI will be in release 2.4_rc2. Closing.

Note: See TracTickets for help on using tickets.