Skip to content

Commit

Permalink
Logind session implementation
Browse files Browse the repository at this point in the history
Add Logind support to AuroraPlatform.
  • Loading branch information
plfiorini committed Jan 21, 2024
1 parent 056832d commit 211a13c
Show file tree
Hide file tree
Showing 5 changed files with 427 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ liri_add_module(AuroraPlatform
outputsmodel.cpp outputsmodel.h outputsmodel_p.h
pointerdevice.cpp pointerdevice.h
session.cpp session.h
session_logind.cpp session_logind_p.h
session_noop.cpp session_noop_p.h
touchdevice.cpp touchdevice.h
window.cpp window.h window_p.h
Expand All @@ -36,6 +37,7 @@ liri_add_module(AuroraPlatform
EGL::EGL
PUBLIC_LIBRARIES
Qt6::Core
Qt6::DBus
Qt6::Gui
Qt6::Qml
)
Expand Down
12 changes: 12 additions & 0 deletions src/platform/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "session.h"
#include "session_noop_p.h"
#include "session_logind_p.h"

namespace Aurora {

Expand Down Expand Up @@ -108,6 +109,7 @@ static const struct
Session::Type type;
std::function<Session *(QObject *parent)> createFunc;
} s_availableSessions[] = {
{ Session::Type::Logind, &LogindSession::create },
{ Session::Type::Noop, &NoopSession::create },
};

Expand All @@ -127,6 +129,16 @@ Session *Session::create(QObject *parent)
return nullptr;
}

Session *Session::create(Type type, QObject *parent)
{
for (const auto &sessionInfo : s_availableSessions) {
if (sessionInfo.type == type)
return sessionInfo.createFunc(parent);
}

return nullptr;
}

} // namespace Platform

} // namespace Aurora
2 changes: 2 additions & 0 deletions src/platform/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class LIRIAURORAPLATFORM_EXPORT Session : public QObject

enum class Type {
Noop,
Logind,
};
Q_ENUM(Type)

Expand All @@ -44,6 +45,7 @@ class LIRIAURORAPLATFORM_EXPORT Session : public QObject
virtual void switchTo(uint terminal) = 0;

static Session *create(QObject *parent = nullptr);
static Session *create(Type type, QObject *parent = nullptr);

Q_SIGNALS:
void activeChanged(bool active);
Expand Down
Loading

0 comments on commit 211a13c

Please sign in to comment.