diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index 11bcce7..99d86ea 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -1945,16 +1945,9 @@ namespace QWK { QPoint qtScenePos = QHighDpi::fromNativeLocalPosition(point2qpoint(nativeLocalPos), m_windowHandle.data()); - int frameSize = getResizeBorderThickness(hWnd); - bool isFixedWidth = isHostWidthFixed(); bool isFixedHeight = isHostHeightFixed(); bool isFixedSize = isHostSizeFixed(); - bool isInLeftBorder = nativeLocalPos.x <= frameSize; - bool isInTopBorder = nativeLocalPos.y <= frameSize; - bool isInRightBorder = nativeLocalPos.x > clientWidth - frameSize; - bool isInBottomBorder = nativeLocalPos.y > clientHeight - frameSize; - bool isInTitleBar = isInTitleBarDraggableArea(qtScenePos); WindowAgentBase::SystemButton sysButtonType = WindowAgentBase::Unknown; bool isInCaptionButtons = isInSystemButtons(qtScenePos, &sysButtonType); static constexpr bool dontOverrideCursor = false; // ### TODO @@ -1967,44 +1960,42 @@ namespace QWK { // the user to be able to resize the window with the top or right window border, // this is also the normal behavior of a native Win32 window (but only when the // window is not maximized/fullscreen/minimized, of course). - if (isWindowNoState(hWnd)) { - static constexpr const quint8 kBorderSize = 2; - bool isTop = nativeLocalPos.y <= kBorderSize; - bool isLeft = nativeLocalPos.x <= kBorderSize; - bool isRight = nativeLocalPos.x > clientWidth - kBorderSize; - if (isTop || isLeft || isRight) { - if (isFixedSize || dontOverrideCursor) { - // The user doesn't want the window to be resized, so we tell - // Windows we are in the client area so that the controls beneath - // the mouse cursor can still be hovered or clicked. - *result = isInTitleBar ? HTCAPTION : HTCLIENT; - } else { - if (isTop) { - if (isLeft) { - if (isFixedWidth) { - *result = HTTOP; - } else if (isFixedHeight) { - *result = HTLEFT; - } else { - *result = HTTOPLEFT; - } - } else if (isRight) { - if (isFixedWidth) { - *result = HTTOP; - } else if (isFixedHeight) { - *result = HTRIGHT; - } else { - *result = HTTOPRIGHT; - } + static constexpr const quint8 kBorderSize = 2; + bool isTop = nativeLocalPos.y <= kBorderSize; + bool isLeft = nativeLocalPos.x <= kBorderSize; + bool isRight = nativeLocalPos.x > clientWidth - kBorderSize; + if ((isTop || isLeft || isRight) && isWindowNoState(hWnd)) { + if (isFixedSize || dontOverrideCursor) { + // The user doesn't want the window to be resized, so we tell + // Windows we are in the client area so that the controls beneath + // the mouse cursor can still be hovered or clicked. + *result = HTCLIENT; + } else { + if (isTop) { + if (isLeft) { + if (isFixedWidth) { + *result = HTTOP; + } else if (isFixedHeight) { + *result = HTLEFT; } else { - *result = isFixedHeight ? HTBORDER : HTTOP; + *result = HTTOPLEFT; } - } else { + } else if (isRight) { if (isFixedWidth) { - *result = HTBORDER; + *result = HTTOP; + } else if (isFixedHeight) { + *result = HTRIGHT; } else { - *result = isLeft ? HTLEFT : HTRIGHT; + *result = HTTOPRIGHT; } + } else { + *result = isFixedHeight ? HTBORDER : HTTOP; + } + } else { + if (isFixedWidth) { + *result = HTBORDER; + } else { + *result = isLeft ? HTLEFT : HTRIGHT; } } } @@ -2042,6 +2033,14 @@ namespace QWK { } return true; } + + int frameSize = getResizeBorderThickness(hWnd); + bool isInLeftBorder = nativeLocalPos.x <= frameSize; + bool isInTopBorder = nativeLocalPos.y <= frameSize; + bool isInRightBorder = nativeLocalPos.x > clientWidth - frameSize; + bool isInBottomBorder = nativeLocalPos.y > clientHeight - frameSize; + bool isInTitleBar = isInTitleBarDraggableArea(qtScenePos); + // OK, we are not inside any chrome buttons, try to find out which part of the // window are we hitting.