diff --git a/src/client/qwaylandclipboard.cpp b/src/client/qwaylandclipboard.cpp
index 2e3c204c406a4d32cacc1764a679b35ce5d4b89c..409abaa5684e5857eef2ca29903c5fb0c9f79ca7 100644
--- a/src/client/qwaylandclipboard.cpp
+++ b/src/client/qwaylandclipboard.cpp
@@ -44,6 +44,8 @@
 #include "qwaylanddatasource_p.h"
 #include "qwaylanddatadevice_p.h"
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -60,11 +62,11 @@ QWaylandClipboard::~QWaylandClipboard()
 QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
 {
     if (mode != QClipboard::Clipboard)
-        return 0;
+        return &m_emptyData;
 
     QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
     if (!inputDevice || !inputDevice->dataDevice())
-        return 0;
+        return &m_emptyData;
 
     QWaylandDataSource *source = inputDevice->dataDevice()->selectionSource();
     if (source) {
@@ -74,7 +76,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
     if (inputDevice->dataDevice()->selectionOffer())
         return inputDevice->dataDevice()->selectionOffer()->mimeData();
 
-    return 0;
+    return &m_emptyData;
 }
 
 void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
@@ -115,3 +117,5 @@ bool QWaylandClipboard::ownsMode(QClipboard::Mode mode) const
 }
 
 QT_END_NAMESPACE
+
+#endif // QT_NO_DRAGANDDROP
diff --git a/src/client/qwaylandclipboard_p.h b/src/client/qwaylandclipboard_p.h
index aa008eef939f0bceb635a00ec2d21de240340015..6468613423ee5ed6e63d03e9fe4752591d0c0922 100644
--- a/src/client/qwaylandclipboard_p.h
+++ b/src/client/qwaylandclipboard_p.h
@@ -53,9 +53,11 @@
 
 #include <qpa/qplatformclipboard.h>
 #include <QtCore/QVariant>
+#include <QtCore/QMimeData>
 
 #include <QtWaylandClient/qwaylandclientexport.h>
 
+#ifndef QT_NO_DRAGANDDROP
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -76,10 +78,13 @@ public:
 
 private:
     QWaylandDisplay *mDisplay;
+    QMimeData m_emptyData;
 };
 
 }
 
 QT_END_NAMESPACE
 
+#endif // QT_NO_DRAGANDDROP
+
 #endif // QWAYLANDCLIPBOARD_H
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 0ff1f19794ada81e5c1f49c0f3f37f87c0268b51..7deb326096294b29528e7450826bd02c958e34c9 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -56,6 +56,8 @@
 #include <qpa/qplatformdrag.h>
 #include <qpa/qwindowsysteminterface.h>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -267,3 +269,5 @@ QPoint QWaylandDataDevice::calculateDragPosition(int x, int y, QWindow *wnd) con
 }
 
 QT_END_NAMESPACE
+
+#endif // QT_NO_DRAGANDDROP
diff --git a/src/client/qwaylanddatadevice_p.h b/src/client/qwaylanddatadevice_p.h
index 579cb3c7c7c5dadba5a2e28983dd0727936b9233..df0f297bcad8484817a56e69775cbbd6db126e24 100644
--- a/src/client/qwaylanddatadevice_p.h
+++ b/src/client/qwaylanddatadevice_p.h
@@ -57,6 +57,8 @@
 
 #include <QtWaylandClient/private/qwayland-wayland.h>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 class QMimeData;
@@ -119,4 +121,6 @@ private:
 
 QT_END_NAMESPACE
 
+#endif // QT_NO_DRAGANDDROP
+
 #endif // QWAYLANDDATADEVICE_H
diff --git a/src/client/qwaylanddatadevicemanager.cpp b/src/client/qwaylanddatadevicemanager.cpp
index 35d67307fc30888cb45eeca2376b21be4bf33222..5c6f74157554fd24a4f51cb260bcc54408ced015 100644
--- a/src/client/qwaylanddatadevicemanager.cpp
+++ b/src/client/qwaylanddatadevicemanager.cpp
@@ -46,6 +46,8 @@
 
 #include <QtCore/QDebug>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -80,3 +82,5 @@ QWaylandDisplay *QWaylandDataDeviceManager::display() const
 }
 
 QT_END_NAMESPACE
+
+#endif // QT_NO_DRAGANDDROP
diff --git a/src/client/qwaylanddatadevicemanager_p.h b/src/client/qwaylanddatadevicemanager_p.h
index 0c1d95d822366713c3df94857e8461077f489f9e..90ca301b3acb900cd2b19e630ce15f1903265436 100644
--- a/src/client/qwaylanddatadevicemanager_p.h
+++ b/src/client/qwaylanddatadevicemanager_p.h
@@ -54,6 +54,8 @@
 #include <QtWaylandClient/qwaylandclientexport.h>
 #include <QtWaylandClient/private/qwayland-wayland.h>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -81,4 +83,6 @@ private:
 
 QT_END_NAMESPACE
 
+#endif // QT_NO_DRAGANDDROP
+
 #endif // QWAYLANDDATADEVICEMANAGER_H
diff --git a/src/client/qwaylanddataoffer.cpp b/src/client/qwaylanddataoffer.cpp
index 2491c658b12dbe6f240e314a6f04902a11cae7c1..b33a98e0f00255b64cc9a6d501829de6e26cfcea 100644
--- a/src/client/qwaylanddataoffer.cpp
+++ b/src/client/qwaylanddataoffer.cpp
@@ -47,6 +47,8 @@
 
 #include <QtCore/QDebug>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -181,3 +183,5 @@ int QWaylandMimeData::readData(int fd, QByteArray &data) const
 }
 
 QT_END_NAMESPACE
+
+#endif // QT_NO_DRAGANDDROP
diff --git a/src/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h
index 5e635c1a0dba504e01289fb83aa7ed13b90066b2..6368bff9b7db6b10f2bbbb595f8f315d65cc2c30 100644
--- a/src/client/qwaylanddataoffer_p.h
+++ b/src/client/qwaylanddataoffer_p.h
@@ -56,6 +56,7 @@
 #include <QtWaylandClient/qwaylandclientexport.h>
 #include <QtWaylandClient/private/qwayland-wayland.h>
 
+#ifndef QT_NO_DRAGANDDROP
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -105,5 +106,5 @@ private:
 }
 
 QT_END_NAMESPACE
-
+#endif // QT_NO_DRAGANDDROP
 #endif
diff --git a/src/client/qwaylanddatasource.cpp b/src/client/qwaylanddatasource.cpp
index 40beea317cd3924a4a0138b354bf4c407b34c252..bada694ca55177ada6b8cfb685ae92489dc8a717 100644
--- a/src/client/qwaylanddatasource.cpp
+++ b/src/client/qwaylanddatasource.cpp
@@ -49,6 +49,8 @@
 
 #include <unistd.h>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 namespace QtWaylandClient {
@@ -96,3 +98,5 @@ void QWaylandDataSource::data_source_target(const QString &mime_type)
 }
 
 QT_END_NAMESPACE
+
+#endif // QT_NO_DRAGANDDROP
diff --git a/src/client/qwaylanddatasource_p.h b/src/client/qwaylanddatasource_p.h
index c099ff62a49fbb8556090cad48bdc737bb6fd112..9e29ae8b8c2d3ba35b7e40836b9a50d943ccad61 100644
--- a/src/client/qwaylanddatasource_p.h
+++ b/src/client/qwaylanddatasource_p.h
@@ -56,6 +56,8 @@
 #include <QtWaylandClient/private/qwayland-wayland.h>
 #include <QtWaylandClient/qwaylandclientexport.h>
 
+#ifndef QT_NO_DRAGANDDROP
+
 QT_BEGIN_NAMESPACE
 
 class QMimeData;
@@ -92,4 +94,6 @@ private:
 
 QT_END_NAMESPACE
 
+#endif // QT_NO_DRAGANDDROP
+
 #endif // QWAYLANDDATASOURCE_H
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index a5e61e28a73c01736b7ad479f31f7bc042e1baee..b83bd39e2012043fa362c2131e19703c391a4262 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -119,7 +119,9 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co
 
 QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
     : mWaylandIntegration(waylandIntegration)
+#ifndef QT_NO_DRAGANDDROP
     , mDndSelectionHandler(0)
+#endif
     , mWindowExtension(0)
     , mSubCompositor(0)
     , mTouchExtension(0)
@@ -157,7 +159,9 @@ QWaylandDisplay::~QWaylandDisplay(void)
         mWaylandIntegration->destroyScreen(screen);
     }
     mScreens.clear();
+#ifndef QT_NO_DRAGANDDROP
     delete mDndSelectionHandler.take();
+#endif
     wl_display_disconnect(mDisplay);
 }
 
@@ -250,8 +254,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
     } else if (interface == QStringLiteral("wl_seat")) {
         QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
         mInputDevices.append(inputDevice);
+#ifndef QT_NO_DRAGANDDROP
     } else if (interface == QStringLiteral("wl_data_device_manager")) {
         mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
+#endif
     } else if (interface == QStringLiteral("qt_surface_extension")) {
         mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
     } else if (interface == QStringLiteral("wl_subcompositor")) {
@@ -421,6 +427,12 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
     mLastKeyboardFocus = keyboardFocus;
 }
 
+void QWaylandDisplay::handleWindowDestroyed(QWaylandWindow *window)
+{
+    if (mActiveWindows.contains(window))
+        handleWindowDeactivated(window);
+}
+
 void QWaylandDisplay::handleWaylandSync()
 {
     // This callback is used to set the window activation because we may get an activate/deactivate
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index f4fb3fa56a847a21762f0f614beba1519a6f43fa..fae17d535ebe2b0b0300bcb05ea6bba80da10fe0 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -137,9 +137,9 @@ public:
     QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
     QWaylandInputDevice *defaultInputDevice() const;
     QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
-
+#ifndef QT_NO_DRAGANDDROP
     QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); }
-
+#endif
     QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); }
     QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); }
     QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); }
@@ -176,6 +176,7 @@ public:
     void handleWindowActivated(QWaylandWindow *window);
     void handleWindowDeactivated(QWaylandWindow *window);
     void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice);
+    void handleWindowDestroyed(QWaylandWindow *window);
 
 public slots:
     void blockingReadEvents();
@@ -201,7 +202,9 @@ private:
     QList<QWaylandInputDevice *> mInputDevices;
     QList<Listener> mRegistryListeners;
     QWaylandIntegration *mWaylandIntegration;
+#ifndef QT_NO_DRAGANDDROP
     QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler;
+#endif
     QScopedPointer<QtWayland::qt_surface_extension> mWindowExtension;
     QScopedPointer<QtWayland::wl_subcompositor> mSubCompositor;
     QScopedPointer<QWaylandTouchExtension> mTouchExtension;
@@ -217,7 +220,7 @@ private:
     uint32_t mLastInputSerial;
     QWaylandInputDevice *mLastInputDevice;
     QPointer<QWaylandWindow> mLastInputWindow;
-    QWaylandWindow *mLastKeyboardFocus;
+    QPointer<QWaylandWindow> mLastKeyboardFocus;
     QVector<QWaylandWindow *> mActiveWindows;
     struct wl_callback *mSyncCallback;
     static const wl_callback_listener syncCallbackListener;
diff --git a/src/client/qwaylanddnd.cpp b/src/client/qwaylanddnd.cpp
index b59ac6d704c80152d0dc0abcfbde224082136613..e29267fc901c59816f98889f8db6f5c7430f4e34 100644
--- a/src/client/qwaylanddnd.cpp
+++ b/src/client/qwaylanddnd.cpp
@@ -50,7 +50,7 @@
 #include <QDebug>
 
 QT_BEGIN_NAMESPACE
-
+#ifndef QT_NO_DRAGANDDROP
 namespace QtWaylandClient {
 
 QWaylandDrag::QWaylandDrag(QWaylandDisplay *display)
@@ -98,7 +98,7 @@ void QWaylandDrag::drop(const QPoint &globalPos)
 
 void QWaylandDrag::endDrag()
 {
-    // Do nothing
+    m_display->currentInputDevice()->handleEndDrag();
 }
 
 void QWaylandDrag::updateTarget(const QString &mimeType)
@@ -131,5 +131,5 @@ void QWaylandDrag::finishDrag(const QPlatformDropQtResponse &response)
 }
 
 }
-
+#endif // QT_NO_DRAGANDDROP
 QT_END_NAMESPACE
diff --git a/src/client/qwaylanddnd_p.h b/src/client/qwaylanddnd_p.h
index 2ff00b9ffcf02d0c7423679ed9df6338b8cfd98c..464b9837bea4dc0e43ef8266c2ab7f75410769df 100644
--- a/src/client/qwaylanddnd_p.h
+++ b/src/client/qwaylanddnd_p.h
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
 namespace QtWaylandClient {
 
 class QWaylandDisplay;
-
+#ifndef QT_NO_DRAGANDDROP
 class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag
 {
 public:
@@ -88,7 +88,7 @@ protected:
 private:
     QWaylandDisplay *m_display;
 };
-
+#endif
 }
 
 QT_END_NAMESPACE
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index f490f07ffe5874bba962313c734cf18332189b79..94316bafccc3fcb1bc02340242454c22a9498c13 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -188,9 +188,11 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
     , mSerial(0)
     , mTouchDevice(0)
 {
+#ifndef QT_NO_DRAGANDDROP
     if (mQDisplay->dndSelectionHandler()) {
         mDataDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this);
     }
+#endif
 
     if (mQDisplay->textInputManager()) {
         mTextInput = new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()));
@@ -268,6 +270,14 @@ void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window)
         mTouch->mFocus = 0;
 }
 
+void QWaylandInputDevice::handleEndDrag()
+{
+    if (mTouch)
+        mTouch->releasePoints();
+    if (mPointer)
+        mPointer->releaseButtons();
+}
+
 void QWaylandInputDevice::setDataDevice(QWaylandDataDevice *device)
 {
     mDataDevice = device;
@@ -532,6 +542,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:
@@ -845,6 +863,16 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased()
     return true;
 }
 
+void QWaylandInputDevice::Touch::releasePoints()
+{
+    Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) {
+        QWindowSystemInterface::TouchPoint tp = previousPoint;
+        tp.state = Qt::TouchPointReleased;
+        mTouchPoints.append(tp);
+    }
+    touch_frame();
+}
+
 void QWaylandInputDevice::Touch::touch_frame()
 {
     // Copy all points, that are in the previous but not in the current list, as stationary.
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index ea685223d8d4cac8fee7c76a983403020ec82aca..2f39bc5472132412318f2c9eb6258647bc9c67e1 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -105,6 +105,7 @@ public:
     void setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size);
     void setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot);
     void handleWindowDestroyed(QWaylandWindow *window);
+    void handleEndDrag();
 
     void setDataDevice(QWaylandDataDevice *device);
     QWaylandDataDevice *dataDevice() const;
@@ -239,6 +240,8 @@ public:
                       uint32_t axis,
                       wl_fixed_t value) Q_DECL_OVERRIDE;
 
+    void releaseButtons();
+
     QWaylandInputDevice *mParent;
     QWaylandWindow *mFocus;
     uint32_t mEnterSerial;
@@ -271,6 +274,7 @@ public:
     void touch_cancel() Q_DECL_OVERRIDE;
 
     bool allTouchPointsReleased();
+    void releasePoints();
 
     QWaylandInputDevice *mParent;
     QWaylandWindow *mFocus;
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index df88a4886792a551be96f3610acefcbec42ee24d..147e45b0c6f9afe754aaf4302f017f91b7e98e13 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -132,9 +132,10 @@ QWaylandIntegration::QWaylandIntegration()
 {
     initializeInputDeviceIntegration();
     mDisplay = new QWaylandDisplay(this);
+#ifndef QT_NO_DRAGANDDROP
     mClipboard = new QWaylandClipboard(mDisplay);
     mDrag = new QWaylandDrag(mDisplay);
-
+#endif
     QString icStr = QPlatformInputContextFactory::requested();
     if (!icStr.isNull()) {
         mInputContext.reset(QPlatformInputContextFactory::create(icStr));
@@ -153,8 +154,10 @@ QWaylandIntegration::QWaylandIntegration()
 
 QWaylandIntegration::~QWaylandIntegration()
 {
+#ifndef QT_NO_DRAGANDDROP
     delete mDrag;
     delete mClipboard;
+#endif
 #ifndef QT_NO_ACCESSIBILITY
     delete mAccessibility;
 #endif
@@ -230,6 +233,7 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
     return mFontDb;
 }
 
+#ifndef QT_NO_DRAGANDDROP
 QPlatformClipboard *QWaylandIntegration::clipboard() const
 {
     return mClipboard;
@@ -239,6 +243,7 @@ QPlatformDrag *QWaylandIntegration::drag() const
 {
     return mDrag;
 }
+#endif // QT_NO_DRAGANDDROP
 
 QPlatformInputContext *QWaylandIntegration::inputContext() const
 {
diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h
index 9a4990229816220882dd28dbd0202902c44b85c1..4f5e651d209301e1849da94e32d1353b1945b420 100644
--- a/src/client/qwaylandintegration_p.h
+++ b/src/client/qwaylandintegration_p.h
@@ -85,11 +85,10 @@ public:
     QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
 
     QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
-
+#ifndef QT_NO_DRAGANDDROP
     QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
-
     QPlatformDrag *drag() const Q_DECL_OVERRIDE;
-
+#endif
     QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
 
     QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
@@ -126,8 +125,10 @@ private:
     QWaylandShellIntegration *createShellIntegration(const QString& interfaceName);
 
     QPlatformFontDatabase *mFontDb;
+#ifndef QT_NO_DRAGANDDROP
     QPlatformClipboard *mClipboard;
     QPlatformDrag *mDrag;
+#endif
     QWaylandDisplay *mDisplay;
     QPlatformNativeInterface *mNativeInterface;
     QScopedPointer<QPlatformInputContext> mInputContext;
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index bad64204b29d14bda91d4a8f3c8ad2cbf8714f18..2c87bb9f69658078acf155fbfac0e378995c93ef 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -115,6 +115,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
     return NULL;
 }
 
+#ifndef QT_NO_OPENGL
 void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
 {
     QByteArray lowerCaseResource = resource.toLower();
@@ -130,6 +131,7 @@ void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resour
 
     return 0;
 }
+#endif // QT_NO_OPENGL
 
 QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const
 {
diff --git a/src/client/qwaylandnativeinterface_p.h b/src/client/qwaylandnativeinterface_p.h
index 83e3fe5fa0f6f517c2c6d0fec771bfa0e91d9aa7..49e52cdcb5757aa80272bfe87ba43f20ee39e65b 100644
--- a/src/client/qwaylandnativeinterface_p.h
+++ b/src/client/qwaylandnativeinterface_p.h
@@ -72,8 +72,9 @@ public:
                                   QWindow *window) Q_DECL_OVERRIDE;
     void *nativeResourceForScreen(const QByteArray &resourceString,
                                   QScreen *screen) Q_DECL_OVERRIDE;
+#ifndef QT_NO_OPENGL
     void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE;
-
+#endif
     QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE;
     QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE;
     QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE;
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index aa7b57817abd322142c51098acb1bed548de653d..01a0d48bb88e771dc66a03232910ca169e26a7d6 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -102,6 +102,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
 
 QWaylandWindow::~QWaylandWindow()
 {
+    mDisplay->handleWindowDestroyed(this);
+
     delete mWindowDecoration;
 
     if (isInitialized())
@@ -283,6 +285,7 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
     if (mSubSurfaceWindow) {
         QMargins m = QPlatformWindow::parent()->frameMargins();
         mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top());
+        mSubSurfaceWindow->parent()->window()->requestUpdate();
     } else if (shellSurface() && window()->transientParent() && window()->type() != Qt::Popup)
         shellSurface()->updateTransientParent(window()->transientParent());
 }
@@ -664,6 +667,8 @@ bool QWaylandWindow::createDecoration()
             QMargins m = frameMargins();
             subsurf->set_position(pos.x() + m.left(), pos.y() + m.top());
         }
+        if (!mChildren.isEmpty())
+            window()->requestUpdate();
     }
 
     return mWindowDecoration;
@@ -805,10 +810,12 @@ void QWaylandWindow::requestActivateWindow()
 
 void QWaylandWindow::unfocus()
 {
+#ifndef QT_NO_DRAGANDDROP
     QWaylandInputDevice *inputDevice = mDisplay->currentInputDevice();
     if (inputDevice && inputDevice->dataDevice()) {
         inputDevice->dataDevice()->invalidateSelectionOffer();
     }
+#endif
 }
 
 bool QWaylandWindow::isExposed() const
diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp
index 4f9d8cfbffd40fc8ce9c987d7ffcff4ac6312d6b..a3bbb064880e39356afcbacf84c2654fc10b2c52 100644
--- a/src/client/qwaylandxdgsurface.cpp
+++ b/src/client/qwaylandxdgsurface.cpp
@@ -138,7 +138,9 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent)
     QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
     if (!parent_wayland_window)
         return;
-    set_parent(m_shell->get_xdg_surface(parent_wayland_window->object()));
+    auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent_wayland_window->shellSurface());
+    Q_ASSERT(parentXdgSurface);
+    set_parent(parentXdgSurface->object());
 }
 
 void QWaylandXdgSurface::setTitle(const QString & title)
diff --git a/sync.profile b/sync.profile
index 6fee67e416dfa9c28215a2c4a6ec20ce9ec2596d..1276df081b8d56f433f39c23dbdaf1552ce71b71 100644
--- a/sync.profile
+++ b/sync.profile
@@ -8,18 +8,6 @@
 );
 %deprecatedheaders = (
 );
-# Module dependencies.
-# Every module that is required to build this module should have one entry.
-# Each of the module version specifiers can take one of the following values:
-#   - A specific Git revision.
-#   - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
-#   - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch)
-#
-%dependencies = (
-    "qtbase" => "",
-    "qtdeclarative" => "",
-);
-
 %classnames = (
     "qwaylandquickextension.h" => "QWaylandQuickExtension",
 );