Commit 4f4ecaa2 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Don't use nested private class in FilteredDisplay

The usage of nested private classes is highly discouraged in
kwaylandserver due to various reasons, e.g. it's easy to forget to put
Q_DECL_HIDDEN, etc.
parent 0998d679
Pipeline #56631 passed with stage
in 7 minutes and 27 seconds
......@@ -14,14 +14,14 @@
namespace KWaylandServer
{
class FilteredDisplay::Private
class FilteredDisplayPrivate
{
public:
Private(FilteredDisplay *_q);
FilteredDisplayPrivate(FilteredDisplay *_q);
FilteredDisplay *q;
static bool globalFilterCallback(const wl_client *client, const wl_global *global, void *data)
{
auto t = static_cast<FilteredDisplay::Private *>(data);
auto t = static_cast<FilteredDisplayPrivate *>(data);
auto clientConnection = t->q->getConnection(const_cast<wl_client *>(client));
auto interface = wl_global_get_interface(global);
auto name = QByteArray::fromRawData(interface->name, strlen(interface->name));
......@@ -29,20 +29,20 @@ public:
};
};
FilteredDisplay::Private::Private(FilteredDisplay *_q)
FilteredDisplayPrivate::FilteredDisplayPrivate(FilteredDisplay *_q)
: q(_q)
{
}
FilteredDisplay::FilteredDisplay(QObject *parent)
: Display(parent)
, d(new Private(this))
, d(new FilteredDisplayPrivate(this))
{
connect(this, &Display::runningChanged, [this](bool running) {
if (!running) {
return;
}
wl_display_set_global_filter(*this, Private::globalFilterCallback, d.data());
wl_display_set_global_filter(*this, FilteredDisplayPrivate::globalFilterCallback, d.data());
});
}
......
......@@ -13,6 +13,8 @@
namespace KWaylandServer
{
class FilteredDisplayPrivate;
/**
* Server Implementation that allows one to restrict which globals are available to which clients
*
......@@ -35,8 +37,7 @@ public:
*/
virtual bool allowInterface(ClientConnection *client, const QByteArray &interfaceName) = 0;
private:
class Private;
QScopedPointer<Private> d;
QScopedPointer<FilteredDisplayPrivate> d;
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment