From 4ea42798750f409f701b97a25bb0c4a2c6248ba3 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 1 Feb 2018 09:07:32 +0100 Subject: 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 Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 1a5af22814..97e54d496a 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -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); -- cgit v1.2.3