From 6b1ba1cd0e1389d13e59b94e65da8f20a89ba03f Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 6 Sep 2023 11:04:02 +0200 Subject: [PATCH 59/59] Revert "Client: Send release button event on pointer leave" This reverts commit 8235fa65fe033a94e7a44322d3502f25940092ec. It makes tests/manual/examples/widgets/draganddrop/puzzle not work, which does drag and drop in same app. Pick-to: 6.6 6.5 6.2 5.15 Fixes: QTBUG-115757 Task-number: QTBUG-97037 Change-Id: I738769fde96f7da91f5bc4dc7a70ed49596dcd61 Reviewed-by: Liang Qi (cherry picked from commit 60647fa069ef4143642ae4c1b529ad2a7a7f2fd9) --- src/client/qwaylandinputdevice.cpp | 9 ++------- src/client/qwaylandinputdevice_p.h | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 74f16b70..ab978d3f 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -688,8 +688,8 @@ public: void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { - releaseButtons(); invalidateFocus(); + mButtons = Qt::NoButton; mParent->mTime = time; @@ -804,8 +804,6 @@ 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 @@ -844,13 +842,10 @@ 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, mLastButton, mParent->modifiers()); + ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers()); window->handleMouse(mParent, e); } } diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index bafe3db2..5795f138 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -346,7 +346,6 @@ 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; -- 2.46.0