Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use DPI aware functions on Qt 5 (Windows 7/8) #5391

Merged
merged 2 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
Loading