diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-03-19 10:24:59 +0400 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-20 19:31:17 +0000 |
commit | a4a15b226d8ed93b4b587213b868e2520d2cb41a (patch) | |
tree | cb6390500564430ac69c60dd421603d08c3710e8 | |
parent | 7804c3d94c569418bcee664cc06487c5b03445ea (diff) |
Client: Fix the mouse being stuck in pressed state after startSystem{Move,Resize}
Fixes: QTBUG-97037
Change-Id: I812c25b98909f9ff05ffca122e7201665023172e
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit cc246c5b53b3804c8d115ad0e7c2d76faffbc8e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/client/qwaylandinputdevice.cpp | 7 | ||||
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 1 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 14 |
3 files changed, 17 insertions, 5 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 25d61ede8..57c0ee8af 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -830,6 +830,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 @@ -868,10 +870,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 cf565cb85..becd5f9be 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -338,6 +338,7 @@ public: QPointF mSurfacePos; QPointF mGlobalPos; Qt::MouseButtons mButtons = Qt::NoButton; + Qt::MouseButton mLastButton = Qt::NoButton; struct FrameData { QWaylandPointerEvent *event = nullptr; diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 7afeebd67..42fb1312d 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -1710,15 +1710,21 @@ void QWaylandWindow::propagateSizeHints() bool QWaylandWindow::startSystemResize(Qt::Edges edges) { - if (auto *seat = display()->lastInputDevice()) - return mShellSurface && mShellSurface->resize(seat, edges); + if (auto *seat = display()->lastInputDevice()) { + bool rc = mShellSurface && mShellSurface->resize(seat, edges); + seat->handleEndDrag(); + return rc; + } return false; } bool QtWaylandClient::QWaylandWindow::startSystemMove() { - if (auto seat = display()->lastInputDevice()) - return mShellSurface && mShellSurface->move(seat); + if (auto seat = display()->lastInputDevice()) { + bool rc = mShellSurface && mShellSurface->move(seat); + seat->handleEndDrag(); + return rc; + } return false; } |