Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 39 additions & 40 deletions src/core/contexts/win32windowcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}
}
Expand Down Expand Up @@ -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.

Expand Down
Loading