diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-05-11 14:28:56 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-05-20 12:11:17 +0000 |
commit | 5e5e866c8c1fc8234c25770d84e9591041e67d69 (patch) | |
tree | 111913497f39e6cbad7403743ab40a5d9aed734c /src/imports | |
parent | 8817a981389b4f22a614f258f3575360645f2fd9 (diff) | |
download | qtwayland-5e5e866c8c1fc8234c25770d84e9591041e67d69.tar.gz |
Create a general ShellSurfaceItem to avoid duplication
XdgSurfaceItem and WlShellSurfaceItem have been removed in favor
of the more general ShellSurfaceItem. An XdgSurface or a WlShellSurface
can be assigned to the shellSurface property of a ShellSurfaceItem
and leaves open the possibility for additional shells.
A shared base class for QWaylandXdgSurface and QWaylandWlShellSurface
has been added which has a factory method for creating
a QWaylandQuickShellIntegration for that shell implementation.
The property "shellSurface" on the ShellSurfaceItem allows QML code to
attach to signals regardless of whether it's a WlShell or XdgShell
client. The pure-qml example has been updated to take advantage of this.
Change-Id: I9d3427586e100d6c44a24f319dd8e1486ff062ee
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/compositor/plugins.qmltypes | 35 | ||||
-rw-r--r-- | src/imports/compositor/qwaylandquickcompositorplugin.cpp | 7 |
2 files changed, 19 insertions, 23 deletions
diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes index db104c05..54b3bfcc 100644 --- a/src/imports/compositor/plugins.qmltypes +++ b/src/imports/compositor/plugins.qmltypes @@ -230,6 +230,14 @@ Module { Method { name: "updateStarted" } } Component { + name: "QWaylandQuickShellSurfaceItem" + defaultProperty: "data" + prototype: "QWaylandQuickItem" + exports: ["QtWayland.Compositor/ShellSurfaceItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "shellSurface"; type: "QWaylandShellSurface"; isPointer: true } + } + Component { name: "QWaylandQuickSurface" prototype: "QWaylandSurface" exports: ["QtWayland.Compositor/WaylandSurface 1.0"] @@ -238,26 +246,15 @@ Module { Property { name: "clientRenderingEnabled"; type: "bool" } } Component { - name: "QWaylandQuickWlShellSurfaceItem" - defaultProperty: "data" - prototype: "QWaylandQuickItem" - exports: ["QtWayland.Compositor/WlShellSurfaceItem 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "shellSurface"; type: "QWaylandWlShellSurface"; isPointer: true } - Property { name: "moveItem"; type: "QQuickItem"; isPointer: true } - } - Component { - name: "QWaylandQuickXdgSurfaceItem" - defaultProperty: "data" - prototype: "QWaylandQuickItem" - exports: ["QtWayland.Compositor/XdgSurfaceItem 1.0"] + name: "QWaylandResource" + exports: ["QtWayland.Compositor/WaylandResource 1.0"] + isCreatable: false exportMetaObjectRevisions: [0] - Property { name: "xdgSurface"; type: "QWaylandXdgSurface"; isPointer: true } - Property { name: "moveItem"; type: "QQuickItem"; isPointer: true } } Component { - name: "QWaylandResource" - exports: ["QtWayland.Compositor/WaylandResource 1.0"] + name: "QWaylandShellSurface" + prototype: "QWaylandCompositorExtension" + exports: ["QtWayland.Compositor/ShellSurface 1.0"] isCreatable: false exportMetaObjectRevisions: [0] } @@ -392,7 +389,7 @@ Module { } Component { name: "QWaylandWlShellSurface" - prototype: "QWaylandCompositorExtension" + prototype: "QWaylandShellSurface" exports: [ "QtWayland.Compositor/WlShellSurface 1.0", "QtWayland.Compositor/WlShellSurfaceBase 1.0" @@ -532,7 +529,7 @@ Module { } Component { name: "QWaylandXdgSurface" - prototype: "QWaylandCompositorExtension" + prototype: "QWaylandShellSurface" exports: [ "QtWayland.Compositor/XdgSurface 1.0", "QtWayland.Compositor/XdgSurfaceBase 1.0" diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp index 960d2926..6f00351c 100644 --- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp +++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp @@ -47,8 +47,7 @@ #include <QtWaylandCompositor/QWaylandCompositorExtension> #include <QtWaylandCompositor/QWaylandQuickExtension> #include <QtWaylandCompositor/QWaylandInputDevice> -#include <QtWaylandCompositor/QWaylandQuickWlShellSurfaceItem> -#include <QtWaylandCompositor/QWaylandQuickXdgSurfaceItem> +#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> #include <QtWaylandCompositor/QWaylandResource> #include <QtWaylandCompositor/QWaylandWindowManagerExtension> @@ -141,6 +140,7 @@ public: qmlRegisterUncreatableType<QWaylandInputDevice>(uri, 1, 0, "WaylandInputDevice", QObject::tr("Cannot create instance of WaylandInputDevice")); qmlRegisterUncreatableType<QWaylandCompositor>(uri, 1, 0, "WaylandCompositorBase", QObject::tr("Cannot create instance of WaylandCompositorBase, use WaylandCompositor instead")); qmlRegisterUncreatableType<QWaylandSurface>(uri, 1, 0, "WaylandSurfaceBase", QObject::tr("Cannot create instance of WaylandSurfaceBase, use WaylandSurface instead")); + qmlRegisterUncreatableType<QWaylandShellSurface>(uri, 1, 0, "ShellSurface", QObject::tr("Cannot create instance of ShellSurface")); qmlRegisterUncreatableType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurfaceBase", QObject::tr("Cannot create instance of WlShellSurfaceBase, use WlShellSurface instead")); qmlRegisterUncreatableType<QWaylandXdgSurface>(uri, 1, 0, "XdgSurfaceBase", QObject::tr("Cannot create instance of XdgSurfaceBase, use XdgSurface instead")); qmlRegisterUncreatableType<QWaylandResource>(uri, 1, 0, "WaylandResource", QObject::tr("Cannot create instance of WaylandResource")); @@ -149,10 +149,9 @@ public: qmlRegisterType<QWaylandWindowManagerExtensionQuickExtension>(uri, 1, 0, "WindowManager"); qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell"); qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface"); - qmlRegisterType<QWaylandQuickWlShellSurfaceItem>(uri, 1, 0, "WlShellSurfaceItem"); + qmlRegisterType<QWaylandQuickShellSurfaceItem>(uri, 1, 0, "ShellSurfaceItem"); qmlRegisterType<QWaylandXdgShellQuickExtension>(uri, 1, 0, "XdgShell"); qmlRegisterType<QWaylandXdgSurface>(uri, 1, 0, "XdgSurface"); - qmlRegisterType<QWaylandQuickXdgSurfaceItem>(uri, 1, 0, "XdgSurfaceItem"); qmlRegisterType<QWaylandTextInputManagerQuickExtension>(uri, 1, 0, "TextInputManager"); } }; |