summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2023-03-19 10:24:59 +0400
committerIlya Fedin <fedin-ilja2010@ya.ru>2024-03-20 20:56:55 +0400
commitcc246c5b53b3804c8d115ad0e7c2d76faffbc8e1 (patch)
treec90483654dc8136a03d1bdcfce87dba9b1efbb96 /src
parent90d91fe626a378fbeda43a9f97f1b1f0d8eb920a (diff)
Client: Fix the mouse being stuck in pressed state after startSystem{Move,Resize}
Fixes: QTBUG-97037 Pick-to: 6.7 Change-Id: I812c25b98909f9ff05ffca122e7201665023172e Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandinputdevice.cpp7
-rw-r--r--src/client/qwaylandinputdevice_p.h1
-rw-r--r--src/client/qwaylandwindow.cpp14
3 files changed, 17 insertions, 5 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 7406e3469..d8068c147 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -835,6 +835,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
@@ -873,10 +875,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 c0a415725..dcc086420 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1736,15 +1736,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;
}