Recent

Author Topic: HiDPI Issue/Misunderstanding  (Read 4939 times)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #15 on: August 26, 2020, 11:36:44 am »
I've installed package OPM and it crashes lazarus when opening!
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #16 on: August 26, 2020, 11:45:11 am »
Did a full rebuild with -WC and doesn't crash now.

OPM seems to scale okay.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

wp

  • Hero Member
  • *****
  • Posts: 11445
Re: HiDPI Issue/Misunderstanding
« Reply #17 on: August 26, 2020, 11:51:20 am »
Then I'd say that VTV is basically correct. Can you try to set up a simple project (just a VTV with some dummy nodes) which shows the scaling issue? Pack the .pas, llfm, lpi and lpr files into a common zip which you can upload here under "Attachement and other options".

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #18 on: August 26, 2020, 12:05:59 pm »
Found the Problem:
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #19 on: August 26, 2020, 12:07:43 pm »
If i use "on (True)" it works as expected.

But what is the difference and shouldn't all of the "on" options work?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #20 on: August 26, 2020, 12:13:01 pm »
I just uploaded a fix for it to Lazarus trunk.

Shouldn't FixDesignFontsPPI be "override" and be in the public section? See attached patch.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

wp

  • Hero Member
  • *****
  • Posts: 11445
Re: HiDPI Issue/Misunderstanding
« Reply #21 on: August 26, 2020, 12:25:19 pm »
Correct. Can you try? But I think the header's FixDesignFontsPPI should not be called from TVTHeader.AutoAdjustLayout because it is already called from the tree's FixDesignFontsPPI.

[EDIT]
To be more specific:
TVTHeader.FixDesignFontsPPI cannot be "override" because TVTHeader inherits from TPersistent, but FixDesignFontsPPI is introduced for TControl.
TVTBaseVirtualTree.FixDesignFontsPPI is inherited from TControl and thus must be "override". It should be "public" (I put it into "protected" because I copied from TCustomGrid in grids.pas where it is in "protected" which seems to be wrong).
« Last Edit: August 26, 2020, 01:06:00 pm by wp »

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #22 on: August 26, 2020, 02:40:09 pm »
Can you try?
What exactly?

But I think the header's FixDesignFontsPPI should not be called from TVTHeader.AutoAdjustLayout because it is already called from the tree's FixDesignFontsPPI.
Yes, as the DPI awareness mode caused the problem.

To be more specific:
TVTHeader.FixDesignFontsPPI cannot be "override" because TVTHeader inherits from TPersistent, but FixDesignFontsPPI is introduced for TControl.
TVTBaseVirtualTree.FixDesignFontsPPI is inherited from TControl and thus must be "override". It should be "public" (I put it into "protected" because I copied from TCustomGrid in grids.pas where it is in "protected" which seems to be wrong).
Yes sure, see attachment of previous post.
« Last Edit: August 26, 2020, 02:48:48 pm by Pascal »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #23 on: August 26, 2020, 03:43:03 pm »
corrected patch.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

wp

  • Hero Member
  • *****
  • Posts: 11445
Re: HiDPI Issue/Misunderstanding
« Reply #24 on: August 26, 2020, 04:53:47 pm »
Can you try?
What exactly?
Sorry I did not notice that you had solved the issue by selecting "on" in the "DPI Awareness".

The other "on" settings are meant for multi-monitor set-up, like in your situation: when you have several monitors, each of them with different resolution, then a form will be scaled when it is dragged onto another monitor. Since I only have a single monitor I could never test this feature (BTW - I am not the author of LCL scaling, so I am not sure whether I am not talking nonsense here...); I also don't know whether this features works correctly in the form designer of Lazarus.

If you want to check it yourself you should first write a simple demo with a single form and simple standard components (or use my demo of reply #6, but adjust the "DPI awareness"); at runtime, drag the form on the other monitor. Write a bug report if the form does not scale.

As for the form designer, open the project lazarus.lpi (in folder "ide" of your lazarus installation - make a backup copy of lazarus.exe), set its "DPI awareness" to "Vista-8: on, 8.1+: per monitor" or "Vista-8:on; 8.1-10+: per monitor/V2" (in fact, I don't even know what V2 is...) and recompile the IDE (it is built by default with the "on" setting, i.e. the "per monitor" feature should be off. In the new IDE, drag a form in design mode onto the other monitor. Does it rescale and update the DesigntimePPI accordingly? If not report as an error of the IDE.

Pascal

  • Hero Member
  • *****
  • Posts: 932
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #26 on: August 27, 2020, 10:21:45 am »
If you want to check it yourself you should first write a simple demo with a single form and simple standard components (or use my demo of reply #6, but adjust the "DPI awareness"); at runtime, drag the form on the other monitor. Write a bug report if the form does not scale

With the simple "on (True)" everything works as expected when i move the form to a monitor with other PPI! So why do we need that many options?
And: V2 does not work as expected!
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5277
  • Compiler Developer
Re: HiDPI Issue/Misunderstanding
« Reply #27 on: August 27, 2020, 01:59:30 pm »
With the simple "on (True)" everything works as expected when i move the form to a monitor with other PPI! So why do we need that many options?
And: V2 does not work as expected!

Because Windows provides them. And if I want my application to work on older Windows I can't select e.g. the V2 setting, but must instead use e.g. Vista and enable the per-monitor one in code. Also it could be that the user creates an application without the LCL, then all settings need to be available as well, because the user's code might not handle per-monitor DPI changes.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: HiDPI Issue/Misunderstanding
« Reply #28 on: August 27, 2020, 03:22:17 pm »
With the simple "on (True)" everything works as expected when i move the form to a monitor with other PPI! So why do we need that many options?
And: V2 does not work as expected!

Because Windows provides them. And if I want my application to work on older Windows I can't select e.g. the V2 setting, but must instead use e.g. Vista and enable the per-monitor one in code. Also it could be that the user creates an application without the LCL, then all settings need to be available as well, because the user's code might not handle per-monitor DPI changes.

Okay, but then we need to make scaling work with those settings enabled. Which is not the case if PM_V2 is enabled atm. See https://bugs.freepascal.org/view.php?id=32017
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

BrunoK

  • Sr. Member
  • ****
  • Posts: 448
  • Retired programmer
Re: HiDPI Issue/Misunderstanding
« Reply #29 on: June 11, 2023, 05:53:04 pm »
Where are we on this topic.

WIN10, Lazarus trunk, FPC 3.2.2

System
- laptop 13.3", resolution 2560x1600.  Size of text scaled  by 225% as main screen 216 DPI.
- secondary 15", resolution 1280x1024.  Size of text scaled  by 100% as main screen 96 DPI.

There are similar troubles as those described by Pascal on lazarus for AllCompilerOptions.pas with line overlapping. 
So I thougt, OK, look thru it and found a very reasonable way to dimension the lines, using the Edit in the top panel as sizing reference.
That worked very well, on both screens. l was happy except that it messed up the design time sizing of both the top panel and the bottom button frame, so I could not get a stable design time form, and, as may be expected on the resulting lazarus.exe

Is something being done to solve this problem ?

 

TinyPortal © 2005-2018