winrt: Fix mouse releases that happen outside a window

If the mouse button is released outside of a window,
we did not trigger a mouse release event.

Task-number: QTBUG-66088
Change-Id: I3ef6234cc922c8c59ac3aa6350783fae4ba36bda
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
bb10
Oliver Wolff 2018-02-01 09:07:32 +01:00
parent 675603a853
commit 4ea4279875
1 changed files with 6 additions and 0 deletions

View File

@ -1215,6 +1215,12 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
QWindowSystemInterface::handleMouseEvent(d->currentPressWindow, localPressPos, pos, buttons, mods);
d->currentPressWindow = nullptr;
}
// If the mouse button is released outside of a window, targetWindow is 0, but the event
// has to be delivered to the window, that initially received the mouse press.
if (buttons == Qt::NoButton && d->currentPressWindow && !targetWindow) {
targetWindow = d->currentPressWindow;
d->currentPressWindow = nullptr;
}
QWindowSystemInterface::handleMouseEvent(targetWindow, localPos, pos, buttons, mods);