From a3d4df1ebfbb5b2efd0f73a04dcacd1262938891 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sun, 3 May 2020 21:20:24 +0800 Subject: [PATCH] Minor improvement. Fixes: #7 Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- winnativeeventfilter.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index a2eee9a..01771a5 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -1253,22 +1253,26 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType, : isInSpecificObjects(mouse.x, mouse.y, _data->windowData.draggableObjects, dpr); - const bool isTitlebar = (mouse.y <= tbh) && !isInIgnoreAreas && + const bool isResizePermitted = !isInIgnoreAreas && isInDraggableAreas && !isInIgnoreObjects && isInDraggableObjects; + const bool isTitlebar = (mouse.y <= tbh) && isResizePermitted; if (IsMaximized(_hWnd)) { if (isTitlebar) { return HTCAPTION; } return HTCLIENT; } - const bool isTop = mouse.y <= bh; - const bool isBottom = mouse.y >= (wh - bh); + const bool isTop = (mouse.y <= bh) && isResizePermitted; + const bool isBottom = + (mouse.y >= (wh - bh)) && isResizePermitted; // Make the border a little wider to let the user easy to resize // on corners. const int factor = (isTop || isBottom) ? 2 : 1; - const bool isLeft = mouse.x <= (bw * factor); - const bool isRight = mouse.x >= (ww - (bw * factor)); + const bool isLeft = + (mouse.x <= (bw * factor)) && isResizePermitted; + const bool isRight = + (mouse.x >= (ww - (bw * factor))) && isResizePermitted; const bool fixedSize = _data->windowData.fixedSize; const auto getBorderValue = [fixedSize](int value) -> int { // HTBORDER: non-resizeable window border.