Skip to content
Snippets Groups Projects
Commit 410b9b56 authored by Felix Gerking's avatar Felix Gerking
Browse files

Config:systemd: Invoke systemd notify when the compositor is ready

Now the compositor calls systemd notify READY=1 when surfaces can be
created. This allows the use of a systemd notify type start script.

BCS 746-000824
parent 90de0c44
No related branches found
No related tags found
1 merge request!32Config:systemd: Invoke systemd notify when the compositor is ready
......@@ -3,6 +3,7 @@
#include <QDebug>
#include <QRegularExpression>
#include <QFile>
#include <systemd/sd-daemon.h>
void Config::setRotation(const QString &str)
{
......@@ -76,3 +77,9 @@ inline bool Config::rotationIsValid(const QString * rotation )
QStringList validRotations = {"0", "90", "180", "270"};
return validRotations.contains(*rotation);
}
void Config::notifyCompositorReady()
{
qDebug() << "Notify systemd that the compositor is ready";
sd_notify(false, "READY=1");
}
......@@ -12,6 +12,7 @@ public:
void setRotation(const QString &str);
QString rotation() const;
Q_INVOKABLE void notifyCompositorReady();
private:
QString m_rotation;
static const QRegularExpression findRotation;
......
......@@ -13,6 +13,9 @@ HEADERS += \
message-server.h \
message-serverconnection.h
LIBS += \
-lsystemd
OTHER_FILES = \
qml/main.qml \
......
......@@ -110,6 +110,15 @@ WaylandCompositor {
onIviSurfaceCreated: handleIviSurfaceCreated(iviSurface)
}
// =============================================
// We need to notify systemd when the compositor
// is ready to create surfaces
// =============================================
onCreatedChanged: {
if (created === true) {
config.notifyCompositorReady();
}
}
onSurfaceRequested: {
console.log("Surface requested", client, id, version);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment