summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2023-03-19 10:24:59 +0400
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-06-05 15:14:26 +0000
commit81d43fe8485e45116a94fca9cf49368319a9ddb3 (patch)
treeac76785898af3a74ac04d8f796c49408bb6bfc8a
parent990bfb20470c6ab568465cb3b1ffcca8ad62c08d (diff)
Client: Send release button event on pointer leave
Fixes: QTBUG-97037 Change-Id: I151239b276ab5aefe166f5615baf43dab428ce0c Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 8235fa65fe033a94e7a44322d3502f25940092ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/client/qwaylandinputdevice.cpp9
-rw-r--r--src/client/qwaylandinputdevice_p.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index b307fb43b..79a881a6e 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -707,8 +707,8 @@ public:
void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface)
{
+ releaseButtons();
invalidateFocus();
- mButtons = Qt::NoButton;
mParent->mTime = time;
@@ -823,6 +823,8 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
default: return; // invalid button number (as far as Qt is concerned)
}
+ mLastButton = qt_button;
+
if (state)
mButtons |= qt_button;
else
@@ -861,10 +863,13 @@ void QWaylandInputDevice::Pointer::invalidateFocus()
void QWaylandInputDevice::Pointer::releaseButtons()
{
+ if (mButtons == Qt::NoButton)
+ return;
+
mButtons = Qt::NoButton;
if (auto *window = focusWindow()) {
- ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers());
+ ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mLastButton, mParent->modifiers());
window->handleMouse(mParent, e);
}
}
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index 17f01f490..0f36852b0 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -333,6 +333,7 @@ public:
QPointF mSurfacePos;
QPointF mGlobalPos;
Qt::MouseButtons mButtons = Qt::NoButton;
+ Qt::MouseButton mLastButton = Qt::NoButton;
#if QT_CONFIG(cursor)
wl_buffer *mCursorBuffer = nullptr;
Qt::CursorShape mCursorShape = Qt::BitmapCursor;