2020-12-09 20:13:19 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wayland-server-core.h>
|
|
|
|
|
2023-11-13 09:51:28 +00:00
|
|
|
#include "utils/filedescriptor.h"
|
2020-12-09 20:13:19 +00:00
|
|
|
#include <QList>
|
|
|
|
#include <QSocketNotifier>
|
|
|
|
#include <QString>
|
|
|
|
|
2021-07-20 17:02:13 +00:00
|
|
|
struct wl_resource;
|
|
|
|
|
2023-09-13 17:59:29 +00:00
|
|
|
namespace KWin
|
2020-12-09 20:13:19 +00:00
|
|
|
{
|
|
|
|
class ClientConnection;
|
|
|
|
class Display;
|
|
|
|
class OutputInterface;
|
2021-07-23 14:12:28 +00:00
|
|
|
class OutputDeviceV2Interface;
|
2020-12-09 20:13:19 +00:00
|
|
|
class SeatInterface;
|
|
|
|
|
|
|
|
class DisplayPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static DisplayPrivate *get(Display *display);
|
|
|
|
DisplayPrivate(Display *q);
|
|
|
|
|
|
|
|
void registerSocketName(const QString &socketName);
|
|
|
|
|
|
|
|
Display *q;
|
|
|
|
QSocketNotifier *socketNotifier = nullptr;
|
|
|
|
wl_display *display = nullptr;
|
|
|
|
wl_event_loop *loop = nullptr;
|
|
|
|
bool running = false;
|
|
|
|
QList<OutputInterface *> outputs;
|
2021-07-23 14:12:28 +00:00
|
|
|
QList<OutputDeviceV2Interface *> outputdevicesV2;
|
2023-10-19 06:50:15 +00:00
|
|
|
QList<SeatInterface *> seats;
|
|
|
|
QList<ClientConnection *> clients;
|
2020-12-09 20:13:19 +00:00
|
|
|
QStringList socketNames;
|
|
|
|
};
|
|
|
|
|
2023-11-13 09:51:28 +00:00
|
|
|
/**
|
|
|
|
* @brief The SecurityContext is a helper for the SecurityContextProtocol
|
|
|
|
* It stays alive whilst closeFd remains open, listening for new connections on listenFd
|
|
|
|
* Any new clients created via listenFd are tagged with the appId
|
|
|
|
* It is parented to the display
|
|
|
|
*/
|
|
|
|
class SecurityContext : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
SecurityContext(Display *display, FileDescriptor &&listenFd, FileDescriptor &&closeFd, const QString &appId);
|
|
|
|
~SecurityContext() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void onCloseFdActivated();
|
|
|
|
void onListenFdActivated(QSocketDescriptor descriptor);
|
|
|
|
Display *m_display;
|
|
|
|
FileDescriptor m_listenFd;
|
|
|
|
FileDescriptor m_closeFd;
|
|
|
|
QString m_appId;
|
|
|
|
};
|
|
|
|
|
2023-09-13 17:59:29 +00:00
|
|
|
} // namespace KWin
|