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>
This commit is contained in:
Johan Klokkhammer Helsing 2016-10-12 15:29:30 +02:00 committed by Johan Helsing
parent c8e2e7d102
commit 8d291193ab
2 changed files with 12 additions and 0 deletions

View File

@ -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:

View File

@ -228,6 +228,8 @@ public:
uint32_t axis,
wl_fixed_t value) Q_DECL_OVERRIDE;
void releaseButtons();
QWaylandInputDevice *mParent;
QWaylandWindow *mFocus;
uint32_t mEnterSerial;