diff --git a/config.tests/drm_egl_server/main.cpp b/config.tests/drm_egl_server/main.cpp
index 6552fe74e9b31e940e42bfa196bdfc60432a6181..0dbd42f90bea26224cd6ebbc2aa881e1aac835a4 100644
--- a/config.tests/drm_egl_server/main.cpp
+++ b/config.tests/drm_egl_server/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/glx/main.cpp b/config.tests/glx/main.cpp
index 2d413e1915a3f80313cde9f4c7ca1b0265e651e1..c902c55d7ac07d4d87f95110976fcc75c0e27587 100644
--- a/config.tests/glx/main.cpp
+++ b/config.tests/glx/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/libhybris_egl_server/main.cpp b/config.tests/libhybris_egl_server/main.cpp
index 2948895725d6d2f3fb7160c8917c0e8cb087aac3..368b57a12af37154fddd08cc784a7387c77b9659 100644
--- a/config.tests/libhybris_egl_server/main.cpp
+++ b/config.tests/libhybris_egl_server/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2014 Jolla Ltd, author: <giulio.camuffo@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/wayland/main.cpp b/config.tests/wayland/main.cpp
index 1af00ee38fb6148521bc58d96d162a11067af357..9e0002db506bdcb88ac011fcc4717fc495d5dadf 100644
--- a/config.tests/wayland/main.cpp
+++ b/config.tests/wayland/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/wayland_cursor/main.cpp b/config.tests/wayland_cursor/main.cpp
index e1a2bccc476f93f5e017444e689ddb91e80f107e..c9cf66196246e8c48ac367765b8d7f3e7b21157a 100644
--- a/config.tests/wayland_cursor/main.cpp
+++ b/config.tests/wayland_cursor/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/wayland_egl/main.cpp b/config.tests/wayland_egl/main.cpp
index f79677cd103eb3193508bcfdea828547dfb3ce21..c500564695ab09e340c6b2c1c7d2c7683a5f802a 100644
--- a/config.tests/wayland_egl/main.cpp
+++ b/config.tests/wayland_egl/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/wayland_scanner/main.cpp b/config.tests/wayland_scanner/main.cpp
index 5d20b5bf6ef54aefeab2b6a99b1cd645b7ab28c9..dd66f5ff5cd6bf2b08b4e485ed444aedc1e9a7d3 100644
--- a/config.tests/wayland_scanner/main.cpp
+++ b/config.tests/wayland_scanner/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/config.tests/xcomposite/main.cpp b/config.tests/xcomposite/main.cpp
index 11ba3b5a2fc156baa926d2a6a230475be803de43..1867b204e77613f2cdc9d18ff55444f0fb7f09f9 100644
--- a/config.tests/xcomposite/main.cpp
+++ b/config.tests/xcomposite/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the Qt Compositor.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/dist/changes-5.9.2 b/dist/changes-5.9.2
new file mode 100644
index 0000000000000000000000000000000000000000..23de8dc95ffd43b7178ba7ea4a11e4093be850ef
--- /dev/null
+++ b/dist/changes-5.9.2
@@ -0,0 +1,62 @@
+Qt 5.9.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.9.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.9 series is binary compatible with the 5.8.x series.
+Applications compiled for 5.8 will continue to run with 5.9. Exception:
+between Qt 5.8.0 and 5.9.0 the QWaylandQuickOutput class was changed
+in a binary incompatible way.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+*                            Qt Wayland General                            *
+****************************************************************************
+
+- Fix detection of wayland-egl on imx6 without pkg-config.
+
+****************************************************************************
+*                            Qt Wayland QPA Plugin                         *
+****************************************************************************
+
+- Fix crash when window was reset twice (e.g. if both setParent and
+  setVisible was called together).
+
+- [QTBUG-61704] Fix crash when focus event arrives after hiding window.
+
+- Fix crash when window attach was called without waiting for frame
+  callbacks.
+
+- [QTBUG-62048] Fix crash with nested menus on Weston.
+
+- [QTBUG-62044] Fix crash when second monitor is attached.
+
+- Update QWindow::screen() based on surface enter/leave events.
+
+- Send pointer event to all bound resources. This fixes the issue where
+  the breeze Qt style would block mouse events, leading to an unresponsive
+  client.
+
+- [QTBUG-60932] Place popup menus correctly even if parent is not set.
+
+- Make tooltips non-grabbing with XDG shell v6.
+
+- Make the QT_WAYLAND_SERVER_BUFFER_INTEGRATION environment variable work.
+
+
+
+****************************************************************************
+*                       Qt Wayland Compositor API                          *
+****************************************************************************
+
+- Buffer returned by toOpenGLTexture() now has correct size and format.
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp
index 81f524d9dbf704d3ee1d8cf9c5a6403d5e47a3d8..41b4a30e9218acd11c3005f56d639ccd9a04c039 100644
--- a/examples/wayland/custom-extension/client-common/customextension.cpp
+++ b/examples/wayland/custom-extension/client-common/customextension.cpp
@@ -109,6 +109,12 @@ void CustomExtension::registerWindow(QWindow *window)
         sendWindowRegistration(window);
 }
 
+CustomExtensionObject *CustomExtension::createCustomObject(const QString &color, const QString &text)
+{
+    auto *obj = create_local_object(color, text);
+    return new CustomExtensionObject(obj, text);
+}
+
 void CustomExtension::sendBounce(QWindow *window, uint ms)
 {
     QtWayland::qt_example_extension::bounce(getWlSurface(window), ms);
@@ -152,4 +158,24 @@ void CustomExtension::example_extension_set_window_decoration(uint32_t state)
     }
 }
 
+CustomExtensionObject::CustomExtensionObject(struct ::qt_example_local_object *wl_object, const QString &text)
+    : QWaylandClientExtensionTemplate<CustomExtensionObject>(1)
+    , QtWayland::qt_example_local_object(wl_object)
+    , m_text(text)
+{
+
+}
+
+void CustomExtensionObject::example_local_object_clicked()
+{
+    qDebug() << "Object clicked:" << m_text;
+    emit clicked();
+}
+
+void CustomExtensionObject::setText(const QString &text)
+{
+    m_text = text;
+    set_text(text);
+}
+
 QT_END_NAMESPACE
diff --git a/examples/wayland/custom-extension/client-common/customextension.h b/examples/wayland/custom-extension/client-common/customextension.h
index e76682f6281b3598200d18f1cb3bf5e6906ee1cb..003a5a008aa3b5d84c2ac3fff1e132066251f295 100644
--- a/examples/wayland/custom-extension/client-common/customextension.h
+++ b/examples/wayland/custom-extension/client-common/customextension.h
@@ -58,6 +58,8 @@
 
 QT_BEGIN_NAMESPACE
 
+class CustomExtensionObject;
+
 class CustomExtension : public QWaylandClientExtensionTemplate<CustomExtension>
         , public QtWayland::qt_example_extension
 {
@@ -66,6 +68,8 @@ public:
     CustomExtension();
     Q_INVOKABLE void registerWindow(QWindow *window);
 
+    CustomExtensionObject *createCustomObject(const QString &color, const QString &text);
+
 public slots:
     void sendBounce(QWindow *window, uint ms);
     void sendSpin(QWindow *window, uint ms);
@@ -92,6 +96,36 @@ private:
     bool m_activated;
 };
 
+class CustomExtensionObject : public QWaylandClientExtensionTemplate<CustomExtensionObject>
+        , public QtWayland::qt_example_local_object
+{
+    Q_OBJECT
+    Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+public:
+    CustomExtensionObject(struct ::qt_example_local_object *wl_object, const QString &text);
+
+    QString text() const
+    {
+        return m_text;
+    }
+
+protected:
+    void example_local_object_clicked() override;
+
+public slots:
+    void setText(const QString &text);
+
+
+signals:
+    void textChanged(const QString &text);
+    void clicked();
+
+private:
+    QString m_text;
+};
+
+
+
 QT_END_NAMESPACE
 
 #endif // CUSTOMEXTENSION_H
diff --git a/examples/wayland/custom-extension/compositor/customextension.cpp b/examples/wayland/custom-extension/compositor/customextension.cpp
index 8304e1afe9e72150239fdf82eaefb8c3982aa962..d9f637a12dd72b4f94978abd8cfea5b094c05e76 100644
--- a/examples/wayland/custom-extension/compositor/customextension.cpp
+++ b/examples/wayland/custom-extension/compositor/customextension.cpp
@@ -123,3 +123,39 @@ void CustomExtension::example_extension_register_surface(QtWaylandServer::qt_exa
     qDebug() << "server received new surface" << surface;
     emit surfaceAdded(surface);
 }
+
+
+void CustomExtension::example_extension_create_local_object(Resource *resource, uint32_t id, const QString &color, const QString &text)
+{
+    auto *obj = new CustomExtensionObject(color, text, resource->client(), id, 1);
+    qDebug() << "Object created" << text << color;
+    emit customObjectCreated(obj);
+}
+
+CustomExtensionObject::CustomExtensionObject(const QString &color, const QString &text, wl_client *client, int id, int version)
+    : QtWaylandServer::qt_example_local_object(client, id, version)
+    , m_color(color)
+    , m_text(text)
+{
+
+}
+
+void CustomExtensionObject::sendClicked()
+{
+    send_clicked();
+}
+
+void CustomExtensionObject::example_local_object_destroy_resource(QtWaylandServer::qt_example_local_object::Resource *resource)
+{
+    Q_UNUSED(resource);
+    qDebug() << "Object destroyed" << m_text << m_color;
+    emit resourceDestroyed();
+}
+
+
+void CustomExtensionObject::example_local_object_set_text(QtWaylandServer::qt_example_local_object::Resource *resource, const QString &text)
+{
+    Q_UNUSED(resource);
+    qDebug() << "Client changed text from" << m_text << "to" << text;
+    setText(text);
+}
diff --git a/examples/wayland/custom-extension/compositor/customextension.h b/examples/wayland/custom-extension/compositor/customextension.h
index b8f05b17c8e1d628c1af482b81eeebb628c33197..de7df6acbe9c80e7f861c8567a54b2ea49255a3d 100644
--- a/examples/wayland/custom-extension/compositor/customextension.h
+++ b/examples/wayland/custom-extension/compositor/customextension.h
@@ -58,6 +58,8 @@
 #include <QtWaylandCompositor/QWaylandCompositor>
 #include "qwayland-server-custom.h"
 
+class CustomExtensionObject;
+
 class CustomExtension  : public QWaylandCompositorExtensionTemplate<CustomExtension>
         , public QtWaylandServer::qt_example_extension
 {
@@ -71,6 +73,8 @@ signals:
     void bounce(QWaylandSurface *surface, uint ms);
     void spin(QWaylandSurface *surface, uint ms);
 
+    void customObjectCreated(CustomExtensionObject *obj);
+
 public slots:
     void setFontSize(QWaylandSurface *surface, uint pixelSize);
     void showDecorations(QWaylandClient *client, bool);
@@ -80,6 +84,63 @@ protected:
     void example_extension_bounce(Resource *resource, wl_resource *surface, uint32_t duration) override;
     void example_extension_spin(Resource *resource, wl_resource *surface, uint32_t duration) override;
     void example_extension_register_surface(Resource *resource, wl_resource *surface) override;
+
+    void example_extension_create_local_object(Resource *resource, uint32_t id, const QString &color, const QString &text) override;
+};
+
+
+class CustomExtensionObject : public QWaylandCompositorExtensionTemplate<CustomExtensionObject>
+        , public QtWaylandServer::qt_example_local_object
+{
+    Q_OBJECT
+    Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
+    Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+public:
+    CustomExtensionObject(const QString &color, const QString &text, struct ::wl_client *client, int id, int version);
+
+    QString color() const
+    {
+        return m_color;
+    }
+
+    QString text() const
+    {
+        return m_text;
+    }
+
+public slots:
+    void setColor(const QString &color)
+    {
+        if (m_color == color)
+            return;
+
+        m_color = color;
+        emit colorChanged(m_color);
+    }
+
+    void setText(QString text)
+    {
+        if (m_text == text)
+            return;
+
+        m_text = text;
+        emit textChanged(m_text);
+    }
+    void sendClicked();
+
+signals:
+    void colorChanged(const QString &color);
+    void resourceDestroyed();
+
+    void textChanged(QString text);
+
+protected:
+    void example_local_object_destroy_resource(Resource *resource) override;
+    void example_local_object_set_text(Resource *resource, const QString &text) override;
+
+private:
+    QString m_color;
+    QString m_text;
 };
 
 Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(CustomExtension)
diff --git a/examples/wayland/custom-extension/compositor/qml/main.qml b/examples/wayland/custom-extension/compositor/qml/main.qml
index 6739a5c9c889333cbda686f97fbef811066d6bde..a7d76227653fb3ed419b2e6bde110ed14a11d8f0 100644
--- a/examples/wayland/custom-extension/compositor/qml/main.qml
+++ b/examples/wayland/custom-extension/compositor/qml/main.qml
@@ -139,6 +139,40 @@ WaylandCompositor {
         }
     }
 
+
+    Component {
+        id: customObjectComponent
+        Rectangle {
+            id: customItem
+            property QtObject obj
+            property alias text: label.text
+
+            width: 100
+            height: 100
+            radius: width/2
+            x: Math.random() * (defaultOutput.surfaceArea.width - 100)
+            y: Math.random() * (defaultOutput.surfaceArea.height - 100)
+
+            Text {
+                id: label
+                anchors.centerIn: parent
+                text: "?"
+            }
+
+            MouseArea {
+                anchors.fill: parent
+                onClicked: obj.sendClicked()
+            }
+
+            Connections {
+                target: obj
+                onResourceDestroyed: {
+                    customItem.destroy()
+                }
+            }
+        }
+    }
+
     WlShell {
         id: defaultShell
         onWlShellSurfaceCreated: {
@@ -168,6 +202,9 @@ WaylandCompositor {
             var item = itemForSurface(surface)
             item.doSpin(ms)
         }
+        onCustomObjectCreated: {
+            var item = customObjectComponent.createObject(defaultOutput.surfaceArea, { "color": obj.color, "text": obj.text, "obj": obj } );
+        }
     }
 
     function setDecorations(shown) {
diff --git a/examples/wayland/custom-extension/cpp-client/main.cpp b/examples/wayland/custom-extension/cpp-client/main.cpp
index 54c0bcc0bb16977567736d14cbf8f68acb3aa834..da6230cc7a9f0d33f8e1dc7b58f98e336cd7649f 100644
--- a/examples/wayland/custom-extension/cpp-client/main.cpp
+++ b/examples/wayland/custom-extension/cpp-client/main.cpp
@@ -70,6 +70,7 @@ public:
         , rect1(50, 50, 100, 100)
         , rect2(50, 200, 100, 100)
         , rect3(50, 350, 100, 100)
+        , rect4(200,350, 100, 100)
     {
         m_extension->registerWindow(this);
         connect(m_extension, &CustomExtension::fontSize, this, &TestWindow::handleSetFontSize);
@@ -101,6 +102,14 @@ public slots:
         w->show();
     }
 
+    CustomExtensionObject *newObject()
+    {
+        m_objectCount++;
+        QColor col = QColor::fromHsv(0, 511/(m_objectCount+1), 255);
+
+        return m_extension->createCustomObject(col.name(), QString::number(m_objectCount));
+    }
+
     void handleSetFontSize(QWindow *w, uint pixelSize)
     {
         if (w == this) {
@@ -121,6 +130,9 @@ protected:
         p.drawText(rect2, Qt::TextWordWrap, "Press here to send bounce request.");
         p.fillRect(rect3, QColor("#7EA"));
         p.drawText(rect3, Qt::TextWordWrap, "Create new window.");
+        p.fillRect(rect4, QColor("#7EABA6"));
+        p.drawText(rect4, Qt::TextWordWrap, "Create custom object.");
+
     }
 
     void mousePressEvent(QMouseEvent *ev) override
@@ -131,6 +143,8 @@ protected:
             doBounce();
         else if (rect3.contains(ev->pos()))
             newWindow();
+        else if (rect4.contains(ev->pos()))
+            newObject();
     }
 
 private:
@@ -138,9 +152,15 @@ private:
     QRect rect1;
     QRect rect2;
     QRect rect3;
+    QRect rect4;
     QFont m_font;
+    static int m_objectCount;
+    static int m_hue;
 };
 
+int TestWindow::m_objectCount = 0;
+int TestWindow::m_hue;
+
 int main (int argc, char **argv)
 {
     QGuiApplication app(argc, argv);
diff --git a/examples/wayland/custom-extension/protocol/custom.xml b/examples/wayland/custom-extension/protocol/custom.xml
index 9bbe50d6e6c96b3d4ead64ff8876cc8886f5f5ca..2e9a84260c167d74969535ec1566e453c5f7a865 100644
--- a/examples/wayland/custom-extension/protocol/custom.xml
+++ b/examples/wayland/custom-extension/protocol/custom.xml
@@ -40,9 +40,9 @@
 
     <interface name="qt_example_extension" version="1">
 
-      <description summary="example extension for surfaces">
-        This example shows how to add extra functionality to the Wayland
-        through an extension.
+      <description summary="Example Wayland extension">
+        This example shows how to add extra functionality to Wayland
+        through an extension. This is the global object of the extension.
       </description>
 
       <request name="register_surface">
@@ -85,23 +85,52 @@
         <arg name="pixel_size" type="uint"/>
       </event>
 
+      <enum name="decoration_state">
+        <description summary="window decoration state">
+          Describes whether window decorations should be shown.
+        </description>
+        <entry name="hidden" value="0" summary="Decorations are not shown"/>
+        <entry name="shown" value="1" summary="Decorations are shown"/>
+      </enum>
+
       <event name="set_window_decoration">
         <description summary="turn window decoration on/off">
           Ask the client to turn window decoration on/off on all surfaces.
         </description>
 
-        <enum name="decoration_state">
-          <description summary="window decoration state">
-            Describes whether window decorations should be shown.
-          </description>
-          <entry name="hidden" value="0" summary="Decorations are not shown"/>
-          <entry name="shown" value="1" summary="Decorations are shown"/>
-        </enum>
-
         <arg name="state" type="uint"/>
       </event>
 
+      <request name="create_local_object">
+        <description summary="Create a sily object">
+          Create a new object that should be visualized by the compositor
+        </description>
+        <arg name="id" type="new_id" interface="qt_example_local_object"/>
+        <arg name="color" type = "string"/>
+        <arg name="text" type = "string"/>
+      </request>
     </interface>
 
+    <interface name="qt_example_local_object" version="1">
+      <description summary="An object created on the client side">
+        This object should have a visual representation in the compositor.
+      </description>
+
+      <request name="set_text">
+        <description summary="Change the text">
+          Tell the compositor that the object's text is changed
+        </description>
+        <arg name="text" type="string"/>
+      </request>
+
+      <event name="clicked">
+        <description summary="The object was clicked">
+          Notification to the client that the user clicked the representation of
+          the object in the compositor.
+        </description>
+
+      </event>
+
+    </interface>
 
 </protocol>
diff --git a/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc b/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc
index ae37c89506a756d5df402338bfd973e0b966ff96..f25eb8559896858bca6b6a8c76d22ee25ba7cee6 100644
--- a/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc
+++ b/examples/wayland/ivi-compositor/doc/src/ivi-compositor.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
 ** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc b/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc
index 24a5f652283c6b7ac20f8cd984218bda12e4bc2e..5a435f3fceafeee2f6c3362080cf5577659141d8 100644
--- a/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc
+++ b/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
 ** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/examples/wayland/minimal-qml/main.cpp b/examples/wayland/minimal-qml/main.cpp
index 435b4e3f17ae5a47b6b60e8a45cd97445899d711..60378e860a7390ae0d23d4c184f6a4d374c9e053 100644
--- a/examples/wayland/minimal-qml/main.cpp
+++ b/examples/wayland/minimal-qml/main.cpp
@@ -57,6 +57,9 @@
 
 int main(int argc, char *argv[])
 {
+    // ShareOpenGLContexts is needed for using the threaded renderer
+    // on Nvidia EGLStreams
+    QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
     QGuiApplication app(argc, argv);
 
     QQmlApplicationEngine appEngine(QUrl("qrc:///main.qml"));
diff --git a/examples/wayland/multi-output/doc/src/multi-output.qdoc b/examples/wayland/multi-output/doc/src/multi-output.qdoc
index 32b9aa696abcbd055f6fe4a37af3f121e2675f71..233b29ba3ed012dfa95b758627df22c1387f088d 100644
--- a/examples/wayland/multi-output/doc/src/multi-output.qdoc
+++ b/examples/wayland/multi-output/doc/src/multi-output.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
index 20d3912cae1017113b2bcba1c2a7c83b51321ba4..cd60213b5aa47775489a3f224356450254cfeb4d 100644
--- a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
+++ b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
 ** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/examples/wayland/pure-qml/doc/src/pure-qml.qdoc b/examples/wayland/pure-qml/doc/src/pure-qml.qdoc
index 18ca73ec5fad4b694efa363923a8d958714e2fab..06a938bedceb470134275bd7514a2b4f504843e9 100644
--- a/examples/wayland/pure-qml/doc/src/pure-qml.qdoc
+++ b/examples/wayland/pure-qml/doc/src/pure-qml.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/examples/wayland/pure-qml/main.cpp b/examples/wayland/pure-qml/main.cpp
index 304b13c4a98489c2656f2a0ecf9719049bb3ae39..38ed5c9397f6879cafe9717019e7c320d57758f8 100644
--- a/examples/wayland/pure-qml/main.cpp
+++ b/examples/wayland/pure-qml/main.cpp
@@ -57,6 +57,9 @@
 
 int main(int argc, char *argv[])
 {
+    // ShareOpenGLContexts is needed for using the threaded renderer
+    // on Nvidia EGLStreams
+    QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
     QGuiApplication app(argc, argv);
 
     QQmlApplicationEngine appEngine(QUrl("qrc:///qml/main.qml"));
diff --git a/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc b/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc
index d268aca4376c0bb46327936f1880f87b41ef8d7e..c4f408c5a16ea7b67168a24d653765f80ea63082 100644
--- a/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc
+++ b/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc b/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc
index cbb720faeff8ea58a9fc863c27c8429e4da89c14..3ab0b91f522abdc82c11bf005ad02273bbd3f3e2 100644
--- a/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc
+++ b/examples/wayland/spanning-screens/doc/src/spanning-screens.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
 ** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/client/qwaylandbuffer.cpp b/src/client/qwaylandbuffer.cpp
index a0fcc532f5b0bf543912e88ced96eb8e82951927..076a0d57d7424f13b37c2a80edd12fa56096cbea 100644
--- a/src/client/qwaylandbuffer.cpp
+++ b/src/client/qwaylandbuffer.cpp
@@ -66,7 +66,7 @@ void QWaylandBuffer::init(wl_buffer *buf)
 
 void QWaylandBuffer::release(void *data, wl_buffer *)
 {
-    static_cast<QWaylandBuffer *>(data)->mBusy = false;
+    static_cast<QWaylandBuffer *>(data)->mBusy--;
 }
 
 const wl_buffer_listener QWaylandBuffer::listener = {
diff --git a/src/client/qwaylandbuffer_p.h b/src/client/qwaylandbuffer_p.h
index 9e8cba2e49073bf1f5a5cca68873ad66b12a3ecb..b3513d1515ef0432d98996d0fd8c7eb7e385eb16 100644
--- a/src/client/qwaylandbuffer_p.h
+++ b/src/client/qwaylandbuffer_p.h
@@ -73,14 +73,14 @@ public:
     virtual QSize size() const = 0;
     virtual int scale() const { return 1; }
 
-    void setBusy() { mBusy = true; }
-    bool busy() const { return mBusy; }
+    void setBusy() { mBusy++; }
+    bool busy() const { return mBusy > 0; }
 
 protected:
     struct wl_buffer *mBuffer;
 
 private:
-    bool mBusy;
+    int mBusy;
 
     static void release(void *data, wl_buffer *);
     static const wl_buffer_listener listener;
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index cac92a7e114e0f8a64e4cab35759629a580b2b13..cff380e8fa20a4c7f81a91217c85e7ab6fc67046 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -261,6 +261,8 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
         wl_callback_destroy(mFrameCallback);
         mFrameCallback = nullptr;
     }
+
+    mMask = QRegion();
 }
 
 QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface)
@@ -790,22 +792,27 @@ QWaylandAbstractDecoration *QWaylandWindow::decoration() const
     return mWindowDecoration;
 }
 
-static QWindow *topLevelWindow(QWindow *window)
+static QWaylandWindow *closestShellSurfaceWindow(QWindow *window)
 {
-    while (QWindow *parent = window->parent())
-        window = parent;
-    return window;
+    while (window) {
+        auto w = static_cast<QWaylandWindow *>(window->handle());
+        if (w->shellSurface())
+            return w;
+        window = window->transientParent() ? window->transientParent() : window->parent();
+    }
+    return nullptr;
 }
 
 QWaylandWindow *QWaylandWindow::transientParent() const
 {
-    // Take the top level window here, since the transient parent may be a QWidgetWindow
-    // or some other window without a shell surface, which is then not able to get mouse
-    // events.
-    if (auto transientParent = window()->transientParent())
-        return static_cast<QWaylandWindow *>(topLevelWindow(transientParent)->handle());
-    else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
-        return static_cast<QWaylandWindow *>(topLevelWindow(QGuiApplication::focusWindow())->handle());
+    // Take the closest window with a shell surface, since the transient parent may be a
+    // QWidgetWindow or some other window without a shell surface, which is then not able to
+    // get mouse events.
+    if (auto transientParent = closestShellSurfaceWindow(window()->transientParent()))
+        return transientParent;
+
+    if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
+        return closestShellSurfaceWindow(QGuiApplication::focusWindow());
 
     return nullptr;
 }
diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp
index 77434e98b6cde66d2e70f3f49387e95b5736e98e..92223f45ee6650e044db0c90f831c35a4be6e474 100644
--- a/src/client/qwaylandwlshellsurface.cpp
+++ b/src/client/qwaylandwlshellsurface.cpp
@@ -185,6 +185,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent)
             || testShowWithoutActivating(m_window->window()))
         flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
 
+    Q_ASSERT(parent_wayland_window->object());
     set_transient(parent_wayland_window->object(),
                   transientPos.x(),
                   transientPos.y(),
@@ -211,15 +212,16 @@ void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevic
         transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
     }
 
+    Q_ASSERT(parent_wayland_window->object());
     set_popup(device->wl_seat(), serial, parent_wayland_window->object(),
               transientPos.x(), transientPos.y(), 0);
 }
 
 void QWaylandWlShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent)
 {
-    if (type == Qt::Popup && transientParent)
+    if (type == Qt::Popup && transientParent && transientParent->object())
         setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial());
-    else if (transientParent)
+    else if (transientParent && transientParent->object())
         updateTransientParent(transientParent->window());
     else
         setTopLevel();
diff --git a/src/compositor/compositor_api/qwaylandclient.cpp b/src/compositor/compositor_api/qwaylandclient.cpp
index 48675c495f7181edd7860b735704c0a3f5c184ae..f6b5564b8454c1b56efed9288ec9b39489febbc6 100644
--- a/src/compositor/compositor_api/qwaylandclient.cpp
+++ b/src/compositor/compositor_api/qwaylandclient.cpp
@@ -167,7 +167,7 @@ QWaylandClient *QWaylandClient::fromWlClient(QWaylandCompositor *compositor, wl_
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandClient::compositor
+ * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandClient::compositor
  *
  * This property holds the compositor of this WaylandClient.
  */
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 522ef04136e51de4040d5dcf6f1717c2b42d4cb9..00f3d83f032ec1b9e03ee9e40a41297da3ef1e84 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -660,7 +660,7 @@ QWaylandOutput *QWaylandCompositor::outputFor(QWindow *window) const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandCompositor::defaultOutput
+ * \qmlproperty WaylandOutput QtWaylandCompositor::WaylandCompositor::defaultOutput
  *
  * This property contains the first in the list of outputs added to the
  * WaylandCompositor, or null if no outputs have been added.
@@ -805,7 +805,7 @@ void QWaylandCompositor::overrideSelection(const QMimeData *data)
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandCompositor::defaultSeat
+ * \qmlproperty WaylandSeat QtWaylandCompositor::WaylandCompositor::defaultSeat
  *
  * This property contains the default seat for this
  * WaylandCompositor.
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp
index cbd7fe7761738f5b2e2fa053c988d950a5c47a26..522de08e88b7536f295826c76704b5d4634cbe90 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -336,7 +336,7 @@ void QWaylandOutput::update()
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandOutput::compositor
+ * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandOutput::compositor
  *
  * This property holds the compositor displaying content on this WaylandOutput.
  *
@@ -990,6 +990,7 @@ void QWaylandOutput::handleWindowDestroyed()
 {
     Q_D(QWaylandOutput);
     d->window = Q_NULLPTR;
+    emit windowChanged();
     emit windowDestroyed();
 }
 
diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp
index d1ca174dbdf29c17f36a5ade54e5cee4c82cc465..bf4bf547db32246560a888c574828f523a20a1e2 100644
--- a/src/compositor/compositor_api/qwaylandpointer.cpp
+++ b/src/compositor/compositor_api/qwaylandpointer.cpp
@@ -51,31 +51,77 @@ QWaylandPointerPrivate::QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylan
     , wl_pointer()
     , seat(seat)
     , output()
-    , hasSentEnter(false)
     , enterSerial(0)
     , buttonCount()
 {
     Q_UNUSED(pointer);
 }
 
-const QList<QtWaylandServer::wl_pointer::Resource *> QWaylandPointerPrivate::pointerResourcesForFocusedSurface() const
-{
-    if (!seat->mouseFocus())
-        return {};
-
-    return resourceMap().values(seat->mouseFocus()->surfaceResource()->client);
-}
-
 uint QWaylandPointerPrivate::sendButton(Qt::MouseButton button, uint32_t state)
 {
     Q_Q(QWaylandPointer);
+    if (!q->mouseFocus() || !q->mouseFocus()->surface())
+        return 0;
+
+    wl_client *client = q->mouseFocus()->surface()->waylandClient();
     uint32_t time = compositor()->currentTimeMsecs();
     uint32_t serial = compositor()->nextSerial();
-    for (auto resource : pointerResourcesForFocusedSurface())
+    for (auto resource : resourceMap().values(client))
         send_button(resource->handle, serial, time, q->toWaylandButton(button), state);
     return serial;
 }
 
+void QWaylandPointerPrivate::sendMotion()
+{
+    Q_ASSERT(enteredSurface);
+    uint32_t time = compositor()->currentTimeMsecs();
+    wl_fixed_t x = wl_fixed_from_double(localPosition.x());
+    wl_fixed_t y = wl_fixed_from_double(localPosition.y());
+    for (auto resource : resourceMap().values(enteredSurface->waylandClient()))
+        wl_pointer_send_motion(resource->handle, time, x, y);
+}
+
+void QWaylandPointerPrivate::sendEnter(QWaylandSurface *surface)
+{
+    Q_ASSERT(surface && !enteredSurface);
+    enterSerial = compositor()->nextSerial();
+
+    QWaylandKeyboard *keyboard = seat->keyboard();
+    if (keyboard)
+        keyboard->sendKeyModifiers(surface->client(), enterSerial);
+
+    wl_fixed_t x = wl_fixed_from_double(localPosition.x());
+    wl_fixed_t y = wl_fixed_from_double(localPosition.y());
+    for (auto resource : resourceMap().values(surface->waylandClient()))
+        send_enter(resource->handle, enterSerial, surface->resource(), x, y);
+
+    enteredSurface = surface;
+    enteredSurfaceDestroyListener.listenForDestruction(surface->resource());
+}
+
+void QWaylandPointerPrivate::sendLeave()
+{
+    Q_ASSERT(enteredSurface);
+    uint32_t serial = compositor()->nextSerial();
+    for (auto resource : resourceMap().values(enteredSurface->waylandClient()))
+        send_leave(resource->handle, serial, enteredSurface->resource());
+    enteredSurface = nullptr;
+    localPosition = QPointF();
+    enteredSurfaceDestroyListener.reset();
+}
+
+void QWaylandPointerPrivate::ensureEntered(QWaylandSurface *surface)
+{
+    if (enteredSurface == surface)
+        return;
+
+    if (enteredSurface)
+        sendLeave();
+
+    if (surface)
+        sendEnter(surface);
+}
+
 void QWaylandPointerPrivate::pointer_release(wl_pointer::Resource *resource)
 {
     wl_resource_destroy(resource->handle);
@@ -122,7 +168,7 @@ void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource,
 QWaylandPointer::QWaylandPointer(QWaylandSeat *seat, QObject *parent)
     : QWaylandObject(* new QWaylandPointerPrivate(this, seat), parent)
 {
-    connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandPointer::focusDestroyed);
+    connect(&d_func()->enteredSurfaceDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandPointer::enteredSurfaceDestroyed);
     connect(seat, &QWaylandSeat::mouseFocusChanged, this, &QWaylandPointer::pointerFocusChanged);
 }
 
@@ -173,16 +219,11 @@ uint QWaylandPointer::sendMousePressEvent(Qt::MouseButton button)
 {
     Q_D(QWaylandPointer);
     d->buttonCount++;
-    uint serial = 0;
-
-    if (d->seat->mouseFocus())
-         serial = d->sendButton(button, WL_POINTER_BUTTON_STATE_PRESSED);
 
-    if (d->buttonCount == 1) {
+    if (d->buttonCount == 1)
         emit buttonPressedChanged();
-    }
 
-    return serial;
+    return d->sendButton(button, WL_POINTER_BUTTON_STATE_PRESSED);
 }
 
 /*!
@@ -194,15 +235,11 @@ uint QWaylandPointer::sendMouseReleaseEvent(Qt::MouseButton button)
 {
     Q_D(QWaylandPointer);
     d->buttonCount--;
-    uint serial = 0;
-
-    if (d->seat->mouseFocus())
-         serial = d->sendButton(button, WL_POINTER_BUTTON_STATE_RELEASED);
 
     if (d->buttonCount == 0)
         emit buttonPressedChanged();
 
-    return serial;
+    return d->sendButton(button, WL_POINTER_BUTTON_STATE_RELEASED);
 }
 
 /*!
@@ -218,41 +255,20 @@ void QWaylandPointer::sendMouseMoveEvent(QWaylandView *view, const QPointF &loca
     d->localPosition = localPos;
     d->spacePosition = outputSpacePos;
 
-    //we adjust if the mouse position is on the edge
-    //to work around Qt's event propagation
-    if (view && view->surface()) {
+    if (view) {
+        // We adjust if the mouse position is on the edge
+        // to work around Qt's event propagation
         QSizeF size(view->surface()->size());
-        if (d->localPosition.x() ==  size.width())
+        if (d->localPosition.x() == size.width())
             d->localPosition.rx() -= 0.01;
-
         if (d->localPosition.y() == size.height())
             d->localPosition.ry() -= 0.01;
-    }
-
-    if (!d->hasSentEnter) {
-        d->enterSerial = d->compositor()->nextSerial();
-        QWaylandKeyboard *keyboard = d->seat->keyboard();
-        if (keyboard)
-            keyboard->sendKeyModifiers(view->surface()->client(), d->enterSerial);
-        for (auto resource : d->pointerResourcesForFocusedSurface()) {
-            d->send_enter(resource->handle, d->enterSerial, view->surface()->resource(),
-                          wl_fixed_from_double(d->localPosition.x()),
-                          wl_fixed_from_double(d->localPosition.y()));
-        }
-        d->focusDestroyListener.listenForDestruction(view->surface()->resource());
-        d->hasSentEnter = true;
-    }
 
-    if (view && view->output())
-        setOutput(view->output());
-
-    uint32_t time = d->compositor()->currentTimeMsecs();
+        d->ensureEntered(view->surface());
+        d->sendMotion();
 
-    if (d->seat->mouseFocus()) {
-        wl_fixed_t x = wl_fixed_from_double(currentLocalPosition().x());
-        wl_fixed_t y = wl_fixed_from_double(currentLocalPosition().y());
-        for (auto resource : d->pointerResourcesForFocusedSurface())
-            wl_pointer_send_motion(resource->handle, time, x, y);
+        if (view->output())
+            setOutput(view->output());
     }
 }
 
@@ -262,14 +278,14 @@ void QWaylandPointer::sendMouseMoveEvent(QWaylandView *view, const QPointF &loca
 void QWaylandPointer::sendMouseWheelEvent(Qt::Orientation orientation, int delta)
 {
     Q_D(QWaylandPointer);
-    if (!d->seat->mouseFocus())
+    if (!d->enteredSurface)
         return;
 
     uint32_t time = d->compositor()->currentTimeMsecs();
     uint32_t axis = orientation == Qt::Horizontal ? WL_POINTER_AXIS_HORIZONTAL_SCROLL
                                                   : WL_POINTER_AXIS_VERTICAL_SCROLL;
 
-    for (auto resource : d->pointerResourcesForFocusedSurface())
+    for (auto resource : d->resourceMap().values(d->enteredSurface->waylandClient()))
         d->send_axis(resource->handle, time, axis, wl_fixed_from_int(-delta / 12));
 }
 
@@ -316,9 +332,8 @@ void QWaylandPointer::addClient(QWaylandClient *client, uint32_t id, uint32_t ve
 {
     Q_D(QWaylandPointer);
     wl_resource *resource = d->add(client->client(), id, qMin<uint32_t>(QtWaylandServer::wl_pointer::interfaceVersion(), version))->handle;
-    QWaylandView *focus = d->seat->mouseFocus();
-    if (focus && client == focus->surface()->client()) {
-        d->send_enter(resource, d->enterSerial, focus->surfaceResource(),
+    if (d->enteredSurface && client == d->enteredSurface->client()) {
+        d->send_enter(resource, d->enterSerial, d->enteredSurface->resource(),
                       wl_fixed_from_double(d->localPosition.x()),
                       wl_fixed_from_double(d->localPosition.y()));
     }
@@ -389,14 +404,19 @@ uint32_t QWaylandPointer::toWaylandButton(Qt::MouseButton button)
 /*!
  * \internal
  */
-void QWaylandPointer::focusDestroyed(void *data)
+void QWaylandPointer::enteredSurfaceDestroyed(void *data)
 {
     Q_D(QWaylandPointer);
     Q_UNUSED(data)
-    d->focusDestroyListener.reset();
+    d->enteredSurfaceDestroyListener.reset();
+    d->enteredSurface = nullptr;
+
+    d->seat->setMouseFocus(nullptr);
 
-    d->seat->setMouseFocus(Q_NULLPTR);
-    d->buttonCount = 0;
+    if (d->buttonCount != 0) {
+        d->buttonCount = 0;
+        emit buttonPressedChanged();
+    }
 }
 
 /*!
@@ -404,16 +424,11 @@ void QWaylandPointer::focusDestroyed(void *data)
  */
 void QWaylandPointer::pointerFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus)
 {
-    Q_UNUSED(newFocus);
     Q_D(QWaylandPointer);
-    d->localPosition = QPointF();
-    d->hasSentEnter = false;
-    if (oldFocus) {
-        uint32_t serial = d->compositor()->nextSerial();
-        for (auto resource : d->resourceMap().values(oldFocus->surfaceResource()->client))
-            d->send_leave(resource->handle, serial, oldFocus->surfaceResource());
-        d->focusDestroyListener.reset();
-    }
+    Q_UNUSED(oldFocus);
+    bool wasSameSurface = newFocus && newFocus->surface() == d->enteredSurface;
+    if (d->enteredSurface && !wasSameSurface)
+        d->sendLeave();
 }
 
 QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandpointer.h b/src/compositor/compositor_api/qwaylandpointer.h
index bcba1d6a383883072ec3d6fc0407582ed7b347f8..409bcc83a679c167070bbd6751d69da78f56f7a9 100644
--- a/src/compositor/compositor_api/qwaylandpointer.h
+++ b/src/compositor/compositor_api/qwaylandpointer.h
@@ -89,7 +89,7 @@ Q_SIGNALS:
     void buttonPressedChanged();
 
 private:
-    void focusDestroyed(void *data);
+    void enteredSurfaceDestroyed(void *data);
     void pointerFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
 };
 
diff --git a/src/compositor/compositor_api/qwaylandpointer_p.h b/src/compositor/compositor_api/qwaylandpointer_p.h
index 0a9ef232941a7216b4f7118e925dc37deea628d0..11076f34b8c44198b2e6912e7c044e19e78f457b 100644
--- a/src/compositor/compositor_api/qwaylandpointer_p.h
+++ b/src/compositor/compositor_api/qwaylandpointer_p.h
@@ -86,11 +86,15 @@ protected:
     void pointer_release(Resource *resource) override;
 
 private:
-    const QList<Resource *> pointerResourcesForFocusedSurface() const;
     uint sendButton(Qt::MouseButton button, uint32_t state);
+    void sendMotion();
+    void sendEnter(QWaylandSurface *surface);
+    void sendLeave();
+    void ensureEntered(QWaylandSurface *surface);
 
     QWaylandSeat *seat;
     QWaylandOutput *output;
+    QPointer<QWaylandSurface> enteredSurface;
 
     QPointF localPosition;
     QPointF spacePosition;
@@ -100,7 +104,7 @@ private:
 
     int buttonCount;
 
-    QWaylandDestroyListener focusDestroyListener;
+    QWaylandDestroyListener enteredSurfaceDestroyListener;
 
     static QWaylandSurfaceRole s_role;
 };
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
index dccb8a15141151dc461c27257573d3d2c6bb415f..35cd492281a253dbc75598c3b5b2e7606387128b 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -90,9 +90,9 @@ QWaylandQuickCompositor::QWaylandQuickCompositor(QObject *parent)
  * import QtWayland.Compositor 1.0
  *
  * WaylandCompositor {
- *     extensions: [ WlShell {
+ *     WlShell {
  *         // ...
- *     } ]
+ *     }
  * }
  * \endcode
  */
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index bfd2527535169e310b548edda7006311c70af716..a993467ac996a407cca87edb5a362e6e0623f2b5 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -371,7 +371,7 @@ QWaylandQuickItem::~QWaylandQuickItem()
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandQuickItem::compositor
+ * \qmlproperty WaylandCompositor QtWaylandCompositor::WaylandQuickItem::compositor
  *
  * This property holds the compositor for the surface rendered by this WaylandQuickItem.
  */
@@ -388,7 +388,7 @@ QWaylandCompositor *QWaylandQuickItem::compositor() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandQuickItem::view
+ * \qmlproperty WaylandView QtWaylandCompositor::WaylandQuickItem::view
  *
  * This property holds the view rendered by this WaylandQuickItem.
  */
@@ -405,7 +405,7 @@ QWaylandView *QWaylandQuickItem::view() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandQuickItem::surface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::WaylandQuickItem::surface
  *
  * This property holds the surface rendered by this WaylandQuickItem.
  */
diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp
index 80b75d61737072bf366ad7280e5334dbe9859b3a..b4b45392c6440d223e1630a90365f272eb9979da 100644
--- a/src/compositor/compositor_api/qwaylandseat.cpp
+++ b/src/compositor/compositor_api/qwaylandseat.cpp
@@ -456,6 +456,12 @@ void QWaylandSeat::setMouseFocus(QWaylandView *view)
 
     QWaylandView *oldFocus = d->mouseFocus;
     d->mouseFocus = view;
+
+    if (oldFocus)
+        disconnect(oldFocus, &QObject::destroyed, this, &QWaylandSeat::handleMouseFocusDestroyed);
+    if (d->mouseFocus)
+        connect(d->mouseFocus, &QObject::destroyed, this, &QWaylandSeat::handleMouseFocusDestroyed);
+
     emit mouseFocusChanged(d->mouseFocus, oldFocus);
 }
 
@@ -512,4 +518,15 @@ QWaylandSeat *QWaylandSeat::fromSeatResource(struct ::wl_resource *resource)
  * This signal is emitted when the mouse focus has changed from \a oldFocus to \a newFocus.
  */
 
+void QWaylandSeat::handleMouseFocusDestroyed()
+{
+    // This is triggered when the QWaylandView is destroyed, NOT the surface.
+    // ... so this is for the rare case when the view that currently holds the mouse focus is
+    // destroyed before its surface
+    Q_D(QWaylandSeat);
+    d->mouseFocus = nullptr;
+    QWaylandView *oldFocus = nullptr; // we have to send nullptr because the old focus is already destroyed at this point
+    emit mouseFocusChanged(d->mouseFocus, oldFocus);
+}
+
 QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandseat.h b/src/compositor/compositor_api/qwaylandseat.h
index 86cf250a6ab75a0bbed0330a9ba9000d992acb3c..e5ef46dc6d37a178f7e0954962b47e7ba3c939f9 100644
--- a/src/compositor/compositor_api/qwaylandseat.h
+++ b/src/compositor/compositor_api/qwaylandseat.h
@@ -133,6 +133,9 @@ Q_SIGNALS:
     void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus);
     void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus);
     void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY);
+
+private:
+    void handleMouseFocusDestroyed();
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandSeat::CapabilityFlags)
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 6f277dd96aeadcde966d485b6206ea5a185f8161..945d68827a0f73bbf326a7dc3c8f60253d236a38 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -445,7 +445,7 @@ bool QWaylandSurface::isInitialized() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandSurface::client
+ * \qmlproperty WaylandClient QtWaylandCompositor::WaylandSurface::client
  *
  * This property holds the client using this WaylandSurface.
  */
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index f56cb0b8e0d6e3e956eb902ca33869d0b15b1267..9e8297574d48d3ba4ec606565015f88ef51788e1 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -99,9 +99,6 @@ QWaylandView::~QWaylandView()
     if (d->surface) {
         if (d->output)
             QWaylandOutputPrivate::get(d->output)->removeView(this, d->surface);
-        QWaylandSeat *i = d->surface->compositor()->defaultSeat();
-        if (i->mouseFocus() == this)
-            i->setMouseFocus(Q_NULLPTR);
 
         QWaylandSurfacePrivate::get(d->surface)->derefView(this);
     }
@@ -117,8 +114,9 @@ QObject *QWaylandView::renderObject() const
     Q_D(const QWaylandView);
     return d->renderObject;
 }
+
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandView::surface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::WaylandView::surface
  *
  * This property holds the surface viewed by this WaylandView.
  */
@@ -169,7 +167,7 @@ void QWaylandView::setSurface(QWaylandSurface *newSurface)
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WaylandView::output
+ * \qmlproperty WaylandOutput QtWaylandCompositor::WaylandView::output
  *
  * This property holds the output on which this view displays its surface.
  */
diff --git a/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc b/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
index 4b38c8613fbe6ae51f133973817666f860822978..c406b81e1ee58053d9179910b95d6cb1fe75565c 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-cpp.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc b/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc
index 2b85112817f230524ea932170138bab4b7fd9b98..560844242cbab4247ea9a68485ef7de708e05338 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-examples.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc b/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc
index d2fb6a27de0167bdb32ecb644be8f53b53b97378..6be6444ccaa41d822990321cf5720b48f2a5e95a 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-overview.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
index 1f1f58286f10e2a6d751ba14e825ab9708198880..1dadb71025aecd7e9c151ef90b88c43fcaa81df2 100644
--- a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
+++ b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc
@@ -1,7 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the documentation of the Qt Toolkit.
 **
@@ -11,8 +11,8 @@
 ** accordance with the commercial license agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
 **
 ** GNU Free Documentation License Usage
 ** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
 ** Foundation and appearing in the file included in the packaging of
 ** this file. Please review the following information to ensure
 ** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp
index 0bb2a6158380e9335fdc80bfa9a4d033b8c080b5..08b95b3b5f495b3f22a229cd82428f17f8dd8324 100644
--- a/src/compositor/extensions/qwaylandivisurface.cpp
+++ b/src/compositor/extensions/qwaylandivisurface.cpp
@@ -121,7 +121,7 @@ void QWaylandIviSurface::initialize(QWaylandIviApplication *iviApplication, QWay
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::IviSurface::surface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::IviSurface::surface
  *
  * This property holds the surface associated with this IviSurface.
  */
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
index e52bb4852f7c65d7d1bdaf8853a190a2cce9e538..2b603099b85b015d24978fef5a03590627b0841f 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -93,7 +93,7 @@ QWaylandQuickShellSurfaceItem::QWaylandQuickShellSurfaceItem(QWaylandQuickShellS
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::ShellSurfaceItem::shellSurface
+ * \qmlproperty ShellSurface QtWaylandCompositor::ShellSurfaceItem::shellSurface
  *
  * This property holds the ShellSurface rendered by this ShellSurfaceItem.
  * It may either be an XdgSurfaceV5, WlShellSurface or IviSurface depending on which shell protocol
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index 038e41b1f8ce6950b0c5ba37ecebda08ac188b1d..96dbd3dc1cb9a63117b6fd40cb7caf28d9fe8f89 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -277,7 +277,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource,
  * import QtWayland.Compositor 1.0
  *
  * WaylandCompositor {
- *     extensions: WlShell {
+ *     WlShell {
  *         // ...
  *     }
  * }
@@ -384,18 +384,37 @@ const struct wl_interface *QWaylandWlShell::interface()
 }
 
 /*!
- * \qmlsignal void QtWaylandCompositor::WlShell::wlShellSurfaceRequested(object surface, object client, int id)
+ * \qmlsignal void QtWaylandCompositor::WlShell::wlShellSurfaceRequested(WaylandSurface surface, WaylandResource resource)
  *
- * This signal is emitted when the \a client has requested a \c wl_shell_surface to be associated
- * with \a surface, which is identified by \a id. The handler for this signal is
- * expected to create the shell surface and initialize it within the scope of the
- * signal emission.
+ * This signal is emitted when the client has requested a \c wl_shell_surface to be associated with
+ * \a surface. The handler for this signal may create a shell surface for \a resource and initialize
+ * it within the scope of the signal emission. Otherwise a WlShellSurface will be created
+ * automatically.
  */
 
 /*!
  * \fn void QWaylandWlShell::wlShellSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource)
  *
- * Constructs a QWaylandSurface, assigns it to \a surface and initializes it with the given \a resource.
+ * This signal is emitted when the client has requested a \c wl_shell_surface to be associated with
+ * \a surface. The handler for this signal may create a shell surface for \a resource and initialize
+ * it within the scope of the signal emission. Otherwise a QWaylandWlShellSurface will be created
+ * automatically.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::WlShell::wlShellSurfaceCreated(WlShellSurface shellSurface)
+ *
+ * This signal is emitted when the client has created a \c wl_shell_surface.
+ * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
+ * WaylandQuickItem for displaying \a shellSurface in a QtQuick scene.
+ */
+
+/*!
+ * \fn void QWaylandWlShell::wlShellSurfaceCreated(QWaylandWlShellSurface *shellSurface)
+ *
+ * This signal is emitted when the client has created a \c wl_shell_surface.
+ * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
+ * QWaylandQuickItem for displaying \a shellSurface in a QtQuick scene.
  */
 
 /*!
@@ -575,7 +594,7 @@ QWaylandQuickShellIntegration *QWaylandWlShellSurface::createIntegration(QWaylan
 #endif
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WlShellSurface::surface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::WlShellSurface::surface
  *
  * This property holds the \c wl_surface associated with this WlShellSurface.
  */
@@ -592,7 +611,7 @@ QWaylandSurface *QWaylandWlShellSurface::surface() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::WlShellSurface::shell
+ * \qmlproperty WlShell QtWaylandCompositor::WlShellSurface::shell
  *
  * This property holds the shell associated with this WlShellSurface.
  */
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp
index 8f11642603a57bb0c1a8acd544c4cf0a11d0adc9..c0cb4f8e44af08ec4b414bd63097cd799dec91bb 100644
--- a/src/compositor/extensions/qwaylandxdgshellv5.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp
@@ -646,6 +646,98 @@ void QWaylandXdgShellV5::closeAllPopups()
     }
 }
 
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgSurfaceRequested(WaylandSurface surface, WaylandResource resource)
+ *
+ * This signal is emitted when the client has requested an \c xdg_surface to be associated
+ * with \a surface. The handler for this signal may create the shell surface for \a resource
+ * and initialize it within the scope of the signal emission. Otherwise an XdgSurfaceV5 will
+ * be created automatically.
+ */
+
+/*!
+ * \fn void QWaylandXdgShellV5::xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource)
+ *
+ * This signal is emitted when the client has requested an \c xdg_surface to be associated
+ * with \a surface. The handler for this signal may create the shell surface for \a resource
+ * and initialize it within the scope of the signal emission. Otherwise a QWaylandXdgSurfaceV5
+ * will be created automatically.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgSurfaceCreated(XdgSurfaceV5 xdgSurface)
+ *
+ * This signal is emitted when the client has created an \c xdg_surface.
+ * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
+ * WaylandQuickItem for displaying \a xdgSurface in a QtQuick scene.
+ */
+
+/*!
+ * \fn void QWaylandXdgShellV5::xdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface)
+ *
+ * This signal is emitted when the client has created an \c xdg_surface.
+ * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
+ * QWaylandQuickItem for displaying \a xdgSurface in a QtQuick scene.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgPopupRequested(WaylandSurface surface, WaylandSurface parent, WaylandSeat seat, point position, WaylandResource resource)
+ *
+ * This signal is emitted when the client has requested an \c xdg_popup to be associated
+ * with \a surface. The handler for this signal may create the xdg popup for \a resource and
+ * initialize it within the scope of the signal emission. Otherwise an XdgPopupV5 will be
+ * created automatically.
+ *
+ * The \a seat is the \c wl_seat that caused the popup to be opened.
+ *
+ * \a position is the desired position of the popup, relative to the \a parent.
+ */
+
+/*!
+ * \fn void QWaylandXdgShellV5::xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource)
+ *
+ * This signal is emitted when the client has requested an \c xdg_surface to be associated
+ * with \a surface. The handler for this signal may create the xdg poup for \a resource and
+ * initialize it within the scope of the signal emission. Otherwise a QWaylandXdgPopupV5 will be
+ * created automatically.
+ *
+ * The \a seat is the \c wl_seat that caused the popup to be opened.
+ *
+ * \a position is the desired position of the popup, relative to the \a parent.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgPopupCreated(XdgPopupV5 xdgPopup)
+ *
+ * This signal is emitted when the client has created an \c xdg_popup.
+ * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or
+ * WaylandQuickItem for displaying \a xdgPopup in a QtQuick scene.
+ */
+
+/*!
+ * \fn void QWaylandXdgShellV5::xdgPopupCreated(QWaylandXdgPopupV5 *xdgPopup)
+ *
+ * This signal is emitted when the client has created an \c xdg_popup.
+ * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or
+ * QWaylandQuickItem for displaying \a xdgPopup in a QtQuick scene.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgShellV5::pong(int serial)
+ *
+ * This signal is emitted when the client has responded to a ping event with serial \a serial.
+ *
+ * \sa QtWaylandCompositor::XdgShellV5::ping()
+ */
+
+/*!
+ * \fn void QWaylandXdgShellV5::pong(uint serial)
+ *
+ * This signal is emitted when the client has responded to a ping event with serial \a serial.
+ *
+ * \sa QWaylandXdgShellV5::ping()
+ */
+
 void QWaylandXdgShellV5::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat)
 {
     if (oldSeat != nullptr) {
@@ -759,6 +851,134 @@ void QWaylandXdgSurfaceV5::initialize(QWaylandXdgShellV5 *xdgShell, QWaylandSurf
     QWaylandCompositorExtension::initialize();
 }
 
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::showWindowMenu(WaylandSeat seat, point localSurfacePosition)
+ *
+ * This signal is emitted when the client wants to show a context menu at \a localSurfacePosition,
+ * using the Wayland seat \a seat. It's typically emitted in response to the user right-clicking
+ * the window decorations.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition)
+ *
+ * This signal is emitted when the client wants to show a context menu at \a localSurfacePosition,
+ * using the Wayland seat \a seat. It's typically emitted in response to the user right-clicking
+ * the window decorations.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::startMove(WaylandSeat seat)
+ *
+ * This signal is emitted when the client wants to start an interactive move of the XdgSurfaceV5,
+ * typically in response to the window decorations being dragged by \a seat.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::startMove(QWaylandSeat *seat)
+ *
+ * This signal is emitted when the client wants to start an interactive move of the
+ * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by \a seat.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::startResize(WaylandSeat seat, enumeration edges)
+ *
+ * This signal is emitted when the client wants to start an interactive resize of the XdgSurfaceV5,
+ * typically in response to the window decorations being dragged by \a seat on the window borders
+ * given by \a edges.
+ *
+ * \sa QWaylandXdgSurfaceV5::ResizeEdges
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::startResize(QWaylandSeat *seat, ResizeEdges edges)
+ *
+ * This signal is emitted when the client wants to start an interactive resize of the
+ * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by
+ * \a seat on the window borders given by \a edges.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setMaximized()
+ *
+ * This signal is emitted when the client wants the \c xdg_surface to be maximized.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::setMaximized()
+ *
+ * This signal is emitted when the client wants the \c xdg_surface to be maximized.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::unsetMaximized()
+ *
+ * This signal is emitted when the client doesn't want the \c xdg_surface to be maximized anymore.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::unsetMaximized()
+ *
+ * This signal is emitted when the client doesn't want the \c xdg_surface to be maximized anymore.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setFullscreen(WaylandOutput output)
+ *
+ * This signal is emitted when the client wants the \c xdg_surface to be in full screen mode.
+ * The client may specify an \a output it wishes the \c xdg_surface to be shown on.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::setFullscreen(QWaylandOutput *output)
+ *
+ * This signal is emitted when the client wants the \c xdg_surface to be in full screen mode.
+ * The client may specify an \a output it wishes the \c xdg_surface to be shown on.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::unsetFullscreen()
+ *
+ * This signal is emitted when the client doesn't want the \c xdg_surface to be in full screen mode
+ * anymore.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::unsetFullscreen()
+ *
+ * This signal is emitted when the client doesn't want the \c xdg_surface to be in full screen mode
+ * anymore.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setMinimized()
+ *
+ * This signal is emitted when the client wants the \c xdg_surface to be minimized.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::setMinimized()
+ *
+ * This signal is emitted when the client wants the \c xdg_surface to be minimized.
+ */
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::ackConfigure(int serial)
+ *
+ * This signal is emitted when the client has received configure events up to and including the
+ * configure event with serial \a serial and will draw its surface accordingly in the next committed
+ * buffer.
+ */
+
+/*!
+ * \fn void QWaylandXdgSurfaceV5::ackConfigure(uint serial)
+ *
+ * This signal is emitted when the client has received configure events up to and including the
+ * configure event with serial \a serial and will draw its surface accordingly in the next committed
+ * buffer.
+ */
+
 /*!
  * \internal
  */
@@ -789,7 +1009,7 @@ void QWaylandXdgSurfaceV5::handleBufferScaleChanged()
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgSurfaceV5::shell
+ * \qmlproperty XdgShellV5 QtWaylandCompositor::XdgSurfaceV5::shell
  *
  * This property holds the shell associated with this XdgSurfaceV5.
  */
@@ -806,7 +1026,7 @@ QWaylandXdgShellV5 *QWaylandXdgSurfaceV5::shell() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgSurfaceV5::surface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::XdgSurfaceV5::surface
  *
  * This property holds the surface associated with this XdgSurfaceV5.
  */
@@ -823,7 +1043,7 @@ QWaylandSurface *QWaylandXdgSurfaceV5::surface() const
 }
 
 /*!
- * \qmlproperty enum QtWaylandCompositor::XdgSurfaceV5::windowType
+ * \qmlproperty enumeration QtWaylandCompositor::XdgSurfaceV5::windowType
  *
  * This property holds the window type of the XdgSurfaceV5.
  */
@@ -840,7 +1060,7 @@ Qt::WindowType QWaylandXdgSurfaceV5::windowType() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgSurfaceV5::parentSurface
+ * \qmlproperty XdgSurfaceV5 QtWaylandCompositor::XdgSurfaceV5::parentSurface
  *
  * This property holds the XdgSurfaceV5 parent of this XdgSurfaceV5.
  * When a parent surface is set, the parentSurfaceChanged() signal
@@ -1175,7 +1395,7 @@ void QWaylandXdgPopupV5::initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgPopupV5::shell
+ * \qmlproperty XdgShellV5 QtWaylandCompositor::XdgPopupV5::shell
  *
  * This property holds the shell associated with this XdgPopupV5.
  */
@@ -1192,7 +1412,7 @@ QWaylandXdgShellV5 *QWaylandXdgPopupV5::shell() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgPopupV5::surface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::XdgPopupV5::surface
  *
  * This property holds the surface associated with this XdgPopupV5.
  */
@@ -1209,7 +1429,7 @@ QWaylandSurface *QWaylandXdgPopupV5::surface() const
 }
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgPopupV5::parentSurface
+ * \qmlproperty WaylandSurface QtWaylandCompositor::XdgPopupV5::parentSurface
  *
  * This property holds the surface associated with the parent of this XdgPopupV5.
  */
@@ -1228,7 +1448,7 @@ QWaylandSurface *QWaylandXdgPopupV5::parentSurface() const
 
 
 /*!
- * \qmlproperty object QtWaylandCompositor::XdgPopupV5::position
+ * \qmlproperty point QtWaylandCompositor::XdgPopupV5::position
  *
  * This property holds the location of the upper left corner of the surface
  * relative to the upper left corner of the parent surface, in surface local
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index c9133a22721c845a8315ce80f782f25c5a554e3c..453800c18a2fe43b0ed6983bf6f031aaf08f8b73 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -44,6 +44,7 @@
 #include <QtGui/QGuiApplication>
 #include <QtGui/QOpenGLContext>
 #include <QtGui/QOpenGLTexture>
+#include <QtGui/QOffscreenSurface>
 #include <qpa/qplatformscreen.h>
 #include <QtGui/QWindow>
 #include <QtCore/QPointer>
@@ -153,14 +154,14 @@ struct BufferState
     BufferState();
 
     enum EglMode {
-        ModeNone,
+        ModeUninitialized,
         ModeEGLImage,
         ModeEGLStream
     };
 
     EGLint egl_format;
     QVarLengthArray<EGLImageKHR, 3> egl_images;
-    QOpenGLTexture *textures[3];
+    QOpenGLTexture *textures[3] = {};
     EGLStreamKHR egl_stream;
 
     bool isYInverted;
@@ -174,13 +175,17 @@ public:
     WaylandEglClientBufferIntegrationPrivate();
 
     void initBuffer(WaylandEglClientBuffer *buffer);
-    void init_egl_texture(WaylandEglClientBuffer *buffer, EGLint format);
-    void init_egl_fd_texture(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle);
-    void register_buffer(struct ::wl_resource *buffer, BufferState state);
+    void initEglTexture(WaylandEglClientBuffer *buffer, EGLint format);
+    bool ensureContext();
+    bool initEglStream(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle);
+    void handleEglstreamTexture(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle);
+    void registerBuffer(struct ::wl_resource *buffer, BufferState state);
 
     EGLDisplay egl_display;
     bool valid;
     bool display_bound;
+    QOffscreenSurface *offscreenSurface = nullptr;
+    QOpenGLContext *localContext = nullptr;
 
     PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display;
     PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display;
@@ -201,7 +206,7 @@ BufferState::BufferState()
     : egl_format(EGL_TEXTURE_RGBA)
     , egl_stream(EGL_NO_STREAM_KHR)
     , isYInverted(true)
-    , eglMode(ModeNone)
+    , eglMode(ModeUninitialized)
 {}
 
 WaylandEglClientBufferIntegrationPrivate::WaylandEglClientBufferIntegrationPrivate()
@@ -223,10 +228,10 @@ void WaylandEglClientBufferIntegrationPrivate::initBuffer(WaylandEglClientBuffer
     EGLint format;
 
     if (egl_query_wayland_buffer(egl_display, buffer->waylandBufferHandle(), EGL_TEXTURE_FORMAT, &format))
-        init_egl_texture(buffer, format);
+        initEglTexture(buffer, format);
 }
 
-void WaylandEglClientBufferIntegrationPrivate::init_egl_texture(WaylandEglClientBuffer *buffer, EGLint format)
+void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBuffer *buffer, EGLint format)
 {
 // Non-streaming case
 
@@ -288,11 +293,31 @@ void WaylandEglClientBufferIntegrationPrivate::init_egl_texture(WaylandEglClient
     }
 }
 
-void WaylandEglClientBufferIntegrationPrivate::init_egl_fd_texture(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle)
+bool WaylandEglClientBufferIntegrationPrivate::ensureContext()
 {
-//EglStreams case
-    BufferState &state = *buffer->d;
+    bool localContextNeeded = false;
+    if (!QOpenGLContext::currentContext()) {
+        if (!localContext && QOpenGLContext::globalShareContext()) {
+            localContext = new QOpenGLContext;
+            localContext->setShareContext(QOpenGLContext::globalShareContext());
+            localContext->create();
+        }
+        if (localContext) {
+            if (!offscreenSurface) {
+                offscreenSurface = new QOffscreenSurface;
+                offscreenSurface->setFormat(localContext->format());
+                offscreenSurface->create();
+            }
+            localContext->makeCurrent(offscreenSurface);
+            localContextNeeded = true;
+        }
+    }
+    return localContextNeeded;
+}
 
+bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuffer *buffer, wl_resource *bufferHandle)
+{
+    BufferState &state = *buffer->d;
     state.egl_format = EGL_TEXTURE_EXTERNAL_WL;
     state.isYInverted = false;
 
@@ -311,39 +336,57 @@ void WaylandEglClientBufferIntegrationPrivate::init_egl_fd_texture(WaylandEglCli
 
     if (state.egl_stream == EGL_NO_STREAM_KHR) {
         qWarning("%s:%d: eglCreateStreamFromFileDescriptorKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
-        return;
+        return false;
     }
     state.eglMode = BufferState::ModeEGLStream;
 
     if (!QOpenGLContext::currentContext()) {
         qWarning("EglClientBufferIntegration: creating texture with no current context");
-        return;
+        return false;
     }
 
-    //TODO This texture might end up in a different context than the quick item which wants to use it, this needs to be fixed somehow.
-
     auto texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(GL_TEXTURE_EXTERNAL_OES));
     texture->create();
     state.textures[0] = texture; // TODO: support multiple planes for the streaming case
 
-    glActiveTexture(GL_TEXTURE0);
-    texture->create();
     texture->bind();
-    glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->textureId());
-
-    glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-    glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-    glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
     auto newStream = funcs->stream_consumer_gltexture(egl_display, state.egl_stream);
-
     if (!newStream) {
         EGLint code = eglGetError();
         qWarning() << "Could not initialize EGLStream:" << egl_error_string(code) << hex << (long)code;
         funcs->destroy_stream(egl_display, state.egl_stream);
         state.egl_stream = EGL_NO_STREAM_KHR;
+        return false;
+    }
+    return true;
+}
+
+void WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(WaylandEglClientBuffer *buffer, struct ::wl_resource *bufferHandle)
+{
+    bool usingLocalContext = ensureContext();
+
+    if (buffer->d->eglMode == BufferState::ModeUninitialized) {
+        bool streamOK = initEglStream(buffer, bufferHandle);
+        if (!streamOK)
+            return;
     }
+
+    BufferState &state = *buffer->d;
+    auto texture = state.textures[0];
+
+    // EGLStream requires calling acquire on every frame.
+    texture->bind();
+    EGLint stream_state;
+    funcs->query_stream(egl_display, state.egl_stream, EGL_STREAM_STATE_KHR, &stream_state);
+
+    if (stream_state == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR) {
+        if (funcs->stream_consumer_acquire(egl_display, state.egl_stream) != EGL_TRUE)
+            qWarning("%s:%d: eglStreamConsumerAcquireKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
+    }
+
+    if (usingLocalContext)
+        localContext->doneCurrent();
 }
 
 WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration()
@@ -477,9 +520,12 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane)
     if (!m_buffer)
         return nullptr;
 
-    auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration);
     auto texture = d->textures[plane];
-    const auto target = static_cast<QOpenGLTexture::Target>((d->eglMode == BufferState::ModeEGLStream || d->egl_format == EGL_TEXTURE_EXTERNAL_WL) ? GL_TEXTURE_EXTERNAL_OES
+    if (d->eglMode == BufferState::ModeEGLStream)
+        return texture; // EGLStreams texture is maintained by handle_eglstream_texture()
+
+    auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration);
+    const auto target = static_cast<QOpenGLTexture::Target>(d->egl_format == EGL_TEXTURE_EXTERNAL_WL ? GL_TEXTURE_EXTERNAL_OES
                                                                         : GL_TEXTURE_2D);
     if (!texture) {
         texture = new QOpenGLTexture(target);
@@ -489,22 +535,7 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane)
         d->textures[plane] = texture;
     }
 
-
-    if (d->eglMode == BufferState::ModeEGLStream) {
-        // EGLStream requires calling acquire on every frame.
-        if (d->egl_stream != EGL_NO_STREAM_KHR) {
-
-            texture->bind();
-
-            EGLint stream_state;
-            p->funcs->query_stream(p->egl_display, d->egl_stream, EGL_STREAM_STATE_KHR, &stream_state);
-
-            if (stream_state == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR) {
-                if (p->funcs->stream_consumer_acquire(p->egl_display, d->egl_stream) != EGL_TRUE)
-                    qWarning("%s:%d: eglStreamConsumerAcquireKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
-            }
-        }
-    } else if (m_textureDirty) {
+    if (m_textureDirty) {
         texture->bind();
         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
         p->gl_egl_image_target_texture_2d(target, d->egl_images[plane]);
@@ -515,9 +546,9 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane)
 void WaylandEglClientBuffer::setCommitted(QRegion &damage)
 {
     ClientBuffer::setCommitted(damage);
-    if (d->eglMode == BufferState::ModeNone) {
+    if (d->eglMode == BufferState::ModeEGLStream || d->eglMode == BufferState::ModeUninitialized) {
         auto *p = WaylandEglClientBufferIntegrationPrivate::get(m_integration);
-        p->init_egl_fd_texture(this, waylandBufferHandle());
+        p->handleEglstreamTexture(this, waylandBufferHandle());
     }
 }
 
diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp
index 8acddfbe74032da9f917aa3d6f95408959b56c75..1eee90f49dbaa7ab77288d54d055906f76ce5aaa 100644
--- a/tests/auto/client/client/tst_client.cpp
+++ b/tests/auto/client/client/tst_client.cpp
@@ -143,6 +143,8 @@ private slots:
     void touchDrag();
     void mouseDrag();
     void dontCrashOnMultipleCommits();
+    void hiddenTransientParent();
+    void hiddenPopupParent();
 
 private:
     MockCompositor *compositor;
@@ -360,6 +362,48 @@ void tst_WaylandClient::dontCrashOnMultipleCommits()
     QTRY_VERIFY(!compositor->surface());
 }
 
+void tst_WaylandClient::hiddenTransientParent()
+{
+    QWindow parent;
+    QWindow transient;
+
+    transient.setTransientParent(&parent);
+
+    parent.show();
+    QTRY_VERIFY(compositor->surface());
+
+    parent.hide();
+    QTRY_VERIFY(!compositor->surface());
+
+    transient.show();
+    QTRY_VERIFY(compositor->surface());
+}
+
+void tst_WaylandClient::hiddenPopupParent()
+{
+    TestWindow toplevel;
+    toplevel.show();
+
+    // wl_shell relies on a mouse event in order to send a serial and seat
+    // with the set_popup request.
+    QSharedPointer<MockSurface> surface;
+    QTRY_VERIFY(surface = compositor->surface());
+    QPoint mousePressPos(16, 16);
+    QCOMPARE(toplevel.mousePressEventCount, 0);
+    compositor->sendMousePress(surface, mousePressPos);
+    QTRY_COMPARE(toplevel.mousePressEventCount, 1);
+
+    QWindow popup;
+    popup.setTransientParent(&toplevel);
+    popup.setFlag(Qt::Popup, true);
+
+    toplevel.hide();
+    QTRY_VERIFY(!compositor->surface());
+
+    popup.show();
+    QTRY_VERIFY(compositor->surface());
+}
+
 int main(int argc, char **argv)
 {
     setenv("XDG_RUNTIME_DIR", ".", 1);
diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro
index f0cdaf32c4f3897bb6ef37590d1f48d5f614e92f..112e2e74f378e31880f78f192604a5744440bc33 100644
--- a/tests/auto/compositor/compositor/compositor.pro
+++ b/tests/auto/compositor/compositor/compositor.pro
@@ -20,11 +20,13 @@ SOURCES += \
     testkeyboardgrabber.cpp \
     mockclient.cpp \
     mockseat.cpp \
-    testseat.cpp
+    testseat.cpp \
+    mockpointer.cpp
 
 HEADERS += \
     testcompositor.h \
     testkeyboardgrabber.h \
     mockclient.h \
     mockseat.h \
-    testseat.h
+    testseat.h \
+    mockpointer.h
diff --git a/tests/auto/compositor/compositor/mockpointer.cpp b/tests/auto/compositor/compositor/mockpointer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6c51d8bd1ec963584d4169768c2fe0ca1371b9fb
--- /dev/null
+++ b/tests/auto/compositor/compositor/mockpointer.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mockpointer.h"
+
+static void pointerEnter(void *pointer, struct wl_pointer *wlPointer, uint serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
+{
+    Q_UNUSED(wlPointer);
+    Q_UNUSED(serial);
+    Q_UNUSED(x);
+    Q_UNUSED(y);
+
+    static_cast<MockPointer *>(pointer)->m_enteredSurface = surface;
+}
+
+static void pointerLeave(void *pointer, struct wl_pointer *wlPointer, uint32_t serial, struct wl_surface *surface)
+{
+    Q_UNUSED(pointer);
+    Q_UNUSED(wlPointer);
+    Q_UNUSED(serial);
+
+    Q_ASSERT(surface);
+
+    static_cast<MockPointer *>(pointer)->m_enteredSurface = nullptr;
+}
+
+static void pointerMotion(void *pointer, struct wl_pointer *wlPointer, uint32_t time, wl_fixed_t x, wl_fixed_t y)
+{
+    Q_UNUSED(pointer);
+    Q_UNUSED(wlPointer);
+    Q_UNUSED(time);
+    Q_UNUSED(x);
+    Q_UNUSED(y);
+}
+
+static void pointerButton(void *pointer, struct wl_pointer *wlPointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
+{
+    Q_UNUSED(pointer);
+    Q_UNUSED(wlPointer);
+    Q_UNUSED(serial);
+    Q_UNUSED(time);
+    Q_UNUSED(button);
+    Q_UNUSED(state);
+}
+
+static void pointerAxis(void *pointer, struct wl_pointer *wlPointer, uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+    Q_UNUSED(pointer);
+    Q_UNUSED(wlPointer);
+    Q_UNUSED(time);
+    Q_UNUSED(axis);
+    Q_UNUSED(value);
+}
+
+static const struct wl_pointer_listener pointerListener = {
+    pointerEnter,
+    pointerLeave,
+    pointerMotion,
+    pointerButton,
+    pointerAxis,
+};
+
+MockPointer::MockPointer(wl_seat *seat)
+    : m_pointer(wl_seat_get_pointer(seat))
+{
+    wl_pointer_add_listener(m_pointer, &pointerListener, this);
+}
+
+MockPointer::~MockPointer()
+{
+    wl_pointer_destroy(m_pointer);
+}
diff --git a/tests/auto/compositor/compositor/mockpointer.h b/tests/auto/compositor/compositor/mockpointer.h
new file mode 100644
index 0000000000000000000000000000000000000000..35386141545200d166d849652585d1b3c81f95bd
--- /dev/null
+++ b/tests/auto/compositor/compositor/mockpointer.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOCKPOINTER_H
+#define MOCKPOINTER_H
+
+#include <QObject>
+#include <wayland-client.h>
+
+class MockPointer : public QObject
+{
+    Q_OBJECT
+
+public:
+    MockPointer(wl_seat *seat);
+    ~MockPointer();
+
+    wl_pointer *m_pointer = nullptr;
+    wl_surface *m_enteredSurface = nullptr;
+};
+
+#endif // MOCKPOINTER_H
diff --git a/tests/auto/compositor/compositor/mockseat.cpp b/tests/auto/compositor/compositor/mockseat.cpp
index 29c4a4e133fc13618e55d7642cfa1f4e1bb8d5d5..052c2f90b12a2965b2908b2c359fdf524fa55668 100644
--- a/tests/auto/compositor/compositor/mockseat.cpp
+++ b/tests/auto/compositor/compositor/mockseat.cpp
@@ -30,6 +30,7 @@
 
 MockSeat::MockSeat(wl_seat *seat)
     : m_seat(seat)
+    , m_pointer(new MockPointer(seat))
 {
     // Bind to the keyboard interface so that the compositor has
     // the right resource associations
diff --git a/tests/auto/compositor/compositor/mockseat.h b/tests/auto/compositor/compositor/mockseat.h
index 1c6d324c285c18281904dd34568f02000542f7d2..e6d5e0b1c839d27be74343efeb9353dbddf63390 100644
--- a/tests/auto/compositor/compositor/mockseat.h
+++ b/tests/auto/compositor/compositor/mockseat.h
@@ -28,6 +28,8 @@
 #ifndef MOCKSEAT
 #define MOCKSEAT
 
+#include "mockpointer.h"
+
 #include <QObject>
 #include <wayland-client.h>
 
@@ -38,8 +40,13 @@ class MockSeat : public QObject
 public:
     MockSeat(wl_seat *seat);
     ~MockSeat();
+    MockPointer *pointer() const { return m_pointer.data(); }
 
     wl_seat *m_seat;
     wl_keyboard *m_keyboard;
+
+private:
+    QScopedPointer<MockPointer> m_pointer;
 };
+
 #endif
diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp
index 52428eb4a989c19b3259b44786ddc52b62ef358b..c51c13bd6ec2053c045c782f36b1971135eaab8b 100644
--- a/tests/auto/compositor/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/compositor/tst_compositor.cpp
@@ -27,6 +27,8 @@
 ****************************************************************************/
 
 #include "mockclient.h"
+#include "mockseat.h"
+#include "mockpointer.h"
 #include "testcompositor.h"
 #include "testkeyboardgrabber.h"
 #include "testseat.h"
@@ -57,6 +59,7 @@ private slots:
     void keyboardGrab();
     void seatCreation();
     void seatKeyboardFocus();
+    void seatMouseFocus();
     void singleClient();
     void multipleClients();
     void geometry();
@@ -442,6 +445,59 @@ void tst_WaylandCompositor::seatKeyboardFocus()
     QTRY_VERIFY(!compositor.defaultSeat()->keyboardFocus());
 }
 
+void tst_WaylandCompositor::seatMouseFocus()
+{
+    TestCompositor compositor(true);
+    compositor.create();
+
+    // Create client after all the seats have been set up as the mock client
+    // does not dynamically listen to new seats
+    MockClient client;
+    wl_surface *surface = client.createSurface();
+    QTRY_COMPARE(compositor.surfaces.size(), 1);
+
+    QWaylandSurface *waylandSurface = compositor.surfaces.at(0);
+    auto view = new QWaylandView;
+    view->setSurface(waylandSurface);
+
+    QWaylandSeat* seat = compositor.defaultSeat();
+    seat->setMouseFocus(view);
+    seat->sendMouseMoveEvent(view, QPointF(10, 10), QPointF(100, 100));
+
+    compositor.flushClients();
+
+    QTRY_VERIFY(seat->mouseFocus());
+    QTRY_VERIFY(seat->pointer());
+    QTRY_COMPARE(seat->mouseFocus()->surface(), waylandSurface);
+
+    QTRY_COMPARE(client.m_seats.size(), 1);
+    MockPointer *mockPointer = client.m_seats.first()->pointer();
+    QVERIFY(mockPointer);
+    QTRY_COMPARE(mockPointer->m_enteredSurface, surface);
+
+    delete view;
+
+    compositor.flushClients();
+
+    QTRY_COMPARE(mockPointer->m_enteredSurface, nullptr);
+    QTRY_VERIFY(!compositor.defaultSeat()->mouseFocus());
+
+    view = new QWaylandView;
+    view->setSurface(waylandSurface);
+    seat->sendMouseMoveEvent(view, QPointF(10, 10), QPointF(100, 100));
+    QTRY_COMPARE(compositor.defaultSeat()->mouseFocus(), view);
+
+    compositor.flushClients();
+
+    QTRY_COMPARE(mockPointer->m_enteredSurface, surface);
+
+    wl_surface_destroy(surface);
+    QTRY_VERIFY(compositor.surfaces.size() == 0);
+    QTRY_VERIFY(!compositor.defaultSeat()->mouseFocus());
+
+    delete view;
+}
+
 class XdgTestCompositor: public TestCompositor {
     Q_OBJECT
 public:
diff --git a/tests/manual/keymap/keymapcompositor.qml b/tests/manual/keymap/keymapcompositor.qml
index 7f8982636c70f10d28ce7cac6a3cb640a0b41319..77111c815d36bf73cd9321dd43a6e56e644afbba 100644
--- a/tests/manual/keymap/keymapcompositor.qml
+++ b/tests/manual/keymap/keymapcompositor.qml
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/qmlclient/main.cpp b/tests/manual/qmlclient/main.cpp
index cb2044c296ae744e95df09a52c87ed644d07cf9d..9e0774b13f93397bb053868556c97ab0056aab97 100644
--- a/tests/manual/qmlclient/main.cpp
+++ b/tests/manual/qmlclient/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/qmlclient/main.qml b/tests/manual/qmlclient/main.qml
index a1fe241c866b2902098868617aeceedd272abea1..5ee63955b3194918176e52b67055f983aa05832d 100644
--- a/tests/manual/qmlclient/main.qml
+++ b/tests/manual/qmlclient/main.qml
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/scaling-compositor/main.cpp b/tests/manual/scaling-compositor/main.cpp
index 33ffb0386109cf761f5fc125fd2a910744dd4226..b5c7dd688ac9ffbec5232550761d97d1140b9e1b 100644
--- a/tests/manual/scaling-compositor/main.cpp
+++ b/tests/manual/scaling-compositor/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/scaling-compositor/main.qml b/tests/manual/scaling-compositor/main.qml
index e017a44f6c3fad6fdc77be5711e1662108125a97..056af4e5b6fde1e8d73ffbfac2b1b074932bee60 100644
--- a/tests/manual/scaling-compositor/main.qml
+++ b/tests/manual/scaling-compositor/main.qml
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/subsurface/child.qml b/tests/manual/subsurface/child.qml
index b2e54054e40a3ab880f2c53de736e9e8edc818c3..f1bdd66efe07c35ded442883fcca6837c7818abb 100644
--- a/tests/manual/subsurface/child.qml
+++ b/tests/manual/subsurface/child.qml
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/subsurface/main.cpp b/tests/manual/subsurface/main.cpp
index c913c32fb63d3c39c8cce8305d2b8450c7c85b57..375e5d2b911fd763727643cdd77176650eec12c8 100644
--- a/tests/manual/subsurface/main.cpp
+++ b/tests/manual/subsurface/main.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/subsurface/main.qml b/tests/manual/subsurface/main.qml
index 8d221401b1d5612dc2365a1b35b2d281283ad668..8c27ac78d4969abb10d4f6d85e8455a9bceedd16 100644
--- a/tests/manual/subsurface/main.qml
+++ b/tests/manual/subsurface/main.qml
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2015 LG Electronics Inc, author: <mikko.levonmaa@lge.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/subsurface/shmwindow.cpp b/tests/manual/subsurface/shmwindow.cpp
index 50452953a800c6d68921ec24bb7ec133d6a738b1..323582101c85658357d4dfd438e09cf7fe313955 100644
--- a/tests/manual/subsurface/shmwindow.cpp
+++ b/tests/manual/subsurface/shmwindow.cpp
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are
diff --git a/tests/manual/subsurface/shmwindow.h b/tests/manual/subsurface/shmwindow.h
index 44d111e79263e67271aa3d357fd28fee31909bee..10041eea9ff7a65d56685406da24ff9bfdee0672 100644
--- a/tests/manual/subsurface/shmwindow.h
+++ b/tests/manual/subsurface/shmwindow.h
@@ -1,12 +1,22 @@
 /****************************************************************************
 **
 ** Copyright (C) 2015 LG Electronics Ltd, author: <mikko.levonmaa@lge.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
 **
 ** This file is part of the examples of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
 **
 ** "Redistribution and use in source and binary forms, with or without
 ** modification, are permitted provided that the following conditions are