A_Screen{Width,Height,DPI} are wrong when changing the main monitor

Report problems with documented functionality
ZhuangQu
Posts: 30
Joined: 06 Feb 2022, 20:54

A_Screen{Width,Height,DPI} are wrong when changing the main monitor

07 Apr 2024, 11:45

The code for reproducibility is

Code: Select all

~LButton:: ToolTip(A_ScreenWidth "," A_ScreenHeight "," A_ScreenDPI)
I have two monitors.
For monitor 1, the size is 2560×1600 and the zoom is 200%.
For monitor 2, the size is 3840×2160 and the zoom is 175%.
First, I set monitor 1 as the main monitor and start the script. It shows "2560,1600,192" correctly.
Then I set monitor 2 as the main monitor. It shows "4389,2469,192" wrongly.
Then I restart the script. It shows "3840,2160,168" correctly.
Then I set monitor 1 as the main monitor. It shows "2240,1400,168" wrongly.
Then I restart the script. It shows "2560,1600,192" correctly.

I think the cause is that A_ScreenDPI cannot update when changing the main monitor, which led to A_ScreenWidth and A_ScreenHeight mistakes. A_ScreenDPI update only when restarting the script.
Last edited by ZhuangQu on 07 Apr 2024, 12:01, edited 4 times in total.
ZhuangQu
Posts: 30
Joined: 06 Feb 2022, 20:54

Re: A_Screen{Width,Height,DPI} are wrong when changing the main monitor

07 Apr 2024, 11:51

The key to reproduce this bug are the different zooms. If both are 200%, everything is OK.
just me
Posts: 9467
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: A_Screen{Width,Height,DPI} are wrong when changing the main monitor

09 Apr 2024, 15:36

A_ScreenDPI
In a system with multiple display monitors, this value is the same for all monitors.
?
ZhuangQu
Posts: 30
Joined: 06 Feb 2022, 20:54

Re: A_Screen{Width,Height,DPI} are wrong when changing the main monitor

10 Apr 2024, 07:02

just me wrote:
09 Apr 2024, 15:36
A_ScreenDPI
In a system with multiple display monitors, this value is the same for all monitors.
?
That's not a contradiction. A_ScreenDPI is the same for all monitors indeed.
My issue is that A_ScreenDPI should be updated when changing main monitor.
wineguy
Posts: 10
Joined: 03 Dec 2019, 16:26

Re: A_Screen{Width,Height,DPI} are wrong when changing the main monitor

10 Apr 2024, 16:32

It's documented to work that way, but the docs also offer a workaround. https://www.autohotkey.com/docs/v2/misc/DPIScaling.htm

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 14 guests