From f7a386eeaec8e6314c1be7de5e14e9fe3847f9ba Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing <johan.helsing@qt.io> Date: Wed, 12 Oct 2016 15:29:30 +0200 Subject: [PATCH] Client: Cleanup mouse state after drag Fixes an issue where dragging with the mouse would cause the next touch event to not generate a synthesized mouse press event. The touchDrag test can now be run directly after the mouseDrag test without failing. Task-number: QTBUG-56187 Change-Id: I53cc5f90fc8d8672936b23f54a017687d41c31fc Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> --- src/client/qwaylandinputdevice.cpp | 10 ++++++++++ src/client/qwaylandinputdevice_p.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 669deac2..c3b6cf45 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -260,6 +260,8 @@ void QWaylandInputDevice::handleEndDrag() { if (mTouch) mTouch->releasePoints(); + if (mPointer) + mPointer->releaseButtons(); } void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device) @@ -516,6 +518,14 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time } } +void QWaylandInputDevice::Pointer::releaseButtons() +{ + mButtons = Qt::NoButton; + MotionEvent e(mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); + if (mFocus) + mFocus->handleMouse(mParent, e); +} + class WheelEvent : public QWaylandPointerEvent { public: diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index f1a82d45..a615e266 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -228,6 +228,8 @@ public: uint32_t axis, wl_fixed_t value) Q_DECL_OVERRIDE; + void releaseButtons(); + QWaylandInputDevice *mParent; QWaylandWindow *mFocus; uint32_t mEnterSerial; -- GitLab