PureBasic Forum
https://www.purebasic.fr/english/

[Done] 5.70 Wrong coordinates in DesktopXYZ() DPI aware
https://www.purebasic.fr/english/viewtopic.php?f=4&t=72833
Page 1 of 1

Author:  kurzer [ Thu May 16, 2019 9:04 pm ]
Post subject:  [Done] 5.70 Wrong coordinates in DesktopXYZ() DPI aware

It seems as if the DesktopXYZ() commands output wrong coordinates when the compileroption DPI awareness is enabled.

Based on chis code this can be reproduced with the following sniplet.
Code:
; Run this code with PB 5.7x
; Compile it with activated DPI aware in compileroptions

ExamineDesktops()

; Supposing we only have one desktop
Repeat
   Debug DesktopWidth(0)
   Debug DesktopMouseX()
   Delay (250)
Until GetAsyncKeyState_(#VK_ESCAPE) & 1

Regardless of the compiler option "DPI aware" the real physical desktop size, mouse position etc. should be returned. At least that's what I would expect from the help texts for the commands. But this isn't the case.

My Desktopwidth is 1920 pixel, but the DPI aware compiled code shows a width of 1536 pixels (I use a desktopscaling of 125 %).

PB Help wrote:
"DesktopWidth(#Desktop) - Returns the width of the specified desktop. "

Greetings
Kurzer

Author:  Little John [ Fri May 17, 2019 7:58 am ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

- deleted -

Author:  BarryG [ Fri May 17, 2019 9:36 am ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

I didn't even know DesktopMouseX() was a thing. I was always using "mouse.POINT" and "mouse\x" in my code. When this bug gets fixed I'll switch to DesktopMouseX() in future.

Author:  Little John [ Fri May 17, 2019 10:04 am ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

Sorry, my previous post was incomplete and misleading.

I can confirm the problem with DesktopWidth() and DesktopHeight(), using PB 5.71 beta 1 (x64) on Windows 10 version 1809 with DPI 125 %.

DesktopMouseX() and DesktopMouseY() yield the same values though, regardless whether the program is compiled with or without the "DPI aware" flag.

Author:  kurzer [ Fri May 17, 2019 12:32 pm ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

Interesting. I use Windows 7 x64 (PB 5.70 LTS) and all 4 values are wrong in DPI aware mode:
Code:
   Debug DesktopWidth(0)
   Debug DesktopMouseX()
   Debug DesktopHeight(0)
   Debug DesktopMouseY()

Author:  Little John [ Fri May 17, 2019 12:48 pm ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

Little John wrote:
on Windows 10 version 1809

kurzer wrote:
Interesting. I use Windows 7

Interesting indeed.

The problem is, that different Windows versions handle DPI awareness in different ways.
After Windows 7, there were significant changes especially in Windows 8.1.
Windows 10 introduced more changes, and even different versions of Windows 10 behave differently in this regard.
For more details see e.g. https://kynosarges.org/WindowsDpi.html

Fred has to handle all that for PureBasic. :shock: I don't envy him for that.

Author:  Fred [ Fri May 24, 2019 2:11 pm ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

Fixed.

Author:  Little John [ Fri May 31, 2019 9:37 am ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

Fred wrote:
Fixed.

Thank you, Fred!

Are you soon going to release a beta 2 version?
I really would appreciate that!

Author:  Little John [ Thu Jun 27, 2019 9:33 pm ]
Post subject:  Re: 5.70 LTS: Wrong coordinates in DesktopXYZ() with DPI awa

Little John wrote:
I can confirm the problem with DesktopWidth() and DesktopHeight(), using PB 5.71 beta 1 (x64) on Windows 10 version 1809 with DPI 125 %.

Fred wrote:
Fixed.

Fix confirmed with PB 5.71 beta 2 (x64).

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/