DPI Scaling not updating

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BinoX
User
User
Posts: 46
Joined: Mon Jan 31, 2005 11:57 am

DPI Scaling not updating

Post by BinoX »

If you change the DPI scaling of a screen, while a Purebasic program is running, all of the DPI functions still use the original scaling from when it was originally launched. Closing the program and opening it again will return the new DPI settings.

It's not something that will come up a lot, but I have an application that retains its position in the bottom right of the screen - and I've had to adapt it to use Win32 API functions instead.
Jeromyal
Enthusiast
Enthusiast
Posts: 204
Joined: Wed Jul 17, 2013 8:49 am

Re: DPI Scaling not updating

Post by Jeromyal »

It does not matter anyway, if your scaling is above 100 even before startup it is still all messed up. this has been the case at least since the last LTS
The IDE as well as the applications made, the mouse coordinates do not match the window and control coordinates and sizes.

This causes an extremely obnoxious bug in the ide with the mouse hover over the auto hide tool window option.
The nice little tool someone wrote that shows a blotch of color over code in the ide renders somewhere off screen.

So it's messed up even before you launch PureBasic or any of the apps you make with it. Not sure you can expect it to be good changing the scale while the app is running.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: DPI Scaling not updating

Post by Rinzwind »

PB still doesn't support per-monitor dpi awareness which would fix your issue too.

https://www.purebasic.fr/english/viewto ... pi#p567024

As usual, no comment or updates from the PB creator so don't hold your breath :(

And yes the IDE still does not properly scale. PB does not scale menu and toolbar icons at all...
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DPI Scaling not updating

Post by Fred »

Supporting per monitor and dynamic scaling is not straightforward and needs a lot of rework on the PureBasic libraries. It's planned but will requires some time.
BinoX
User
User
Posts: 46
Joined: Mon Jan 31, 2005 11:57 am

Re: DPI Scaling not updating

Post by BinoX »

I've ended up using this for now:

Code: Select all

GetWindowRect_(GetDesktopWindow_(), @desktopRect)
and comparing it to the screen resolution.

Admittedly, it's only good on single monitor systems - although for my purposes it works out just fine
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DPI Scaling not updating

Post by Fred »

This very niche case, Windows even tells than some application will need to be restarted when you switch DPI.
Moved to feature request.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: DPI Scaling not updating

Post by Rinzwind »

Fred wrote: Thu Feb 16, 2023 6:08 pm This very niche case, Windows even tells than some application will need to be restarted when you switch DPI.
Moved to feature request.
With one monitor, yes. With multiple, no. If you move a window from one screen to another which has another DPI setting, Windows will send an update message to inform you. Would be nice if PB could handle this.

https://learn.microsoft.com/en-us/windo ... dpichanged
https://github.com/microsoft/Windows-cl ... ontext.cpp
https://github.com/tringi/win32-dpi/blo ... 32-dpi.cpp

Process manifest keyword DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2

The message Windows gives is because of "older" application which do not handle these and become "unsharp" because of DPI mismatch (easy scaling).
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: DPI Scaling not updating

Post by jacdelad »

This would indeed be nice. If I'm not wrong, Windows also sends this message upon changing the dpi-settings in the control panel.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
User avatar
❤x1
User
User
Posts: 46
Joined: Thu Jan 10, 2019 5:56 pm

Re: DPI Scaling not updating

Post by ❤x1 »

I figured how to enable per monitor DPI awareness on windows 8.1 and above, see here : viewtopic.php?p=599281
Post Reply