little-brother / sqlite-gui

Lightweight SQLite editor for Windows
GNU General Public License v2.0
1.09k stars 52 forks source link

DPI Awareness #144

Closed char101 closed 7 months ago

char101 commented 1 year ago

Hi,

When I first run the executable on my 2k monitor, the fonts in this application is blurry, which means that Windows thinks it does not support dpi scaling and stretch the bitmap. When I use the compatibility dialog and set the dpi scaling to be done by the application, the font returns to normal. So while the application supports dpi scaling, Windows doesn't think so.

It would be good if the application can inform Windows that it supports dpi scaling (by calling one of the SetProcessDPIAware functions).

little-brother commented 1 year ago

Really the app is not DPI aware (there is no code for it).

Unfortunally, I don't have 2K or 4K monitors (only fullHD) to view the app behaviour with scaling :( I'm not sure that using SetProcessDPIAware will work correct for 4K or for high-DPI screens (e.g. 4K/12').

I added SetProcessDPIAware-call to the code. Could you check it? sqlite-gui-1.7.8-x64-dpi.zip

char101 commented 1 year ago

Ah you are right, the application is not dpi aware. I was only focused on the font, now that I compare it, the controls are all smaller. On the left is the Windows scaled window, blurry font but the controls size are right. On the right is the application scaled window (from the zip above), non blurry fonts but the toolbar and tabbar are small.

I think without 2k/4k monitor, if you set your Windows dpi scaling to 125% you can see the effect.

2023-05-14 07_58_39-Releases · little-brother_sqlite-gui _ github com - Chromium

Personally I think the blurry font is more of an annoyance than the small controls.

little-brother commented 1 year ago

if you set your Windows dpi scaling to 125% you can see the effect

Unfortunately, no. There is no blur for 125% (under Win7) As I understand the Windows scale factor just multiples all metrics e.g. buttons and font sizes, so they get bigger. No needs to apply stretching.

Thanks for this bug report. I'll try to fix it when I get hi-DPI display. I'm not sure that I can handle with it since WinAPI was not supposed to have dpi-awareness at the beginning.

little-brother commented 7 months ago

Done.