diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a9654f3ffe..0e6b65f6132 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unversioned - Major: Release plugins alpha. (#5288) -- Major: Improve high-DPI support on Windows. (#4868) +- Major: Improve high-DPI support on Windows. (#4868, #5391) - Minor: Add option to customise Moderation buttons with images. (#5369) - Minor: Colored usernames now update on the fly when changing the "Color @usernames" setting. (#5300) - Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378) diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 5a1df70af2e..08a13007ab9 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -121,12 +121,19 @@ RECT windowBordersFor(HWND hwnd, bool isMaximized) auto addBorders = isMaximized || isWindows11OrGreater(); if (addBorders) { + // GetDpiForWindow and GetSystemMetricsForDpi are only supported on + // Windows 10 and later. Qt 6 requires Windows 10. +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) auto dpi = GetDpiForWindow(hwnd); +# endif + auto systemMetric = [&](auto index) { +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (dpi != 0) { return GetSystemMetricsForDpi(index, dpi); } +# endif return GetSystemMetrics(index); };