2
* Copyright (C) 2015-2016 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef QMIRSERVER_P_H
18
#define QMIRSERVER_P_H
22
#include <QSharedPointer>
25
#include <condition_variable>
29
#include "openglcontextfactory.h"
30
#include "screensmodel.h"
31
#include "windowcontroller.h"
32
#include "windowmodelnotifier.h"
33
#include "sessionauthorizer.h"
34
#include "mirserverhooks.h"
37
#include <miral/application_authorizer.h>
38
#include <miral/runner.h>
40
class MirServerThread;
45
using SetSessionAuthorizer = miral::SetApplicationAuthorizer<SessionAuthorizer>;
48
class QMirServerPrivate
51
QMirServerPrivate(int argc, char* argv[]);
52
const QSharedPointer<ScreensModel> screensModel{new ScreensModel()};
53
QSharedPointer<ScreensController> screensController;
54
MirServerThread *serverThread;
56
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
58
void run(const std::function<void()> &startCallback);
61
SessionListener *sessionListener() const;
62
PromptSessionListener *promptSessionListener() const;
63
std::shared_ptr<mir::scene::PromptSessionManager> promptSessionManager() const;
65
std::shared_ptr<SessionAuthorizer> theApplicationAuthorizer() const
66
{ return m_sessionAuthorizer.the_custom_application_authorizer(); }
68
qtmir::WindowModelNotifierInterface *windowModelNotifier() const
69
{ return &m_windowModelNotifier; }
71
qtmir::WindowControllerInterface *windowController() const
72
{ return &m_windowController; }
75
qtmir::SetSessionAuthorizer m_sessionAuthorizer;
76
qtmir::OpenGLContextFactory m_openGLContextFactory;
77
qtmir::MirServerHooks m_mirServerHooks;
79
miral::MirRunner runner;
81
mutable qtmir::WindowModelNotifier m_windowModelNotifier;
82
mutable qtmir::WindowController m_windowController;
87
class MirServerThread : public QThread
92
MirServerThread(QMirServerPrivate* server)
96
bool waitForMirStartup();
106
std::condition_variable started_cv;
107
bool mir_running{false};
109
QMirServerPrivate* const server;
112
#endif // QMIRSERVER_P_H