MediaArea / MediaInfo

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://MediaArea.net/MediaInfo
BSD 2-Clause "Simplified" License
1.33k stars 161 forks source link

Windows GUI: Use older API for getting system DPI #859

Closed cjee21 closed 4 months ago

cjee21 commented 4 months ago

Use older API to get system DPI for taking DPI scaling into account when setting window size so that it works on older Windows versions.

JeromeMartinez commented 4 months ago

In theory LOGPIXELSY should be used for the height but I guess this is a corner case, but not blocking.

cjee21 commented 4 months ago

In theory LOGPIXELSY should be used for the height but I guess this is a corner case, but not blocking.

Isn't X or Y having same DPI? There is only one DPI setting.

JeromeMartinez commented 4 months ago

Isn't X or Y having same DPI? There is only one DPI setting.

I bet that in practice they are same for 99.999% of devices but my understanding of the theory is that you can get 2 different values between width and height with this API.

JeromeMartinez commented 4 months ago

There is only one DPI setting.

With this API there are 2, LOGPIXELSX ("Number of pixels per logical inch along the screen width.") and LOGPIXELSY ("Number of pixels per logical inch along the screen height.")

cjee21 commented 4 months ago

With this API there are 2, LOGPIXELSX ("Number of pixels per logical inch along the screen width.") and LOGPIXELSY ("Number of pixels per logical inch along the screen height.")

As far as I know, there is no way in Windows to set different DPI for X and Y. So I don't know if it is possible to have two different values for that API. Wonder why it has two though.

JeromeMartinez commented 4 months ago

Wonder why it has two though.

I bet that they expected to manage non square pixels (it is currently part of the past for TV only but it could return one day in computer screens... Or not) at some point and that it was abandoned in the meantime.

cjee21 commented 4 months ago

I bet that they expected to manage non square pixels (it is currently part of the past for TV only but it could return one day in computer screens... Or not) at some point and that it was abandoned in the meantime.

Probably because it seems this API can be used for printers too. Maybe printers can have different X and Y.

cjee21 commented 4 months ago

Tested on a single monitor at 100 - 200% DPI scale on Windows 11 23H2 and it works the same as when using the other API.

cjee21 commented 4 months ago

Please update with #858 (comment) ASAP, then I merge and do a new public version.

Alright.

cjee21 commented 4 months ago

Argh the space and tab issue again. 😓

JeromeMartinez commented 4 months ago

@cjee21 FYI https://github.com/MediaArea/MediaInfo/pull/860#issuecomment-2142503257.