| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include "utils/filedescriptor.h" |
| 14 |
|
| 15 |
#include <QList> |
| 16 |
#include <QMap> |
| 17 |
#include <QObject> |
| 18 |
#include <QProcess> |
| 19 |
#include <QSocketNotifier> |
| 20 |
#include <QTemporaryFile> |
| 21 |
#include <memory> |
| 22 |
|
| 23 |
#include <kwin_export.h> |
| 24 |
|
| 25 |
class QTimer; |
| 26 |
|
| 27 |
namespace KWin |
| 28 |
{ |
| 29 |
|
| 30 |
class XwaylandSocket; |
| 31 |
|
| 32 |
namespace Xwl |
| 33 |
{ |
| 34 |
|
| 35 |
class KWIN_EXPORT XwaylandLauncher : public QObject |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
explicit XwaylandLauncher(); |
| 41 |
~XwaylandLauncher(); |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
void setListenFDs(const QList<int> &listenFds); |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
void setDisplayName(const QString &displayName); |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
void setXauthority(const QString &xauthority); |
| 63 |
|
| 64 |
void addEnvironmentVariables(const QMap<QString, QString> &extraEnvironment); |
| 65 |
|
| 66 |
void passFileDescriptors(std::vector<FileDescriptor> &&fds); |
| 67 |
|
| 68 |
void enable(); |
| 69 |
void disable(); |
| 70 |
bool start(); |
| 71 |
void stop(); |
| 72 |
|
| 73 |
QString displayName() const; |
| 74 |
QString xauthority() const; |
| 75 |
FileDescriptor takeXcbConnectionFd(); |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
QProcess *process() const; |
| 81 |
Q_SIGNALS: |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
void ready(); |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
void started(); |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
void finished(); |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
void errorOccurred(); |
| 98 |
|
| 99 |
private Q_SLOTS: |
| 100 |
void resetCrashCount(); |
| 101 |
void handleXwaylandFinished(int exitCode, QProcess::ExitStatus exitStatus); |
| 102 |
void handleXwaylandError(QProcess::ProcessError error); |
| 103 |
|
| 104 |
private: |
| 105 |
std::unique_ptr<QProcess> m_xwaylandProcess; |
| 106 |
std::unique_ptr<QSocketNotifier> m_readyNotifier; |
| 107 |
std::unique_ptr<QTimer> m_resetCrashCountTimer; |
| 108 |
|
| 109 |
std::unique_ptr<XwaylandSocket> m_socket; |
| 110 |
QList<int> m_listenFds; |
| 111 |
std::vector<std::unique_ptr<QSocketNotifier>> m_socketNotifiers; |
| 112 |
QString m_displayName; |
| 113 |
QString m_xAuthority; |
| 114 |
QMap<QString, QString> m_extraEnvironment; |
| 115 |
std::vector<FileDescriptor> m_fdsToPreserve; |
| 116 |
|
| 117 |
bool m_enabled = false; |
| 118 |
int m_crashCount = 0; |
| 119 |
FileDescriptor m_readyFd; |
| 120 |
FileDescriptor m_xcbConnectionFd; |
| 121 |
}; |
| 122 |
|
| 123 |
} |
| 124 |
} |