hexagon-oss / openhardwaremonitor

Open Hardware Monitor - a tool for monitoring hardware performance. Includes support for various temperature sensors, disk I/O ratings and power consumption.
Mozilla Public License 2.0
191 stars 24 forks source link

Scale problem with high screen resolution (2k, 4k) #22

Open TheJustLink opened 2 years ago

TheJustLink commented 2 years ago

I use high DPI setting in app compatibility properties.

All icons small.

And this: It is 0% load for GPU1/GPU2/CPU.

In original version, all icons have normal size, but tray icons not.

pgrawehr commented 2 years ago

I'm unfortunately unable to reproduce this issue. It looks all well for me, even with a high DPI setting. Which version did you try?

TheJustLink commented 2 years ago

I'm unfortunately unable to reproduce this issue. It looks all well for me, even with a high DPI setting. Which version did you try?

I use Release 0.9.7-alpha11.

If don't override the DPI in app settings, the quality will be low: app tray

pgrawehr commented 2 years ago

You mean that the font is blurred? Yes, I have seen that, too. I have a clue on what causes this, but currently not much of an idea on how to avoid it. This needs investigating.

gym404 commented 2 years ago

I think it's a common windows problem nowdays: https://blogs.windows.com/windowsdeveloper/2017/05/19/improving-high-dpi-experience-gdi-based-desktop-apps/

T-Troll commented 2 years ago

@pgrawehr here is how i fix it (as well as wrong scaling then app window moved to other scale monitor) in my tools:

void ResetDPIScale() {
    HKEY dpiKey;
    if (RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"),
        0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &dpiKey, NULL) == ERROR_SUCCESS) {
        char pathBuffer[2048];
        GetModuleFileNameA(NULL, pathBuffer, 2047);
        const char setValue[] = "~ GDIDPISCALING DPIUNAWARE";
        RegSetValueEx(dpiKey, pathBuffer, 0, REG_SZ, (byte*)setValue, (DWORD)strlen(setValue));
        RegCloseKey(dpiKey);
    }
}
pgrawehr commented 2 years ago

That's quite a hack, by just disabling DPI scaling for the application from the operating system. There must be a setting in WinForms to fix this as well, however scaling is implemented quite sub-optimaly there. I just didn't have time to look into that so far.

T-Troll commented 2 years ago

Yes, a kind of hack.

I don't use WinForms/MFC, plain C instead, and this is the only way to make it work correctly (both set DPI Aware/DPI Unaware just add some other issues). And this is the bug fix for issue "Windows add incorrect scaling settings then create app".

BTW, topic starter case is not worst - try to open app window at low-DPI monitor then move it to high-DPI. It will be a real pain.