a18cb8998e
Most distros use either systemd's logind or consolekit for session management. The main reason why there's direct session is because up to some point, kwin had a class called VirtualTerminal which was kind of like a direct session backend. The VirtualTerminal was used in the fbdev backend in conjuction with the logind session backend, which looked odd. Since the drm backend supported only logind and consolekit for very long time and we hadn't received any complaints about it, the fact that direct session is unsupported should not be noticeable. Given that, this change removes the support for direct session in order to reduce the amount of platform-specific code and make it easier to maintain kwin.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include "session.h"
|
|
#include "session_consolekit.h"
|
|
#include "session_logind.h"
|
|
#include "session_noop.h"
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
static const struct {
|
|
Session::Type type;
|
|
std::function<Session *(QObject *)> createFunc;
|
|
} s_availableSessions[] = {
|
|
{ Session::Type::Logind, &LogindSession::create },
|
|
{ Session::Type::ConsoleKit, &ConsoleKitSession::create },
|
|
{ Session::Type::Noop, &NoopSession::create },
|
|
};
|
|
|
|
Session::Session(QObject *parent)
|
|
: QObject(parent)
|
|
{
|
|
}
|
|
|
|
Session *Session::create(QObject *parent)
|
|
{
|
|
for (const auto &sessionInfo : s_availableSessions) {
|
|
Session *session = sessionInfo.createFunc(parent);
|
|
if (session) {
|
|
return session;
|
|
}
|
|
}
|
|
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 KWin
|