From 8ca84fd4357b52c458678b6b21de61188d74e4a3 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Mon, 16 Nov 2020 17:15:06 +0800 Subject: [PATCH] Fix a regression. If the user set a custom title bar height, just return the original value, don't plus the border height afterwards, this is not what the user would want. But if we are querying the standard value, it should be border height + caption height. Border width and border height don't have this issue. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- winnativeeventfilter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index 7ec4252..5294309 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -2219,7 +2219,9 @@ int WinNativeEventFilter::getSystemMetric(void *handle, case SystemMetric::TitleBarHeight: { const int tbh = userData->titleBarHeight; if (tbh > 0) { - ret = qRound(tbh * dpr); + // Special case: this is the user defined value, + // don't change it and just return it untouched. + return qRound(tbh * dpr); } else { const int result_nondpi = GetSystemMetricsForWindow(hwnd, SM_CYCAPTION); const int result_dpi = GetSystemMetricsForWindow(hwnd, SM_CYCAPTION, true);