Minor improvement.

Fixes: #7

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-05-03 21:20:24 +08:00
parent 092f7147ab
commit a3d4df1ebf
1 changed files with 9 additions and 5 deletions

View File

@ -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.