summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-01-05 13:44:33 +0100
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:09:41 +0200
commit57900c49362a7f9bf11a72a46e309f8beeb631bb (patch)
tree2af3e7579d0e5ad4212e3fa2a793a5c15363b19e /src/imports
parentdc2ef3ae7435593284906e7cc32d69d97deaaf45 (diff)
Update compositor api
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/compositor/WaylandSurfaceChrome.qml75
-rw-r--r--src/imports/compositor/compositor.pro29
-rw-r--r--src/imports/compositor/plugins.qmltypes231
-rw-r--r--src/imports/compositor/qmldir1
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp18
5 files changed, 349 insertions, 5 deletions
diff --git a/src/imports/compositor/WaylandSurfaceChrome.qml b/src/imports/compositor/WaylandSurfaceChrome.qml
new file mode 100644
index 000000000..bf3a82f66
--- /dev/null
+++ b/src/imports/compositor/WaylandSurfaceChrome.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: chrome
+ property QtObject surface
+ property QtObject view
+
+ property bool automaticUseShellView: false
+ property bool automaticDestroyOnSurfaceDestroy: true
+
+ Connections {
+ target: surface
+
+ onShellViewCreated: {
+ if (chrome.automaticUseShellView)
+ view = surface.shellView;
+ }
+
+ onSurfaceDestroyed: {
+ chrome.surfaceDestroyed();
+ if (automaticDestroyOnSurfaceDestroy)
+ chrome.destroy();
+ }
+ }
+
+ Component.onCompleted: {
+ if (chrome.automaticUseShellView && !view && surface.shellView)
+ view = surface.shellView;
+ }
+
+ onViewChanged: {
+ if (view) {
+ view.parent = chrome;
+ chrome.anchors = Qt.binding(function() { return view.anchors; })
+ chrome.visible = Qt.binding(function() { return view.visible; })
+ } else {
+ chrome.visible = false;
+ }
+ }
+
+ Component.onDestruction: { if (view) view.destroy(); }
+}
diff --git a/src/imports/compositor/compositor.pro b/src/imports/compositor/compositor.pro
index 3c6d5b46f..75fec9bf4 100644
--- a/src/imports/compositor/compositor.pro
+++ b/src/imports/compositor/compositor.pro
@@ -6,6 +6,35 @@ IMPORT_VERSION = 1.0
SOURCES += \
qwaylandquickcompositorplugin.cpp
+COMPOSITOR_QML_FILES += \
+ WaylandSurfaceChrome.qml \
+ qmldir
+
+# Create the resource file
+GENERATED_RESOURCE_FILE = $$OUT_PWD/compositor.qrc
+
+RESOURCE_CONTENT = \
+ "<RCC>" \
+ "<qresource prefix=\"/QtWayland/Compositor\">"
+
+for(resourcefile, COMPOSITOR_QML_FILES) {
+ resourcefileabsolutepath = $$absolute_path($$resourcefile)
+ relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
+ relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
+ RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
+}
+
+RESOURCE_CONTENT += \
+ "</qresource>" \
+ "</RCC>"
+
+write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
+
+RESOURCES += $$GENERATED_RESOURCE_FILE
+
+# In case of a debug build, deploy the QML files too
+CONFIG(debug, debug|release): QML_FILES += $$COMPOSITOR_QML_FILES
+
DEFINES += QT_COMPOSITOR_QUICK
QT += quick-private qml-private compositor compositor-private
diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes
new file mode 100644
index 000000000..caf9ee0a7
--- /dev/null
+++ b/src/imports/compositor/plugins.qmltypes
@@ -0,0 +1,231 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtWayland.Compositor 1.0'
+
+Module {
+ Component {
+ name: "QWaylandClient"
+ prototype: "QObject"
+ exports: ["QtWayland.Compositor/WaylandClient 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "userId"; type: "qlonglong"; isReadonly: true }
+ Property { name: "groupId"; type: "qlonglong"; isReadonly: true }
+ Property { name: "processId"; type: "qlonglong"; isReadonly: true }
+ Method { name: "close" }
+ Method {
+ name: "kill"
+ Parameter { name: "sig"; type: "int" }
+ }
+ Method { name: "kill" }
+ }
+ Component {
+ name: "QWaylandCompositor"
+ prototype: "QObject"
+ Property { name: "socketName"; type: "QByteArray" }
+ Property { name: "extensionFlags"; type: "QWaylandCompositor::ExtensionFlags" }
+ Property { name: "retainedSelection"; type: "bool" }
+ Property { name: "primaryOutput"; type: "QWaylandOutput"; isPointer: true }
+ Signal {
+ name: "surfaceCreated"
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ }
+ Signal {
+ name: "surfaceAboutToBeDestroyed"
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ }
+ Method { name: "addDefaultShell" }
+ Method {
+ name: "destroyClientForSurface"
+ Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true }
+ }
+ Method {
+ name: "destroyClient"
+ Parameter { name: "client"; type: "QWaylandClient"; isPointer: true }
+ }
+ Method { name: "outputs"; type: "QList<QWaylandOutput*>" }
+ Method {
+ name: "output"
+ type: "QWaylandOutput*"
+ Parameter { name: "outputWindow"; type: "QWindow"; isPointer: true }
+ }
+ Method {
+ name: "addOutput"
+ type: "QWaylandOutput*"
+ Parameter { name: "outputWindow"; type: "QWindow"; isPointer: true }
+ }
+ Method {
+ name: "pickView"
+ type: "QWaylandSurfaceView*"
+ Parameter { name: "globalPosition"; type: "QPointF" }
+ }
+ Method {
+ name: "mapToView"
+ type: "QPointF"
+ Parameter { name: "view"; type: "QWaylandSurfaceView"; isPointer: true }
+ Parameter { name: "surfacePosition"; type: "QPointF" }
+ }
+ }
+ Component {
+ name: "QWaylandOutput"
+ prototype: "QObject"
+ exports: ["QtWayland.Compositor/WaylandOutput 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true }
+ Property { name: "window"; type: "QWindow"; isReadonly: true; isPointer: true }
+ Property { name: "geometry"; type: "QRect" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "physicalWidth"; type: "int" }
+ Property { name: "physicalHeight"; type: "int" }
+ Property { name: "refreshRate"; type: "int" }
+ }
+ Component {
+ name: "QWaylandQuickCompositor"
+ prototype: "QWaylandCompositor"
+ Property { name: "initializeLegazyQmlNames"; type: "bool" }
+ }
+ Component {
+ name: "QWaylandQuickCompositorImpl"
+ prototype: "QWaylandQuickCompositor"
+ exports: ["QtWayland.Compositor/WaylandCompositor 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QWaylandQuickSurface"
+ prototype: "QWaylandSurface"
+ exports: ["QtWayland.Compositor/WaylandQuickSurface 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "useTextureAlpha"; type: "bool" }
+ Property { name: "clientRenderingEnabled"; type: "bool" }
+ Property { name: "windowProperties"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "shellView"; type: "QWaylandSurfaceItem"; isReadonly: true; isPointer: true }
+ Signal { name: "shellViewCreated" }
+ }
+ Component {
+ name: "QWaylandSurface"
+ prototype: "QObject"
+ Enum {
+ name: "WindowFlag"
+ values: {
+ "OverridesSystemGestures": 1,
+ "StaysOnTop": 2,
+ "BypassWindowManager": 4
+ }
+ }
+ Enum {
+ name: "WindowFlags"
+ values: {
+ "OverridesSystemGestures": 1,
+ "StaysOnTop": 2,
+ "BypassWindowManager": 4
+ }
+ }
+ Enum {
+ name: "WindowType"
+ values: {
+ "None": 0,
+ "Toplevel": 1,
+ "Transient": 2,
+ "Popup": 3
+ }
+ }
+ Property { name: "client"; type: "QWaylandClient"; isReadonly: true; isPointer: true }
+ Property { name: "size"; type: "QSize"; isReadonly: true }
+ Property { name: "windowFlags"; type: "QWaylandSurface::WindowFlags"; isReadonly: true }
+ Property { name: "windowType"; type: "QWaylandSurface::WindowType"; isReadonly: true }
+ Property { name: "contentOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
+ Property { name: "className"; type: "string"; isReadonly: true }
+ Property { name: "title"; type: "string"; isReadonly: true }
+ Property { name: "orientationUpdateMask"; type: "Qt::ScreenOrientations"; isReadonly: true }
+ Property { name: "visibility"; type: "QWindow::Visibility" }
+ Property { name: "transientParent"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "transientOffset"; type: "QPointF"; isReadonly: true }
+ Property { name: "output"; type: "QWaylandOutput"; isReadonly: true; isPointer: true }
+ Signal { name: "mapped" }
+ Signal { name: "unmapped" }
+ Signal {
+ name: "damaged"
+ Parameter { name: "rect"; type: "QRegion" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { name: "newParent"; type: "QWaylandSurface"; isPointer: true }
+ Parameter { name: "oldParent"; type: "QWaylandSurface"; isPointer: true }
+ }
+ Signal {
+ name: "windowPropertyChanged"
+ Parameter { name: "name"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Signal {
+ name: "windowFlagsChanged"
+ Parameter { name: "flags"; type: "WindowFlags" }
+ }
+ Signal {
+ name: "windowTypeChanged"
+ Parameter { name: "type"; type: "WindowType" }
+ }
+ Signal { name: "extendedSurfaceReady" }
+ Signal { name: "raiseRequested" }
+ Signal { name: "lowerRequested" }
+ Signal { name: "pong" }
+ Signal { name: "surfaceDestroyed" }
+ Signal { name: "shellViewCreated" }
+ Signal {
+ name: "outputChanged"
+ Parameter { name: "newOutput"; type: "QWaylandOutput"; isPointer: true }
+ Parameter { name: "oldOutput"; type: "QWaylandOutput"; isPointer: true }
+ }
+ Signal {
+ name: "configure"
+ Parameter { name: "hasBuffer"; type: "bool" }
+ }
+ Signal { name: "redraw" }
+ Method { name: "updateSelection" }
+ Method {
+ name: "requestSize"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Method {
+ name: "sendOnScreenVisibilityChange"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "destroy" }
+ Method { name: "destroySurface" }
+ Method { name: "ping" }
+ }
+ Component {
+ name: "QWaylandSurfaceItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtWayland.Compositor/WaylandSurfaceItem 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true }
+ Property { name: "paintEnabled"; type: "bool" }
+ Property { name: "touchEventsEnabled"; type: "bool" }
+ Property { name: "isYInverted"; type: "bool"; isReadonly: true }
+ Property { name: "resizeSurfaceToItem"; type: "bool" }
+ Signal { name: "yInvertedChanged" }
+ Signal { name: "surfaceDestroyed" }
+ Method {
+ name: "takeFocus"
+ Parameter { name: "device"; type: "QWaylandInputDevice"; isPointer: true }
+ }
+ Method { name: "takeFocus" }
+ Method {
+ name: "setPaintEnabled"
+ Parameter { name: "paintEnabled"; type: "bool" }
+ }
+ Method { name: "isYInverted"; type: "bool" }
+ }
+}
diff --git a/src/imports/compositor/qmldir b/src/imports/compositor/qmldir
index 0a9a719e1..6307e1a80 100644
--- a/src/imports/compositor/qmldir
+++ b/src/imports/compositor/qmldir
@@ -1,4 +1,3 @@
module QtWayland.Compositor
plugin qwaylandcompositorplugin
classname QWaylandCompositorPlugin
-typeinfo plugins.qmltypes
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
index b6b31fffd..7c1a995e5 100644
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
@@ -33,6 +33,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include <QtCore/QDir>
#include <QtQml/qqmlextensionplugin.h>
@@ -97,13 +98,22 @@ public:
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor"));
- Q_UNUSED(uri);
- defineModule();
+ defineModule(uri);
+
+ bool useResource = true;
+ QDir qmlDir(baseUrl().toLocalFile());
+ if (qmlDir.exists(QStringLiteral("WaylandSurfaceChrome.qml")))
+ useResource = false;
+
+ QUrl waylandSurfaceChromeUrl = useResource ?
+ QUrl("qrc:/QtWayland/Compositor/WaylandSurfaceChrome.qml") :
+ QUrl::fromLocalFile(qmlDir.filePath("WaylandSurfaceChrome.qml"));
+ qmlRegisterType(waylandSurfaceChromeUrl, uri, 1, 0, "WaylandSurfaceChrome");
+
}
- static void defineModule()
+ static void defineModule(const char *uri)
{
- const char uri[] = "QtWayland.Compositor";
qmlRegisterType<QWaylandQuickCompositorImpl>(uri, 1, 0, "WaylandCompositor");
qmlRegisterUncreatableType<QWaylandSurfaceItem>(uri, 1, 0, "WaylandSurfaceItem", QObject::tr("Cannot create instance of WaylandSurfaceItem"));
qmlRegisterUncreatableType<QWaylandQuickSurface>(uri, 1, 0, "WaylandQuickSurface", QObject::tr("Cannot create instance of WaylandQuickSurface"));