KWin
Loading...
Searching...
No Matches
xwaylandlauncher.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
6 SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#pragma once
12
13#include <QList>
14#include <QObject>
15#include <QProcess>
16#include <QSocketNotifier>
17#include <QTemporaryFile>
18#include <memory>
19
20#include <kwin_export.h>
21
22class QTimer;
23
24namespace KWin
25{
26class XwaylandSocket;
27
28namespace Xwl
29{
30
31class KWIN_EXPORT XwaylandLauncher : public QObject
32{
33 Q_OBJECT
34public:
35 explicit XwaylandLauncher(QObject *parent);
37
44 void setListenFDs(const QList<int> &listenFds);
45
51 void setDisplayName(const QString &displayName);
52
57 void setXauthority(const QString &xauthority);
58
59 void enable();
60 void disable();
61 bool start();
62 void stop();
63
64 QString displayName() const;
65 QString xauthority() const;
66 int xcbConnectionFd() const;
67
71 QProcess *process() const;
72Q_SIGNALS:
78 void started();
82 void finished();
87
88private Q_SLOTS:
89 void resetCrashCount();
90 void handleXwaylandFinished(int exitCode, QProcess::ExitStatus exitStatus);
91 void handleXwaylandError(QProcess::ProcessError error);
92
93private:
94 void maybeDestroyReadyNotifier();
95
96
97 QProcess *m_xwaylandProcess = nullptr;
98 QSocketNotifier *m_readyNotifier = nullptr;
99 QTimer *m_resetCrashCountTimer = nullptr;
100 // this is only used when kwin is run without kwin_wayland_wrapper
101 std::unique_ptr<XwaylandSocket> m_socket;
102 QList<int> m_listenFds;
103 QString m_displayName;
104 QString m_xAuthority;
105
106 bool m_enabled = false;
107 int m_crashCount = 0;
108 int m_xcbConnectionFd = -1;
109};
110
111}
112}