diff --git a/framelessquickhelper.cpp b/framelessquickhelper.cpp index 4a9ccda..cc101c8 100644 --- a/framelessquickhelper.cpp +++ b/framelessquickhelper.cpp @@ -48,7 +48,7 @@ int FramelessQuickHelper::borderWidth() const { const auto hWnd = reinterpret_cast(win->winId()); if (hWnd) { return WinNativeEventFilter::getSystemMetric( - hWnd, WinNativeEventFilter::SystemMetric::BorderWidth, false); + hWnd, WinNativeEventFilter::SystemMetric::BorderWidth); } } return m_defaultBorderWidth; @@ -83,7 +83,7 @@ int FramelessQuickHelper::borderHeight() const { const auto hWnd = reinterpret_cast(win->winId()); if (hWnd) { return WinNativeEventFilter::getSystemMetric( - hWnd, WinNativeEventFilter::SystemMetric::BorderHeight, false); + hWnd, WinNativeEventFilter::SystemMetric::BorderHeight); } } return m_defaultBorderHeight; @@ -118,8 +118,7 @@ int FramelessQuickHelper::titleBarHeight() const { const auto hWnd = reinterpret_cast(win->winId()); if (hWnd) { return WinNativeEventFilter::getSystemMetric( - hWnd, WinNativeEventFilter::SystemMetric::TitleBarHeight, - false); + hWnd, WinNativeEventFilter::SystemMetric::TitleBarHeight); } } return m_defaultTitleBarHeight; diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index 6a278a4..84ce88b 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -1133,9 +1133,9 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType, // identical in most cases, when the scale factor is 1.0, it // should be eight pixels. const int bw = - getSystemMetric(msg->hwnd, SystemMetric::BorderWidth); - const int bh = - getSystemMetric(msg->hwnd, SystemMetric::BorderHeight); + getSystemMetric(msg->hwnd, SystemMetric::BorderWidth, true); + const int bh = getSystemMetric( + msg->hwnd, SystemMetric::BorderHeight, true); clientRect->top += bh; clientRect->bottom -= bh; clientRect->left += bw; @@ -1417,13 +1417,13 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType, GET_Y_LPARAM(_lParam)}; POINT mouse = globalMouse; m_lpScreenToClient(_hWnd, &mouse); - // These values are DPI-aware. + // These values should be DPI-aware. const LONG bw = - getSystemMetric(_hWnd, SystemMetric::BorderWidth); + getSystemMetric(_hWnd, SystemMetric::BorderWidth, true); const LONG bh = - getSystemMetric(_hWnd, SystemMetric::BorderHeight); + getSystemMetric(_hWnd, SystemMetric::BorderHeight, true); const LONG tbh = - getSystemMetric(_hWnd, SystemMetric::TitleBarHeight); + getSystemMetric(_hWnd, SystemMetric::TitleBarHeight, true); const qreal dpr = GetDevicePixelRatioForWindow(_hWnd); const bool isInIgnoreAreas = isInSpecificAreas(mouse.x, mouse.y, _data.ignoreAreas, dpr); @@ -1782,8 +1782,7 @@ void WinNativeEventFilter::updateQtFrame(QWindow *const window, void WinNativeEventFilter::updateQtFrame_internal(const HWND handle) { ResolveWin32APIs(); if (handle && m_lpIsWindow(handle)) { - const int tbh = - getSystemMetric(handle, SystemMetric::TitleBarHeight, false); + const int tbh = getSystemMetric(handle, SystemMetric::TitleBarHeight); #ifdef QT_WIDGETS_LIB const QWidget *const widget = QWidget::find(reinterpret_cast(handle)); diff --git a/winnativeeventfilter.h b/winnativeeventfilter.h index 2542f41..d3a1be5 100644 --- a/winnativeeventfilter.h +++ b/winnativeeventfilter.h @@ -106,7 +106,7 @@ public: // System metric value of the given window (if the pointer is null, // return the system's standard value). static int getSystemMetric(const HWND handle, const SystemMetric metric, - const bool dpiAware = true); + const bool dpiAware = false); // Use this function to trigger a frame change event or redraw a // specific window. Useful when you want to let some changes