diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 669deac2a26fa9d2c888dfb977533ed765c9749d..c3b6cf4532f1545824d84782c6a4aef7fd1f7238 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 f1a82d45b11332fb7c6254f87913026f9c00358e..a615e266337bbeffd7d93ee4462175c003144862 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;