Scaling issue with 4k displays?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Scaling issue with 4k displays?

Post by rocrail »

Hi,

a user of Rocrail did complain that his laptop with a 4k resolution looks weird.
He has a 4K Display (3840x2160) with 250% scaling configured.

Should developers take some action to support 4k displays?
https://imgur.com/a/fY7lb
Attachments
rocview-normal.png
rocview-normal.png (12.05 KiB) Viewed 3826 times
rocview-4k.png
rocview-4k.png (6.02 KiB) Viewed 3826 times
Last edited by rocrail on Mon Oct 02, 2017 3:08 pm, edited 1 time in total.
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling issue with 4k displays?

Post by doublemax »

Platform, exact wxWidgets version?

And if it's under Windows: Is your app marked as "DPI aware"?
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: Scaling issue with 4k displays?

Post by rocrail »

The Platform is Win10 with wxWidgets 3.02.
Is your app marked as "DPI aware"?
Where, why, should I set this?
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling issue with 4k displays?

Post by doublemax »

viewtopic.php?p=178242#p178242

However, if your app is not marked as "DPI aware", it should run in a kind of "emulation mode" in which your app only "sees" a small screen resolution and Windows will scale the output of the application up.

Which compiler/IDE do you use under Windows? If it's Visual Studio, it's possible that the flag is already set through the manifest.

Do you calculate any font size yourself instead of using a default one?
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: Scaling issue with 4k displays?

Post by rocrail »

Hi,

the Windows target is cross compiled with MinGW under Linux.

The screen shots show custom controls for the throttle, and the font size is calculated depending on the size of the control.
The rest of the application is only using default wxWidgets style for sizing.
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling issue with 4k displays?

Post by doublemax »

the font size is calculated depending on the size of the control.
Can you show the code for that?

In the long term, you'll probably have to mark the exe as dpi-aware anyway. I think you should do that and check how your application looks afterwards.
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: Scaling issue with 4k displays?

Post by rocrail »

Hi,
doublemax wrote:In the long term, you'll probably have to mark the exe as dpi-aware anyway. I think you should do that and check how your application looks afterwards.
could be, but I do not have 4k hardware and are not planning it in the next time.
Don't know what the big deal is with 4k because a human eye does not have this kind of resolution. (AFAIK)
Can you show the code for that?
I just checked: Its hard coded, I must improve that part. ;)
However, if your app is not marked as "DPI aware", it should run in a kind of "emulation mode" in which your app only "sees" a small screen resolution and Windows will scale the output of the application up.
This seems not to work.

Thanks for your time to answer my Qs.
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling issue with 4k displays?

Post by doublemax »

could be, but I do not have 4k hardware and are not planning it in the next time.
You don't really need a 4k display for that, the setting of the display scaling in Windows is the crucial thing. If you set it to 150 or 200%, you should see the effect on your system. Usually it's best to test that in a VM, because it can mess up the desktop (icon positions and such) on a small screen.
Use the source, Luke!
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: Scaling issue with 4k displays?

Post by rocrail »

Does wxWidgets also has th capability of setting the g.SetPageUnit(UnitInch); ?

https://stackoverflow.com/questions/110 ... lly-needed
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Scaling issue with 4k displays?

Post by doublemax »

wxDC has wxDC::SetMapMode().

I couldn't find anything similar for wxGraphicsContext, but i guess SetScale() should work, you jut have to calculate the scaling factor yourself.
Use the source, Luke!
Post Reply