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.
This commit is contained in:
parent
f119c9470d
commit
35d601bb23
2 changed files with 9 additions and 8 deletions
|
@ -14,14 +14,14 @@
|
||||||
namespace KWaylandServer
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
|
|
||||||
class FilteredDisplay::Private
|
class FilteredDisplayPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(FilteredDisplay *_q);
|
FilteredDisplayPrivate(FilteredDisplay *_q);
|
||||||
FilteredDisplay *q;
|
FilteredDisplay *q;
|
||||||
static bool globalFilterCallback(const wl_client *client, const wl_global *global, void *data)
|
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 clientConnection = t->q->getConnection(const_cast<wl_client *>(client));
|
||||||
auto interface = wl_global_get_interface(global);
|
auto interface = wl_global_get_interface(global);
|
||||||
auto name = QByteArray::fromRawData(interface->name, strlen(interface->name));
|
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)
|
: q(_q)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FilteredDisplay::FilteredDisplay(QObject *parent)
|
FilteredDisplay::FilteredDisplay(QObject *parent)
|
||||||
: Display(parent)
|
: Display(parent)
|
||||||
, d(new Private(this))
|
, d(new FilteredDisplayPrivate(this))
|
||||||
{
|
{
|
||||||
connect(this, &Display::runningChanged, [this](bool running) {
|
connect(this, &Display::runningChanged, [this](bool running) {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return;
|
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
|
namespace KWaylandServer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class FilteredDisplayPrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Implementation that allows one to restrict which globals are available to which clients
|
* 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;
|
virtual bool allowInterface(ClientConnection *client, const QByteArray &interfaceName) = 0;
|
||||||
private:
|
private:
|
||||||
class Private;
|
QScopedPointer<FilteredDisplayPrivate> d;
|
||||||
QScopedPointer<Private> d;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue