File indexing completed on 2024-04-28 05:30:24

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 #include "main.h"
0011 #include <KConfigWatcher>
0012 #include <QTimer>
0013 
0014 namespace KWin
0015 {
0016 namespace Xwl
0017 {
0018 class Xwayland;
0019 }
0020 
0021 class ApplicationWayland : public Application
0022 {
0023     Q_OBJECT
0024 public:
0025     ApplicationWayland(int &argc, char **argv);
0026     ~ApplicationWayland() override;
0027 
0028     void setStartXwayland(bool start)
0029     {
0030         m_startXWayland = start;
0031     }
0032     void addXwaylandSocketFileDescriptor(int fd)
0033     {
0034         m_xwaylandListenFds << fd;
0035     }
0036     void setXwaylandDisplay(const QString &display)
0037     {
0038         m_xwaylandDisplay = display;
0039     }
0040     void setXwaylandXauthority(const QString &xauthority)
0041     {
0042         m_xwaylandXauthority = xauthority;
0043     }
0044     void setApplicationsToStart(const QStringList &applications)
0045     {
0046         m_applicationsToStart = applications;
0047     }
0048     void setInputMethodServerToStart(const QString &inputMethodServer)
0049     {
0050         m_inputMethodServerToStart = inputMethodServer;
0051     }
0052     void setSessionArgument(const QString &session)
0053     {
0054         m_sessionArgument = session;
0055     }
0056 
0057     XwaylandInterface *xwayland() const override;
0058 
0059 protected:
0060     void performStartup() override;
0061 
0062 private:
0063     void continueStartupWithScene();
0064     void startSession();
0065     void refreshSettings(const KConfigGroup &group, const QByteArrayList &names);
0066 
0067     bool m_startXWayland = false;
0068     QStringList m_applicationsToStart;
0069     QString m_inputMethodServerToStart;
0070     QString m_sessionArgument;
0071 
0072     std::unique_ptr<Xwl::Xwayland> m_xwayland;
0073     QList<int> m_xwaylandListenFds;
0074     QString m_xwaylandDisplay;
0075     QString m_xwaylandXauthority;
0076     KConfigWatcher::Ptr m_settingsWatcher;
0077 };
0078 
0079 }