From 35d601bb23ffb11489525b1968a636a288114fb6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 5 Apr 2021 11:28:20 +0300 Subject: [PATCH] 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. --- src/wayland/filtered_display.cpp | 12 ++++++------ src/wayland/filtered_display.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wayland/filtered_display.cpp b/src/wayland/filtered_display.cpp index 4ca8bdd26c..e7cb4716b2 100644 --- a/src/wayland/filtered_display.cpp +++ b/src/wayland/filtered_display.cpp @@ -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(data); + auto t = static_cast(data); auto clientConnection = t->q->getConnection(const_cast(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()); }); } diff --git a/src/wayland/filtered_display.h b/src/wayland/filtered_display.h index 7623790801..0e6aca40d1 100644 --- a/src/wayland/filtered_display.h +++ b/src/wayland/filtered_display.h @@ -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 d; + QScopedPointer d; }; }