KWin
Loading...
Searching...
No Matches
filtered_display.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2017 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "filtered_display.h"
8#include "display.h"
9
10#include <wayland-server.h>
11
12#include <QByteArray>
13
14namespace KWin
15{
17{
18public:
21 static bool globalFilterCallback(const wl_client *client, const wl_global *global, void *data)
22 {
23 auto t = static_cast<FilteredDisplayPrivate *>(data);
24 auto clientConnection = t->q->getConnection(const_cast<wl_client *>(client));
25 auto interface = wl_global_get_interface(global);
26 auto name = QByteArray::fromRawData(interface->name, strlen(interface->name));
27 return t->q->allowInterface(clientConnection, name);
28 };
29};
30
35
37 : Display(parent)
38 , d(new FilteredDisplayPrivate(this))
39{
40 connect(this, &Display::runningChanged, [this](bool running) {
41 if (!running) {
42 return;
43 }
44 wl_display_set_global_filter(*this, FilteredDisplayPrivate::globalFilterCallback, d.get());
45 });
46}
47
51
52}
53
54#include "moc_filtered_display.cpp"
Class holding the Wayland server display loop.
Definition display.h:34
bool running
Definition display.h:36
ClientConnection * getConnection(wl_client *client)
Definition display.cpp:200
FilteredDisplay(QObject *parent)
static bool globalFilterCallback(const wl_client *client, const wl_global *global, void *data)
FilteredDisplayPrivate(FilteredDisplay *_q)