Windows: Send synthetic mouse release after move/resize using right API

The end of a move or resize might happen with the mouse still inside
the non-client area of the window, in which case we correctly resolved
the type to QEvent::NonClientAreaMouseButtonRelease, but we sent it
via QWindowSystemInterface::handleMouseEvent, which sets nonClientArea
of the event to false. This in turn resulted in QGuiApplication sending
a synthetic QEvent::MouseMove in case the position was out of sync,
instead of the correct QEvent::NonClientAreaMouseMove.

This should really be cleaned up on the QWSI level, as there is no
reason to have a dedicated API for handleFrameStrutMouseEvent, when
handleMouseEvent already takes an event type, but for now we fix the
immediate issue in the Windows platform plugin.

Pick-to: 6.5 6.2
Change-Id: I8a831f5f19adb0625b29b50ebce9c0c6514e93f3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-03-24 15:26:26 +01:00
parent d34259d966
commit b4afba0c34

View File

@ -1466,9 +1466,13 @@ void QWindowsContext::handleExitSizeMove(QWindow *window)
? QEvent::MouseButtonRelease : QEvent::NonClientAreaMouseButtonRelease;
for (Qt::MouseButton button : {Qt::LeftButton, Qt::RightButton, Qt::MiddleButton}) {
if (appButtons.testFlag(button) && !currentButtons.testFlag(button)) {
QWindowSystemInterface::handleMouseEvent(window, localPos, globalPos,
currentButtons, button, type,
keyboardModifiers);
if (type == QEvent::NonClientAreaMouseButtonRelease) {
QWindowSystemInterface::handleFrameStrutMouseEvent(window, localPos, globalPos,
currentButtons, button, type, keyboardModifiers);
} else {
QWindowSystemInterface::handleMouseEvent(window, localPos, globalPos,
currentButtons, button, type, keyboardModifiers);
}
}
}
if (d->m_systemInfo & QWindowsContext::SI_SupportsPointer)