KWin
Loading...
Searching...
No Matches
session.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "session.h"
9#include "session_logind.h"
10#include "session_noop.h"
11
12namespace KWin
13{
14
15static const struct
16{
18 std::function<std::unique_ptr<Session>()> createFunc;
19} s_availableSessions[] = {
23};
24
25std::unique_ptr<Session> Session::create()
26{
27 for (const auto &sessionInfo : s_availableSessions) {
28 std::unique_ptr<Session> session = sessionInfo.createFunc();
29 if (session) {
30 return session;
31 }
32 }
33 return nullptr;
34}
35
36std::unique_ptr<Session> Session::create(Type type)
37{
38 for (const auto &sessionInfo : s_availableSessions) {
39 if (sessionInfo.type == type) {
40 return sessionInfo.createFunc();
41 }
42 }
43 return nullptr;
44}
45
46} // namespace KWin
47
48#include "moc_session.cpp"
static std::unique_ptr< ConsoleKitSession > create()
static std::unique_ptr< LogindSession > create()
static std::unique_ptr< NoopSession > create()
static std::unique_ptr< Session > create()
Definition session.cpp:25
Session::Type type
Definition session.cpp:17
std::function< std::unique_ptr< Session >()> createFunc
Definition session.cpp:18