Fix hit testing in non-client area of fixed-size windows, don't show resize cursors

The m_windowState member is never updated regarding active state;
isActive is instead reimplemented to query the window manager, so use
that.

To extend the area where the user can move the window over the entire
titlebar of fixed-height windows, just test whether the mouse position
is within the titlebar.

Change-Id: I6b87aacd0bdab511cfd4959df1114af5c6013852
Fixes: QTBUG-77220
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Volker Hilsheimer 2019-07-30 11:27:49 +02:00
parent 23e605cc5b
commit 3d7bd7ad19
1 changed files with 5 additions and 6 deletions

View File

@ -2621,7 +2621,8 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
// QTBUG-32663, suppress resize cursor for fixed size windows.
const QWindow *w = window();
if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input.
|| !(m_windowState & ~Qt::WindowActive)
|| (m_windowState != Qt::WindowNoState)
|| !isActive()
|| (m_data.flags & Qt::FramelessWindowHint)) {
return false;
}
@ -2641,12 +2642,10 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
return true;
}
if (localPos.y() < 0) {
const QMargins margins = frameMargins();
const int topResizeBarPos = margins.left() - margins.top();
if (localPos.y() < topResizeBarPos) {
const int topResizeBarPos = -frameMargins().top();
if (localPos.y() >= topResizeBarPos)
*result = HTCAPTION; // Extend caption over top resize bar, let's user move the window.
return true;
}
return true;
}
}
if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) {