File indexing completed on 2024-05-19 05:32:34
0001 /* 0002 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0003 SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #pragma once 0009 0010 #include <wayland-server-core.h> 0011 0012 #include "utils/filedescriptor.h" 0013 #include <QList> 0014 #include <QSocketNotifier> 0015 #include <QString> 0016 0017 struct wl_resource; 0018 0019 namespace KWin 0020 { 0021 class ClientConnection; 0022 class Display; 0023 class OutputInterface; 0024 class OutputDeviceV2Interface; 0025 class SeatInterface; 0026 0027 class DisplayPrivate 0028 { 0029 public: 0030 static DisplayPrivate *get(Display *display); 0031 DisplayPrivate(Display *q); 0032 0033 void registerSocketName(const QString &socketName); 0034 0035 Display *q; 0036 QSocketNotifier *socketNotifier = nullptr; 0037 wl_display *display = nullptr; 0038 wl_event_loop *loop = nullptr; 0039 bool running = false; 0040 QList<OutputInterface *> outputs; 0041 QList<OutputDeviceV2Interface *> outputdevicesV2; 0042 QList<SeatInterface *> seats; 0043 QList<ClientConnection *> clients; 0044 QStringList socketNames; 0045 }; 0046 0047 /** 0048 * @brief The SecurityContext is a helper for the SecurityContextProtocol 0049 * It stays alive whilst closeFd remains open, listening for new connections on listenFd 0050 * Any new clients created via listenFd are tagged with the appId 0051 * It is parented to the display 0052 */ 0053 class SecurityContext : public QObject 0054 { 0055 Q_OBJECT 0056 public: 0057 SecurityContext(Display *display, FileDescriptor &&listenFd, FileDescriptor &&closeFd, const QString &appId); 0058 ~SecurityContext() override; 0059 0060 private: 0061 void onCloseFdActivated(); 0062 void onListenFdActivated(QSocketDescriptor descriptor); 0063 Display *m_display; 0064 FileDescriptor m_listenFd; 0065 FileDescriptor m_closeFd; 0066 QString m_appId; 0067 }; 0068 0069 } // namespace KWin