summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-17 12:32:48 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-18 14:48:57 +0000
commitd9e0249e064bdeef545a95c64d54ac56b73833f3 (patch)
treed3b88ebc90ead049e919d04f87a5dfa0f99e7a42
parent07dffc46ff14a745df020a987c2a17fbfd90d6fe (diff)
Simplify the construction of pure-qml
Make it possible that an WaylandOutput item is declared as a child of a WaylandCompositor item. This is mostly usefull for examples, since output handling will likely be event driven in a propper compositor Change-Id: I3238b079e41a49f69cbd9255818588674b364fb2 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
-rw-r--r--examples/wayland/pure-qml/qml/main.qml15
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp5
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h3
3 files changed, 11 insertions, 12 deletions
diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml
index d20ea10fd..9ea92313f 100644
--- a/examples/wayland/pure-qml/qml/main.qml
+++ b/examples/wayland/pure-qml/qml/main.qml
@@ -42,13 +42,12 @@ import QtQuick 2.0
import QtWayland.Compositor 1.0
WaylandCompositor {
- id: compositor
+ id: comp
property var primarySurfacesArea: null
- Component {
- id: screenComponent
- Screen { }
+ Screen {
+ compositor: comp
}
Component {
@@ -80,12 +79,8 @@ WaylandCompositor {
]
onCreateSurface: {
- var surface = surfaceComponent.createObject(compositor, { } );
- surface.initialize(compositor, client, id, version);
-
- }
+ var surface = surfaceComponent.createObject(comp, { } );
+ surface.initialize(comp, client, id, version);
- Component.onCompleted: {
- screenComponent.createObject(compositor, { "outputSpace" : defaultOutputSpace } );
}
}
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index cae304f5b..8d6815924 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -301,6 +301,7 @@ void QWaylandCompositorPrivate::initializeDefaultInputDevice()
{
Q_Q(QWaylandCompositor);
inputDevices.append(q->createInputDevice());
+ q->defaultInputDeviceChanged();
}
void QWaylandCompositorPrivate::loadClientBufferIntegration()
@@ -528,7 +529,9 @@ void QWaylandCompositor::overrideSelection(const QMimeData *data)
QWaylandInputDevice *QWaylandCompositor::defaultInputDevice() const
{
Q_D(const QWaylandCompositor);
- return d->inputDevices.first();
+ if (d->inputDevices.size())
+ return d->inputDevices.first();
+ return Q_NULLPTR;
}
QWaylandInputDevice *QWaylandCompositor::inputDeviceFor(QInputEvent *inputEvent)
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h
index 2413507e9..a6b3cfee8 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -72,7 +72,7 @@ class Q_COMPOSITOR_EXPORT QWaylandCompositor : public QObject, public QWaylandEx
Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled)
Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput NOTIFY defaultOutputChanged)
Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged)
- Q_PROPERTY(QWaylandInputDevice *defaultInputDevice READ defaultInputDevice CONSTANT)
+ Q_PROPERTY(QWaylandInputDevice *defaultInputDevice READ defaultInputDevice NOTIFY defaultInputDeviceChanged)
public:
QWaylandCompositor(QObject *parent = 0);
@@ -123,6 +123,7 @@ Q_SIGNALS:
void surfaceAboutToBeDestroyed(QWaylandSurface *surface);
void defaultOutputChanged();
+ void defaultInputDeviceChanged();
void useHardwareIntegrationExtensionChanged();
protected: