View Issue Details

IDProjectCategoryView StatusLast Update
0001375Double CommanderGraphical user interfacepublic2021-09-05 15:10
Reporterbugboy Assigned ToAlexx2000  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
Product Version1.0.0 (trunk) 
Summary0001375: Wrong control spacing on HiDPI screens
DescriptionThe application assumes that the application is running with 100% font-scaling. On HiDPI screens this results in incorrect spacing between controls. It seems that all coordinates are based on physical pixels, instead of logical pixels. The fonts are rendered according to the scaling factor.

The file panels can be tweaked so they look reasonable fine on HiDPI displays, but this makes it difficult when switching between HiDPI and normal mode.

I have added a screen-shot of the configuration pane on 175%.
Steps To ReproduceChange your Windows font-scaling to 200% to illustrate the effect.
TagsNo tags attached.
Attached Files
Capture.PNG (84,634 bytes)   
Capture.PNG (84,634 bytes)   
Fixed in Revision
Operating systemWindows
Widgetset
Architecture

Relationships

related to 0001742 closedAlexx2000 DC performs bad on high DPI systems 

Activities

bugboy

2016-06-01 20:48

reporter   ~0001727

I have investigated the application's manifest (built-in resource) and the manifest specifies that this application is DPI aware (which it isn't). After removing this setting, the application looks like any other non DPI-aware application. It's not as crisp anymore, but the spacing is fixed.

Patching the application's manifest is not for the faint of heart, but I wanted to try it to make sure this was causing this issue.

user01

2016-11-15 13:15

reporter   ~0001999

Last edited: 2016-11-15 13:16

There is an article on this in Lazarus wiki
http://wiki.lazarus.freepascal.org/High_DPI

This can be worked out by little loop which will be scaling control size, spacing and font size, if it's not 0 (auto). uscaledpi from LazPaint is given as example.

This should be called in OnCreate of every form. Options isn't only form that needs to be scaled. There are also forms like copy dialog, search form, find dialog in viewer etc etc



Font size in main panels seem to be properly scaled already.

Unsure with image viewer, which itself should render pixel to pixel, yet toolbar needs to be scaled.

Alextp

2016-11-15 23:19

reporter   ~0002000

IMO only need to set Autosize for comboboxes. in screenshot. DpiAware must be on as now in menifest.
Treeview v-arrow scaling. Is fixed in Laz 1.7 trunk.

user01

2016-11-16 00:20

reporter   ~0002001

DPIaware manifest doesn't scale anything. It only tells system that the app controls dpi scaling by itself, so draws win32 controls natively without scaling. If it doesn't tell the system, it will raster scale entire window, doing it pretty bad with huge compression that results in blur.

Aside of manifest, for Windows, all control, size, constraints, borderspacings and other elemts such as column width, if they have fixed width and more, if any needed, in any OS and Widgetset should be resized manually respective of system scale settings. There are little functions for that in Lazarus - ScaleX and ScaleY. And there is example from LazPaint in link above on how could it be done with a little loop that could be fired during OnCreate.

function ScaleX(const SizeX, FromDPI: Integer): Integer;
function ScaleY(const SizeY, FromDPI: Integer): Integer;

Any form saves DesignTimeDPI, which could be used with those functions.

Looking down the wiki article, there is seem to be an improvement for scaling in current trunk - AutoAdjustLayout. Didn't try it though.

user01

2016-12-08 17:42

reporter   ~0002031

Lazarus 1.8 will have hiDPI scaling, it seem been under active development recent days, so better just wait for it.

Issue History

Date Modified Username Field Change
2016-05-14 19:46 bugboy New Issue
2016-05-14 19:46 bugboy File Added: Capture.PNG
2016-06-01 20:48 bugboy Note Added: 0001727
2016-11-15 13:15 user01 Note Added: 0001999
2016-11-15 13:16 user01 Note Edited: 0001999
2016-11-15 23:19 Alextp Note Added: 0002000
2016-11-16 00:20 user01 Note Added: 0002001
2016-12-08 17:42 user01 Note Added: 0002031
2017-03-08 13:00 Alexx2000 Relationship added related to 0001742
2017-03-08 13:09 Alexx2000 Status new => acknowledged
2018-07-22 18:20 Alexx2000 Status acknowledged => resolved
2018-07-22 18:20 Alexx2000 Resolution open => fixed
2018-07-22 18:20 Alexx2000 Assigned To => Alexx2000
2021-09-05 15:10 Alexx2000 Status resolved => closed