diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-18 14:32:36 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-18 14:32:36 +0300 |
commit | ffe9a357d711f5d130e1c68a56349df51d40de5a (patch) | |
tree | 1e882abdd01c0b19e264d5d5557536483104283b /src | |
parent | 47b64a55f3b8866924631ad9c22757eda9fb45c2 (diff) |
more perspective way of default font size calculation
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/src/Windows/winutil.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mir_core/src/Windows/winutil.cpp b/src/mir_core/src/Windows/winutil.cpp index 79a271fdbd..b17feca760 100644 --- a/src/mir_core/src/Windows/winutil.cpp +++ b/src/mir_core/src/Windows/winutil.cpp @@ -119,15 +119,17 @@ MIR_CORE_DLL(int) Utils_AssertInsideScreen(RECT *rc) ///////////////////////////////////////////////////////////////////////////////////////// -static LOGFONTW g_lfDefault = {0}; +static NONCLIENTMETRICSW ncm = {}; MIR_CORE_DLL(int) Utils_CorrectFontSize(int size) { if (!g_bEnableDpiAware) return size; - if (!g_lfDefault.lfHeight) - SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(g_lfDefault), &g_lfDefault, FALSE); + if (!ncm.cbSize) { + ncm.cbSize = sizeof(ncm); + SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE); + } - return size * g_lfDefault.lfHeight / -12; + return size * ncm.lfMessageFont.lfHeight / -12; } |