summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2016-09-16 06:52:09 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>2016-09-20 08:26:06 +0000
commit5f256690a1e953ed456988b83daf43139b828131 (patch)
treec4d0e1e9fd6e2dc615701b9562e2edb36fdd69dc /src/compositor
parentb248defd1741cd443dd1e5050fe5143e8650a7c7 (diff)
Emit signals for compositor properties
Allow property binding from QML and add a created property that is set to true after the initialization. Change-Id: I923eedc793660b4ea18372eb0182eae0bcca436d Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp25
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h9
2 files changed, 31 insertions, 3 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 391b39416..732e607bc 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -210,6 +210,8 @@ void QWaylandCompositorPrivate::init()
QCoreApplication::sendEvent(object.data(), &polishEvent);
}
}
+
+ emit q->createdChanged();
}
QWaylandCompositorPrivate::~QWaylandCompositorPrivate()
@@ -471,7 +473,17 @@ void QWaylandCompositor::create()
}
/*!
- * Returns true if the QWaylandCompositor has been initialized. Otherwise returns false.
+ * \qmlproperty bool QtWaylandCompositor::WaylandCompositor::created
+ *
+ * This property is true if WaylandCompositor has been initialized,
+ * otherwise it's false.
+ */
+
+/*!
+ * \property QWaylandCompositor::created
+ *
+ * This property is true if QWaylandCompositor has been initialized,
+ * otherwise it's false.
*/
bool QWaylandCompositor::isCreated() const
{
@@ -503,11 +515,17 @@ bool QWaylandCompositor::isCreated() const
void QWaylandCompositor::setSocketName(const QByteArray &name)
{
Q_D(QWaylandCompositor);
+
+ if (d->socket_name == name)
+ return;
+
if (d->initialized) {
qWarning("%s: Changing socket name after initializing the compositor is not supported.\n", Q_FUNC_INFO);
return;
}
+
d->socket_name = name;
+ emit socketNameChanged(name);
}
QByteArray QWaylandCompositor::socketName() const
@@ -728,7 +746,12 @@ QWaylandTouch *QWaylandCompositor::createTouchDevice(QWaylandSeat *seat)
void QWaylandCompositor::setRetainedSelectionEnabled(bool enabled)
{
Q_D(QWaylandCompositor);
+
+ if (d->retainSelection == enabled)
+ return;
+
d->retainSelection = enabled;
+ emit retainedSelectionChanged(enabled);
}
bool QWaylandCompositor::retainedSelectionEnabled() const
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h
index 15022b378..8b190d1d2 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -73,8 +73,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandCompositor)
- Q_PROPERTY(QByteArray socketName READ socketName WRITE setSocketName)
- Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled)
+ Q_PROPERTY(QByteArray socketName READ socketName WRITE setSocketName NOTIFY socketNameChanged)
+ Q_PROPERTY(bool created READ isCreated NOTIFY createdChanged)
+ Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled NOTIFY retainedSelectionChanged)
Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput WRITE setDefaultOutput NOTIFY defaultOutputChanged)
Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged)
Q_PROPERTY(QWaylandSeat *defaultSeat READ defaultSeat NOTIFY defaultSeatChanged)
@@ -126,6 +127,10 @@ public Q_SLOTS:
void processWaylandEvents();
Q_SIGNALS:
+ void createdChanged();
+ void socketNameChanged(const QByteArray &socketName);
+ void retainedSelectionChanged(bool retainedSelection);
+
void surfaceRequested(QWaylandClient *client, uint id, int version);
void surfaceCreated(QWaylandSurface *surface);
void surfaceAboutToBeDestroyed(QWaylandSurface *surface);