diff --git a/src/compositor/compositor_api/aurorawaylandclient.cpp b/src/compositor/compositor_api/aurorawaylandclient.cpp index 0dc0051e7..aaf6918ad 100644 --- a/src/compositor/compositor_api/aurorawaylandclient.cpp +++ b/src/compositor/compositor_api/aurorawaylandclient.cpp @@ -41,7 +41,7 @@ namespace Aurora { namespace Compositor { -class WaylandClientPrivate : public QObjectPrivate +class WaylandClientPrivate { public: WaylandClientPrivate(WaylandCompositor *compositor, wl_client *_client) @@ -52,10 +52,6 @@ class WaylandClientPrivate : public QObjectPrivate wl_client_get_credentials(client, &pid, &uid, &gid); } - ~WaylandClientPrivate() override - { - } - static void client_destroy_callback(wl_listener *listener, void *data) { Q_UNUSED(data); @@ -106,7 +102,8 @@ class WaylandClientPrivate : public QObjectPrivate * Constructs a WaylandClient for the \a compositor and the Wayland \a client. */ WaylandClient::WaylandClient(WaylandCompositor *compositor, wl_client *client) - : QObject(*new WaylandClientPrivate(compositor, client)) + : QObject() + , d_ptr(new WaylandClientPrivate(compositor, client)) { Q_D(WaylandClient); diff --git a/src/compositor/compositor_api/aurorawaylandclient.h b/src/compositor/compositor_api/aurorawaylandclient.h index 98ece1b73..bc662694d 100644 --- a/src/compositor/compositor_api/aurorawaylandclient.h +++ b/src/compositor/compositor_api/aurorawaylandclient.h @@ -95,6 +95,8 @@ public Q_SLOTS: void close(); private: + QScopedPointer const d_ptr; + explicit WaylandClient(WaylandCompositor *compositor, wl_client *client); }; diff --git a/src/compositor/compositor_api/aurorawaylandcompositor.cpp b/src/compositor/compositor_api/aurorawaylandcompositor.cpp index fd3c7d1da..e9bd83668 100644 --- a/src/compositor/compositor_api/aurorawaylandcompositor.cpp +++ b/src/compositor/compositor_api/aurorawaylandcompositor.cpp @@ -162,6 +162,7 @@ class WindowSystemEventHandler : public QWindowSystemEventHandler } // namespace WaylandCompositorPrivate::WaylandCompositorPrivate(WaylandCompositor *compositor) + : q_ptr(compositor) { if (QGuiApplication::platformNativeInterface()) display = static_cast(QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("server_wl_display")); @@ -569,16 +570,8 @@ WaylandSeat *WaylandCompositorPrivate::seatFor(QInputEvent *inputEvent) * Constructs a WaylandCompositor with the given \a parent. */ WaylandCompositor::WaylandCompositor(QObject *parent) - : WaylandObject(*new WaylandCompositorPrivate(this), parent) -{ -} - -/*! - * \internal - * Constructs a WaylandCompositor with the private object \a dptr and \a parent. - */ -WaylandCompositor::WaylandCompositor(WaylandCompositorPrivate &dptr, QObject *parent) - : WaylandObject(dptr, parent) + : WaylandObject(parent) + , d_ptr(new WaylandCompositorPrivate(this)) { } diff --git a/src/compositor/compositor_api/aurorawaylandcompositor.h b/src/compositor/compositor_api/aurorawaylandcompositor.h index 9edc06cda..ab52085df 100644 --- a/src/compositor/compositor_api/aurorawaylandcompositor.h +++ b/src/compositor/compositor_api/aurorawaylandcompositor.h @@ -182,7 +182,8 @@ private Q_SLOTS: virtual WaylandKeyboard *createKeyboardDevice(WaylandSeat *seat); virtual WaylandTouch *createTouchDevice(WaylandSeat *seat); - WaylandCompositor(WaylandCompositorPrivate &dptr, QObject *parent = nullptr); +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandcompositor_p.h b/src/compositor/compositor_api/aurorawaylandcompositor_p.h index 64483ccaf..d56a317b3 100644 --- a/src/compositor/compositor_api/aurorawaylandcompositor_p.h +++ b/src/compositor/compositor_api/aurorawaylandcompositor_p.h @@ -72,7 +72,7 @@ namespace Internal { class WaylandSurface; -class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorPrivate : public QObjectPrivate, public PrivateServer::wl_compositor, public PrivateServer::wl_subcompositor +class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorPrivate : public PrivateServer::wl_compositor, public PrivateServer::wl_subcompositor { public: static WaylandCompositorPrivate *get(WaylandCompositor *compositor) { return compositor->d_func(); } @@ -177,6 +177,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorPrivate : public QObjectPriva Q_DECLARE_PUBLIC(WaylandCompositor) Q_DISABLE_COPY(WaylandCompositorPrivate) + +private: + WaylandCompositor *q_ptr = nullptr; }; const QList WaylandCompositorPrivate::clientBufferIntegrations() const diff --git a/src/compositor/compositor_api/aurorawaylanddestroylistener.cpp b/src/compositor/compositor_api/aurorawaylanddestroylistener.cpp index 07d0b9191..6040e0e54 100644 --- a/src/compositor/compositor_api/aurorawaylanddestroylistener.cpp +++ b/src/compositor/compositor_api/aurorawaylanddestroylistener.cpp @@ -34,7 +34,8 @@ namespace Aurora { namespace Compositor { -WaylandDestroyListenerPrivate::WaylandDestroyListenerPrivate() +WaylandDestroyListenerPrivate::WaylandDestroyListenerPrivate(WaylandDestroyListener *self) + : q_ptr(self) { listener.parent = this; listener.listener.notify = handler; @@ -42,9 +43,15 @@ WaylandDestroyListenerPrivate::WaylandDestroyListenerPrivate() } WaylandDestroyListener::WaylandDestroyListener(QObject *parent) - : QObject(* new WaylandDestroyListenerPrivate(), parent) + : QObject(parent) + , d_ptr(new WaylandDestroyListenerPrivate(this)) { } + +WaylandDestroyListener::~WaylandDestroyListener() +{ +} + void WaylandDestroyListener::listenForDestruction(::wl_resource *resource) { Q_D(WaylandDestroyListener); diff --git a/src/compositor/compositor_api/aurorawaylanddestroylistener.h b/src/compositor/compositor_api/aurorawaylanddestroylistener.h index ced16f4b1..a9b40eaac 100644 --- a/src/compositor/compositor_api/aurorawaylanddestroylistener.h +++ b/src/compositor/compositor_api/aurorawaylanddestroylistener.h @@ -48,12 +48,16 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandDestroyListener : public QObject Q_DECLARE_PRIVATE(WaylandDestroyListener) public: WaylandDestroyListener(QObject *parent = nullptr); + ~WaylandDestroyListener(); + void listenForDestruction(struct wl_resource *resource); void reset(); Q_SIGNALS: void fired(void *data); +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylanddestroylistener_p.h b/src/compositor/compositor_api/aurorawaylanddestroylistener_p.h index 09cdb7805..cd4146027 100644 --- a/src/compositor/compositor_api/aurorawaylanddestroylistener_p.h +++ b/src/compositor/compositor_api/aurorawaylanddestroylistener_p.h @@ -43,20 +43,18 @@ #include -#include - #include namespace Aurora { namespace Compositor { -class WaylandDestroyListenerPrivate : public QObjectPrivate +class WaylandDestroyListenerPrivate { public: Q_DECLARE_PUBLIC(WaylandDestroyListener) - WaylandDestroyListenerPrivate(); + WaylandDestroyListenerPrivate(WaylandDestroyListener *self); static void handler(wl_listener *listener, void *data); @@ -65,6 +63,9 @@ class WaylandDestroyListenerPrivate : public QObjectPrivate WaylandDestroyListenerPrivate *parent = nullptr; }; Listener listener; + +private: + WaylandDestroyListener *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylanddrag.cpp b/src/compositor/compositor_api/aurorawaylanddrag.cpp index bdd5274de..033d9fcf4 100644 --- a/src/compositor/compositor_api/aurorawaylanddrag.cpp +++ b/src/compositor/compositor_api/aurorawaylanddrag.cpp @@ -42,7 +42,7 @@ namespace Aurora { namespace Compositor { -class WaylandDragPrivate : public QObjectPrivate +class WaylandDragPrivate { public: WaylandDragPrivate(WaylandSeat *seat) @@ -64,7 +64,12 @@ class WaylandDragPrivate : public QObjectPrivate }; WaylandDrag::WaylandDrag(WaylandSeat *seat) - : QObject(* new WaylandDragPrivate(seat)) + : QObject() + , d_ptr(new WaylandDragPrivate(seat)) +{ +} + +WaylandDrag::~WaylandDrag() { } diff --git a/src/compositor/compositor_api/aurorawaylanddrag.h b/src/compositor/compositor_api/aurorawaylanddrag.h index 797fed63f..275630143 100644 --- a/src/compositor/compositor_api/aurorawaylanddrag.h +++ b/src/compositor/compositor_api/aurorawaylanddrag.h @@ -59,6 +59,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandDrag : public QObject #endif public: explicit WaylandDrag(WaylandSeat *seat); + ~WaylandDrag(); WaylandSurface *icon() const; WaylandSurface *origin() const; @@ -73,6 +74,9 @@ public Q_SLOTS: Q_SIGNALS: void iconChanged(); void dragStarted(); // WaylandSurface *icon???? + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.cpp index f057f011b..e41fb4e7a 100644 --- a/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.cpp +++ b/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.cpp @@ -47,7 +47,8 @@ namespace Aurora { namespace Compositor { WaylandInputMethodControl::WaylandInputMethodControl(WaylandSurface *surface) - : QObject(*new WaylandInputMethodControlPrivate(surface), surface) + : QObject(surface) + , d_ptr(new WaylandInputMethodControlPrivate(this, surface)) { connect(d_func()->compositor, &WaylandCompositor::defaultSeatChanged, this, &WaylandInputMethodControl::defaultSeatChanged); @@ -71,6 +72,10 @@ WaylandInputMethodControl::WaylandInputMethodControl(WaylandSurface *surface) } } +WaylandInputMethodControl::~WaylandInputMethodControl() +{ +} + QVariant WaylandInputMethodControl::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const { Q_D(const WaylandInputMethodControl); @@ -217,8 +222,9 @@ void WaylandInputMethodControl::defaultSeatChanged() || (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface))); } -WaylandInputMethodControlPrivate::WaylandInputMethodControlPrivate(WaylandSurface *surface) - : compositor(surface->compositor()) +WaylandInputMethodControlPrivate::WaylandInputMethodControlPrivate(WaylandInputMethodControl *self, WaylandSurface *surface) + : q_ptr(self) + , compositor(surface->compositor()) , seat(compositor->defaultSeat()) , surface(surface) { diff --git a/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.h b/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.h index 51776e07b..a3106adc2 100644 --- a/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.h +++ b/src/compositor/compositor_api/aurorawaylandinputmethodcontrol.h @@ -53,6 +53,7 @@ class WaylandInputMethodControl : public QObject Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) public: explicit WaylandInputMethodControl(WaylandSurface *surface); + ~WaylandInputMethodControl(); QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; @@ -69,6 +70,8 @@ class WaylandInputMethodControl : public QObject void updateInputMethod(Qt::InputMethodQueries queries); private: + QScopedPointer const d_ptr; + void defaultSeatChanged(); void surfaceEnabled(WaylandSurface *surface); void surfaceDisabled(WaylandSurface *surface); diff --git a/src/compositor/compositor_api/aurorawaylandinputmethodcontrol_p.h b/src/compositor/compositor_api/aurorawaylandinputmethodcontrol_p.h index f11355a07..4ff05a8fa 100644 --- a/src/compositor/compositor_api/aurorawaylandinputmethodcontrol_p.h +++ b/src/compositor/compositor_api/aurorawaylandinputmethodcontrol_p.h @@ -59,12 +59,12 @@ class WaylandTextInputV4; #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP class WaylandQtTextInputMethod; -class LIRIAURORACOMPOSITOR_EXPORT WaylandInputMethodControlPrivate : public QObjectPrivate +class LIRIAURORACOMPOSITOR_EXPORT WaylandInputMethodControlPrivate { Q_DECLARE_PUBLIC(WaylandInputMethodControl) public: - explicit WaylandInputMethodControlPrivate(WaylandSurface *surface); + explicit WaylandInputMethodControlPrivate(WaylandInputMethodControl *self, WaylandSurface *surface); WaylandTextInput *textInput() const; #if QT_WAYLAND_TEXT_INPUT_V4_WIP @@ -76,6 +76,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandInputMethodControlPrivate : public QObj WaylandSeat *seat = nullptr; WaylandSurface *surface = nullptr; bool enabled = false; + +private: + WaylandInputMethodControl *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandkeyboard.cpp b/src/compositor/compositor_api/aurorawaylandkeyboard.cpp index 505ada638..96bc2d3fa 100644 --- a/src/compositor/compositor_api/aurorawaylandkeyboard.cpp +++ b/src/compositor/compositor_api/aurorawaylandkeyboard.cpp @@ -52,8 +52,9 @@ namespace Aurora { namespace Compositor { -WaylandKeyboardPrivate::WaylandKeyboardPrivate(WaylandSeat *seat) - : seat(seat) +WaylandKeyboardPrivate::WaylandKeyboardPrivate(WaylandKeyboard *self, WaylandSeat *seat) + : q_ptr(self) + , seat(seat) { } @@ -446,7 +447,8 @@ void WaylandKeyboardPrivate::sendRepeatInfo() * Constructs a WaylandKeyboard for the given \a seat and with the given \a parent. */ WaylandKeyboard::WaylandKeyboard(WaylandSeat *seat, QObject *parent) - : WaylandObject(* new WaylandKeyboardPrivate(seat), parent) + : WaylandObject(parent) + , d_ptr(new WaylandKeyboardPrivate(this, seat)) { Q_D(WaylandKeyboard); connect(&d->focusDestroyListener, &WaylandDestroyListener::fired, this, &WaylandKeyboard::focusDestroyed); @@ -461,6 +463,10 @@ WaylandKeyboard::WaylandKeyboard(WaylandSeat *seat, QObject *parent) #endif } +WaylandKeyboard::~WaylandKeyboard() +{ +} + /*! * Returns the seat for this WaylandKeyboard. */ diff --git a/src/compositor/compositor_api/aurorawaylandkeyboard.h b/src/compositor/compositor_api/aurorawaylandkeyboard.h index 78d823eb0..5b0fababa 100644 --- a/src/compositor/compositor_api/aurorawaylandkeyboard.h +++ b/src/compositor/compositor_api/aurorawaylandkeyboard.h @@ -53,6 +53,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandKeyboard : public WaylandObject Q_PROPERTY(quint32 repeatDelay READ repeatDelay WRITE setRepeatDelay NOTIFY repeatDelayChanged) public: WaylandKeyboard(WaylandSeat *seat, QObject *parent = nullptr); + ~WaylandKeyboard(); WaylandSeat *seat() const; WaylandCompositor *compositor() const; @@ -82,6 +83,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandKeyboard : public WaylandObject void repeatDelayChanged(quint32 repeatDelay); private: + QScopedPointer const d_ptr; + void focusDestroyed(void *data); private Q_SLOTS: diff --git a/src/compositor/compositor_api/aurorawaylandkeyboard_p.h b/src/compositor/compositor_api/aurorawaylandkeyboard_p.h index 491c68cfa..fce24a50a 100644 --- a/src/compositor/compositor_api/aurorawaylandkeyboard_p.h +++ b/src/compositor/compositor_api/aurorawaylandkeyboard_p.h @@ -62,15 +62,14 @@ namespace Aurora { namespace Compositor { -class LIRIAURORACOMPOSITOR_EXPORT WaylandKeyboardPrivate : public QObjectPrivate - , public PrivateServer::wl_keyboard +class LIRIAURORACOMPOSITOR_EXPORT WaylandKeyboardPrivate : public PrivateServer::wl_keyboard { public: Q_DECLARE_PUBLIC(WaylandKeyboard) static WaylandKeyboardPrivate *get(WaylandKeyboard *keyboard); - WaylandKeyboardPrivate(WaylandSeat *seat); + WaylandKeyboardPrivate(WaylandKeyboard *self, WaylandSeat *seat); ~WaylandKeyboardPrivate() override; WaylandCompositor *compositor() const { return seat->compositor(); } @@ -111,6 +110,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandKeyboardPrivate : public QObjectPrivate void sendRepeatInfo(); + WaylandKeyboard *q_ptr = nullptr; + WaylandSeat *seat = nullptr; WaylandSurface *focus = nullptr; diff --git a/src/compositor/compositor_api/aurorawaylandkeymap.cpp b/src/compositor/compositor_api/aurorawaylandkeymap.cpp index 128da8f2f..6c8adf765 100644 --- a/src/compositor/compositor_api/aurorawaylandkeymap.cpp +++ b/src/compositor/compositor_api/aurorawaylandkeymap.cpp @@ -35,7 +35,12 @@ namespace Aurora { namespace Compositor { WaylandKeymap::WaylandKeymap(const QString &layout, const QString &variant, const QString &options, const QString &model, const QString &rules, QObject *parent) - : QObject(*new WaylandKeymapPrivate(layout, variant, options, model, rules), parent) + : QObject(parent) + , d_ptr(new WaylandKeymapPrivate(this, layout, variant, options, model, rules)) +{ +} + +WaylandKeymap::~WaylandKeymap() { } @@ -110,10 +115,12 @@ void WaylandKeymap::setModel(const QString &model) emit modelChanged(); } -WaylandKeymapPrivate::WaylandKeymapPrivate(const QString &layout, const QString &variant, - const QString &options, const QString &model, - const QString &rules) - : m_layout(layout) +WaylandKeymapPrivate::WaylandKeymapPrivate(WaylandKeymap *self, + const QString &layout, const QString &variant, + const QString &options, const QString &model, + const QString &rules) + : q_ptr(self) + , m_layout(layout) , m_variant(variant) , m_options(options) , m_rules(rules) diff --git a/src/compositor/compositor_api/aurorawaylandkeymap.h b/src/compositor/compositor_api/aurorawaylandkeymap.h index 67fd27611..20b1a58c2 100644 --- a/src/compositor/compositor_api/aurorawaylandkeymap.h +++ b/src/compositor/compositor_api/aurorawaylandkeymap.h @@ -58,6 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandKeymap : public QObject public: WaylandKeymap(const QString &layout = QString(), const QString &variant = QString(), const QString &options = QString(), const QString &model = QString(), const QString &rules = QString(), QObject *parent = nullptr); + ~WaylandKeymap(); QString layout() const; void setLayout(const QString &layout); @@ -76,6 +77,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandKeymap : public QObject void optionsChanged(); void rulesChanged(); void modelChanged(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandkeymap_p.h b/src/compositor/compositor_api/aurorawaylandkeymap_p.h index dd4b6d226..3c1a54406 100644 --- a/src/compositor/compositor_api/aurorawaylandkeymap_p.h +++ b/src/compositor/compositor_api/aurorawaylandkeymap_p.h @@ -42,24 +42,27 @@ // #include -#include namespace Aurora { namespace Compositor { -class LIRIAURORACOMPOSITOR_EXPORT WaylandKeymapPrivate : public QObjectPrivate +class LIRIAURORACOMPOSITOR_EXPORT WaylandKeymapPrivate { Q_DECLARE_PUBLIC(WaylandKeymap) public: - WaylandKeymapPrivate(const QString &layout, const QString &variant, const QString &options, - const QString &model, const QString &rules); + WaylandKeymapPrivate(WaylandKeymap *self, + const QString &layout, const QString &variant, const QString &options, + const QString &model, const QString &rules); QString m_layout; QString m_variant; QString m_options; QString m_rules; QString m_model; + +private: + WaylandKeymap *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandoutput.cpp b/src/compositor/compositor_api/aurorawaylandoutput.cpp index 204727b65..e5b51ed24 100644 --- a/src/compositor/compositor_api/aurorawaylandoutput.cpp +++ b/src/compositor/compositor_api/aurorawaylandoutput.cpp @@ -47,6 +47,15 @@ #include #include +template +auto priv_slot(DPtr &&dptr, Slot &&slot) +{ + return [&dptr, &slot](auto && ... args) + { + (dptr->*slot)(std::forward(args) ...); + }; +} + namespace Aurora { namespace Compositor { @@ -97,7 +106,8 @@ static PrivateServer::wl_output::transform toWlTransform(const WaylandOutput::Tr return PrivateServer::wl_output::transform_normal; } -WaylandOutputPrivate::WaylandOutputPrivate() +WaylandOutputPrivate::WaylandOutputPrivate(WaylandOutput *self) + : q_ptr(self) { } @@ -245,7 +255,8 @@ void WaylandOutputPrivate::removeView(WaylandView *view, WaylandSurface *surface } WaylandOutput::WaylandOutput() - : WaylandObject(*new WaylandOutputPrivate()) + : WaylandObject() + , d_ptr(new WaylandOutputPrivate(this)) { } @@ -290,7 +301,8 @@ WaylandOutput::WaylandOutput() * \l{WaylandCompositor::defaultOutput()}{default output}. */ WaylandOutput::WaylandOutput(WaylandCompositor *compositor, QWindow *window) - : WaylandObject(*new WaylandOutputPrivate()) + : WaylandObject() + , d_ptr(new WaylandOutputPrivate(this)) { Q_D(WaylandOutput); d->compositor = compositor; @@ -338,10 +350,10 @@ void WaylandOutput::initialize() WaylandCompositorPrivate::get(d->compositor)->addOutput(this); if (d->window) { - QObjectPrivate::connect(d->window, &QWindow::widthChanged, d, &WaylandOutputPrivate::_q_handleMaybeWindowPixelSizeChanged); - QObjectPrivate::connect(d->window, &QWindow::heightChanged, d, &WaylandOutputPrivate::_q_handleMaybeWindowPixelSizeChanged); - QObjectPrivate::connect(d->window, &QWindow::screenChanged, d, &WaylandOutputPrivate::_q_handleMaybeWindowPixelSizeChanged); - QObjectPrivate::connect(d->window, &QObject::destroyed, d, &WaylandOutputPrivate::_q_handleWindowDestroyed); + connect(d->window, SIGNAL(widthChanged(int)), this, SLOT(_q_handleMaybeWindowPixelSizeChanged())); + connect(d->window, SIGNAL(heightChanged(int)), this, SLOT(_q_handleMaybeWindowPixelSizeChanged())); + connect(d->window, SIGNAL(screenChanged(QScreen*)), this, SLOT(_q_handleMaybeWindowPixelSizeChanged())); + connect(d->window, SIGNAL(destroyed()), this, SLOT(_q_handleWindowDestroyed())); } d->init(d->compositor->display(), 2); diff --git a/src/compositor/compositor_api/aurorawaylandoutput.h b/src/compositor/compositor_api/aurorawaylandoutput.h index 9de3bab49..2a06dad6f 100644 --- a/src/compositor/compositor_api/aurorawaylandoutput.h +++ b/src/compositor/compositor_api/aurorawaylandoutput.h @@ -182,6 +182,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandOutput : public WaylandObject virtual void initialize(); private: + QScopedPointer const d_ptr; + Q_PRIVATE_SLOT(d_func(), void _q_handleMaybeWindowPixelSizeChanged()) Q_PRIVATE_SLOT(d_func(), void _q_handleWindowDestroyed()) }; diff --git a/src/compositor/compositor_api/aurorawaylandoutput_p.h b/src/compositor/compositor_api/aurorawaylandoutput_p.h index 9e9ddb604..7bd8e3bb5 100644 --- a/src/compositor/compositor_api/aurorawaylandoutput_p.h +++ b/src/compositor/compositor_api/aurorawaylandoutput_p.h @@ -88,12 +88,11 @@ struct WaylandSurfaceViewMapper bool has_entered = false; }; -class LIRIAURORACOMPOSITOR_EXPORT WaylandOutputPrivate : public QObjectPrivate, public PrivateServer::wl_output +class LIRIAURORACOMPOSITOR_EXPORT WaylandOutputPrivate : public PrivateServer::wl_output { -public: Q_DECLARE_PUBLIC(WaylandOutput) - - WaylandOutputPrivate(); +public: + WaylandOutputPrivate(WaylandOutput *self); ~WaylandOutputPrivate() override; static WaylandOutputPrivate *get(WaylandOutput *output) { return output->d_func(); } @@ -118,6 +117,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandOutputPrivate : public QObjectPrivate, void _q_handleMaybeWindowPixelSizeChanged(); void _q_handleWindowDestroyed(); + WaylandOutput *q_ptr = nullptr; WaylandCompositor *compositor = nullptr; QWindow *window = nullptr; QString manufacturer; diff --git a/src/compositor/compositor_api/aurorawaylandpointer.cpp b/src/compositor/compositor_api/aurorawaylandpointer.cpp index 4f8758f49..cc85a299d 100644 --- a/src/compositor/compositor_api/aurorawaylandpointer.cpp +++ b/src/compositor/compositor_api/aurorawaylandpointer.cpp @@ -39,9 +39,9 @@ namespace Compositor { WaylandSurfaceRole WaylandPointerPrivate::s_role("wl_pointer"); WaylandPointerPrivate::WaylandPointerPrivate(WaylandPointer *pointer, WaylandSeat *seat) - : seat(seat) + : q_ptr(pointer) + , seat(seat) { - Q_UNUSED(pointer); } uint WaylandPointerPrivate::sendButton(Qt::MouseButton button, uint32_t state) @@ -152,12 +152,17 @@ void WaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource, u * Constructs a WaylandPointer for the given \a seat and with the given \a parent. */ WaylandPointer::WaylandPointer(WaylandSeat *seat, QObject *parent) - : WaylandObject(* new WaylandPointerPrivate(this, seat), parent) + : WaylandObject(parent) + , d_ptr(new WaylandPointerPrivate(this, seat)) { connect(&d_func()->enteredSurfaceDestroyListener, &WaylandDestroyListener::fired, this, &WaylandPointer::enteredSurfaceDestroyed); connect(seat, &WaylandSeat::mouseFocusChanged, this, &WaylandPointer::pointerFocusChanged); } +WaylandPointer::~WaylandPointer() +{ +} + /*! * Returns the input device for this WaylandPointer. */ diff --git a/src/compositor/compositor_api/aurorawaylandpointer.h b/src/compositor/compositor_api/aurorawaylandpointer.h index 17cee7fab..f849bed1b 100644 --- a/src/compositor/compositor_api/aurorawaylandpointer.h +++ b/src/compositor/compositor_api/aurorawaylandpointer.h @@ -52,6 +52,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandPointer : public WaylandObject Q_PROPERTY(bool isButtonPressed READ isButtonPressed NOTIFY buttonPressedChanged) public: WaylandPointer(WaylandSeat *seat, QObject *parent = nullptr); + ~WaylandPointer(); WaylandSeat *seat() const; WaylandCompositor *compositor() const; @@ -81,6 +82,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandPointer : public WaylandObject void buttonPressedChanged(); private: + QScopedPointer const d_ptr; + void enteredSurfaceDestroyed(void *data); void pointerFocusChanged(WaylandView *newFocus, WaylandView *oldFocus); }; diff --git a/src/compositor/compositor_api/aurorawaylandpointer_p.h b/src/compositor/compositor_api/aurorawaylandpointer_p.h index 56df7bab4..4458aa34b 100644 --- a/src/compositor/compositor_api/aurorawaylandpointer_p.h +++ b/src/compositor/compositor_api/aurorawaylandpointer_p.h @@ -64,8 +64,7 @@ namespace Compositor { class WaylandView; -class LIRIAURORACOMPOSITOR_EXPORT WaylandPointerPrivate : public QObjectPrivate - , public PrivateServer::wl_pointer +class LIRIAURORACOMPOSITOR_EXPORT WaylandPointerPrivate : public PrivateServer::wl_pointer { Q_DECLARE_PUBLIC(WaylandPointer) public: @@ -84,6 +83,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandPointerPrivate : public QObjectPrivate void sendLeave(); void ensureEntered(WaylandSurface *surface); + WaylandPointer *q_ptr = nullptr; WaylandSeat *seat = nullptr; WaylandOutput *output = nullptr; QPointer enteredSurface; diff --git a/src/compositor/compositor_api/aurorawaylandquickcompositor.cpp b/src/compositor/compositor_api/aurorawaylandquickcompositor.cpp index 06a730df4..0ddc532a0 100644 --- a/src/compositor/compositor_api/aurorawaylandquickcompositor.cpp +++ b/src/compositor/compositor_api/aurorawaylandquickcompositor.cpp @@ -55,9 +55,10 @@ namespace Compositor { class WaylandQuickCompositorPrivate : public WaylandCompositorPrivate { public: - explicit WaylandQuickCompositorPrivate(WaylandCompositor *compositor) - : WaylandCompositorPrivate(compositor) - , m_viewporter(new WaylandViewporter(compositor)) + explicit WaylandQuickCompositorPrivate(WaylandQuickCompositor *self) + : WaylandCompositorPrivate(self) + , q_ptr(self) + , m_viewporter(new WaylandViewporter(self)) { } protected: @@ -66,11 +67,17 @@ class WaylandQuickCompositorPrivate : public WaylandCompositorPrivate return new WaylandQuickSurface(); } private: + WaylandQuickCompositor *q_ptr = nullptr; QScopedPointer m_viewporter; }; WaylandQuickCompositor::WaylandQuickCompositor(QObject *parent) - : WaylandCompositor(*new WaylandQuickCompositorPrivate(this), parent) + : WaylandCompositor(parent) + , d_ptr(new WaylandQuickCompositorPrivate(this)) +{ +} + +WaylandQuickCompositor::~WaylandQuickCompositor() { } diff --git a/src/compositor/compositor_api/aurorawaylandquickcompositor.h b/src/compositor/compositor_api/aurorawaylandquickcompositor.h index 49f8bc8b3..355854dbd 100644 --- a/src/compositor/compositor_api/aurorawaylandquickcompositor.h +++ b/src/compositor/compositor_api/aurorawaylandquickcompositor.h @@ -48,6 +48,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQuickCompositor : public WaylandComposi Q_OBJECT public: WaylandQuickCompositor(QObject *parent = nullptr); + ~WaylandQuickCompositor(); + void create() override; void grabSurface(WaylandSurfaceGrabber *grabber, const WaylandBufferRef &buffer) override; @@ -55,6 +57,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQuickCompositor : public WaylandComposi protected: void classBegin() override; void componentComplete() override; + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandquickhardwarelayer.cpp b/src/compositor/compositor_api/aurorawaylandquickhardwarelayer.cpp index 8b423673c..47c67a1c4 100644 --- a/src/compositor/compositor_api/aurorawaylandquickhardwarelayer.cpp +++ b/src/compositor/compositor_api/aurorawaylandquickhardwarelayer.cpp @@ -39,19 +39,29 @@ namespace Aurora { namespace Compositor { -class WaylandQuickHardwareLayerPrivate : public QObjectPrivate +class WaylandQuickHardwareLayerPrivate { Q_DECLARE_PUBLIC(WaylandQuickHardwareLayer) public: + WaylandQuickHardwareLayerPrivate(WaylandQuickHardwareLayer *self); + Internal::HardwareLayerIntegration *layerIntegration(); WaylandQuickItem *m_waylandItem = nullptr; int m_stackingLevel = 0; QMatrix4x4 m_matrixFromRenderThread; static Internal::HardwareLayerIntegration *s_hardwareLayerIntegration; + +private: + WaylandQuickHardwareLayer *q_ptr = nullptr; }; Internal::HardwareLayerIntegration *WaylandQuickHardwareLayerPrivate::s_hardwareLayerIntegration = nullptr; +WaylandQuickHardwareLayerPrivate::WaylandQuickHardwareLayerPrivate(WaylandQuickHardwareLayer *self) + : q_ptr(self) +{ +} + Internal::HardwareLayerIntegration *WaylandQuickHardwareLayerPrivate::layerIntegration() { if (!s_hardwareLayerIntegration) { @@ -95,7 +105,8 @@ Internal::HardwareLayerIntegration *WaylandQuickHardwareLayerPrivate::layerInteg */ WaylandQuickHardwareLayer::WaylandQuickHardwareLayer(QObject *parent) - : QObject(*new WaylandQuickHardwareLayerPrivate(), parent) + : QObject(parent) + , d_ptr(new WaylandQuickHardwareLayerPrivate(this)) { } diff --git a/src/compositor/compositor_api/aurorawaylandquickhardwarelayer_p.h b/src/compositor/compositor_api/aurorawaylandquickhardwarelayer_p.h index cbc7ae274..24f0c5b59 100644 --- a/src/compositor/compositor_api/aurorawaylandquickhardwarelayer_p.h +++ b/src/compositor/compositor_api/aurorawaylandquickhardwarelayer_p.h @@ -76,6 +76,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQuickHardwareLayer : public QObject, pu Q_SIGNALS: void stackingLevelChanged(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandquicksurface.cpp b/src/compositor/compositor_api/aurorawaylandquicksurface.cpp index aa78360a7..7d10eb1c8 100644 --- a/src/compositor/compositor_api/aurorawaylandquicksurface.cpp +++ b/src/compositor/compositor_api/aurorawaylandquicksurface.cpp @@ -44,24 +44,20 @@ namespace Aurora { namespace Compositor { WaylandQuickSurface::WaylandQuickSurface() - : WaylandSurface(* new WaylandQuickSurfacePrivate()) + : WaylandSurface() + , d_ptr(new WaylandQuickSurfacePrivate(this)) { } WaylandQuickSurface::WaylandQuickSurface(WaylandCompositor *compositor, WaylandClient *client, quint32 id, int version) - : WaylandSurface(* new WaylandQuickSurfacePrivate()) + : WaylandSurface() + , d_ptr(new WaylandQuickSurfacePrivate(this)) { initialize(compositor, client, id, version); } -WaylandQuickSurface::WaylandQuickSurface(WaylandQuickSurfacePrivate &dptr) - : WaylandSurface(dptr) -{ -} - WaylandQuickSurface::~WaylandQuickSurface() { - } /*! diff --git a/src/compositor/compositor_api/aurorawaylandquicksurface.h b/src/compositor/compositor_api/aurorawaylandquicksurface.h index c9ae1f449..03d929860 100644 --- a/src/compositor/compositor_api/aurorawaylandquicksurface.h +++ b/src/compositor/compositor_api/aurorawaylandquicksurface.h @@ -60,11 +60,11 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQuickSurface : public WaylandSurface bool useTextureAlpha() const; void setUseTextureAlpha(bool useTextureAlpha); -protected: - WaylandQuickSurface(WaylandQuickSurfacePrivate &dptr); - Q_SIGNALS: void useTextureAlphaChanged(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandquicksurface_p.h b/src/compositor/compositor_api/aurorawaylandquicksurface_p.h index 068ccc69f..ad56890d2 100644 --- a/src/compositor/compositor_api/aurorawaylandquicksurface_p.h +++ b/src/compositor/compositor_api/aurorawaylandquicksurface_p.h @@ -41,6 +41,7 @@ // We mean it. // +#include #include namespace Aurora { @@ -51,16 +52,17 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQuickSurfacePrivate : public WaylandSur { Q_DECLARE_PUBLIC(WaylandQuickSurface) public: - WaylandQuickSurfacePrivate() - { - } - - ~WaylandQuickSurfacePrivate() override + WaylandQuickSurfacePrivate(WaylandQuickSurface *self) + : WaylandSurfacePrivate(self) + , q_ptr(self) { } bool useTextureAlpha = true; bool clientRenderingEnabled = true; + +private: + WaylandQuickSurface *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandseat.cpp b/src/compositor/compositor_api/aurorawaylandseat.cpp index d08b5733f..a659e2bab 100644 --- a/src/compositor/compositor_api/aurorawaylandseat.cpp +++ b/src/compositor/compositor_api/aurorawaylandseat.cpp @@ -60,11 +60,12 @@ namespace Aurora { namespace Compositor { -WaylandSeatPrivate::WaylandSeatPrivate(WaylandSeat *seat) : +WaylandSeatPrivate::WaylandSeatPrivate(WaylandSeat *seat) + : q_ptr(seat) #if LIRI_FEATURE_aurora_datadevice - drag_handle(new WaylandDrag(seat)), + , drag_handle(new WaylandDrag(seat)) #endif - keymap(new WaylandKeymap()) + , keymap(new WaylandKeymap()) { } @@ -180,7 +181,8 @@ void WaylandSeatPrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t id * Constructs a WaylandSeat for the given \a compositor and \a capabilityFlags. */ WaylandSeat::WaylandSeat(WaylandCompositor *compositor, CapabilityFlags capabilityFlags) - : WaylandObject(*new WaylandSeatPrivate(this)) + : WaylandObject() + , d_ptr(new WaylandSeatPrivate(this)) { Q_D(WaylandSeat); d->compositor = compositor; diff --git a/src/compositor/compositor_api/aurorawaylandseat.h b/src/compositor/compositor_api/aurorawaylandseat.h index 4ceb1e6fc..442e054e2 100644 --- a/src/compositor/compositor_api/aurorawaylandseat.h +++ b/src/compositor/compositor_api/aurorawaylandseat.h @@ -137,6 +137,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandSeat : public WaylandObject void cursorSurfaceRequested(Aurora::Compositor::WaylandSurface *surface, int hotspotX, int hotspotY, Aurora::Compositor::WaylandClient *client); private: + QScopedPointer const d_ptr; void handleMouseFocusDestroyed(); }; diff --git a/src/compositor/compositor_api/aurorawaylandseat_p.h b/src/compositor/compositor_api/aurorawaylandseat_p.h index 3650b9bca..411e0abed 100644 --- a/src/compositor/compositor_api/aurorawaylandseat_p.h +++ b/src/compositor/compositor_api/aurorawaylandseat_p.h @@ -77,7 +77,7 @@ class InputMethod; } -class LIRIAURORACOMPOSITOR_EXPORT WaylandSeatPrivate : public QObjectPrivate, public PrivateServer::wl_seat +class LIRIAURORACOMPOSITOR_EXPORT WaylandSeatPrivate : public PrivateServer::wl_seat { public: Q_DECLARE_PUBLIC(WaylandSeat) @@ -107,6 +107,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandSeatPrivate : public QObjectPrivate, pu void seat_destroy_resource(wl_seat::Resource *resource) override; private: + WaylandSeat *q_ptr = nullptr; + bool isInitialized = false; WaylandCompositor *compositor = nullptr; WaylandView *mouseFocus = nullptr; diff --git a/src/compositor/compositor_api/aurorawaylandsurface.cpp b/src/compositor/compositor_api/aurorawaylandsurface.cpp index 05c8a9262..444d194a2 100644 --- a/src/compositor/compositor_api/aurorawaylandsurface.cpp +++ b/src/compositor/compositor_api/aurorawaylandsurface.cpp @@ -107,8 +107,9 @@ static QRegion infiniteRegion() { QList WaylandSurfacePrivate::uninitializedSurfaces; #endif -WaylandSurfacePrivate::WaylandSurfacePrivate() - : inputRegion(infiniteRegion()) +WaylandSurfacePrivate::WaylandSurfacePrivate(WaylandSurface *self) + : q_ptr(self) + , inputRegion(infiniteRegion()) { pending.buffer = WaylandBufferRef(); pending.newlyAttached = false; @@ -440,7 +441,8 @@ Internal::ClientBuffer *WaylandSurfacePrivate::getBuffer(struct ::wl_resource *b * Constructs a an uninitialized WaylandSurface. */ WaylandSurface::WaylandSurface() - : WaylandObject(*new WaylandSurfacePrivate()) + : WaylandObject() + , d_ptr(new WaylandSurfacePrivate(this)) { } @@ -449,19 +451,12 @@ WaylandSurface::WaylandSurface() * and \a version. */ WaylandSurface::WaylandSurface(WaylandCompositor *compositor, WaylandClient *client, uint id, int version) - : WaylandObject(*new WaylandSurfacePrivate()) + : WaylandObject() + , d_ptr(new WaylandSurfacePrivate(this)) { initialize(compositor, client, id, version); } -/*! - * \internal - */ -WaylandSurface::WaylandSurface(WaylandSurfacePrivate &dptr) - : WaylandObject(dptr) -{ -} - /*! * Destroys the WaylandSurface. */ diff --git a/src/compositor/compositor_api/aurorawaylandsurface.h b/src/compositor/compositor_api/aurorawaylandsurface.h index 1607a27b2..8c971c7fc 100644 --- a/src/compositor/compositor_api/aurorawaylandsurface.h +++ b/src/compositor/compositor_api/aurorawaylandsurface.h @@ -156,9 +156,6 @@ public Q_SLOTS: void updateSelection(); #endif -protected: - WaylandSurface(WaylandSurfacePrivate &dptr); - Q_SIGNALS: void hasContentChanged(); void damaged(const QRegion &rect); @@ -182,6 +179,9 @@ public Q_SLOTS: void configure(bool hasBuffer); void redraw(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandsurface_p.h b/src/compositor/compositor_api/aurorawaylandsurface_p.h index 4a58fe916..f4353bb00 100644 --- a/src/compositor/compositor_api/aurorawaylandsurface_p.h +++ b/src/compositor/compositor_api/aurorawaylandsurface_p.h @@ -79,12 +79,12 @@ namespace Internal { class FrameCallback; } -class LIRIAURORACOMPOSITOR_EXPORT WaylandSurfacePrivate : public QObjectPrivate, public PrivateServer::wl_surface +class LIRIAURORACOMPOSITOR_EXPORT WaylandSurfacePrivate : public PrivateServer::wl_surface { public: static WaylandSurfacePrivate *get(WaylandSurface *surface); - WaylandSurfacePrivate(); + WaylandSurfacePrivate(WaylandSurface *self); ~WaylandSurfacePrivate() override; void ref(); @@ -210,6 +210,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandSurfacePrivate : public QObjectPrivate, #endif Q_DECLARE_PUBLIC(WaylandSurface) Q_DISABLE_COPY(WaylandSurfacePrivate) + +private: + WaylandSurface *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandsurfacegrabber.cpp b/src/compositor/compositor_api/aurorawaylandsurfacegrabber.cpp index 320ea3f88..15e97c2bf 100644 --- a/src/compositor/compositor_api/aurorawaylandsurfacegrabber.cpp +++ b/src/compositor/compositor_api/aurorawaylandsurfacegrabber.cpp @@ -61,23 +61,36 @@ namespace Compositor { \value RendererNotReady The compositor renderer is not ready to grab the surface content. */ -class WaylandSurfaceGrabberPrivate : public QObjectPrivate +class WaylandSurfaceGrabberPrivate { Q_DECLARE_PUBLIC(WaylandSurfaceGrabber) +public: + WaylandSurfaceGrabberPrivate(WaylandSurfaceGrabber *self) + : q_ptr(self) + { + } WaylandSurface *surface = nullptr; + +private: + WaylandSurfaceGrabber *q_ptr = nullptr; }; /*! * Create a WaylandSurfaceGrabber object with the given \a surface and \a parent */ WaylandSurfaceGrabber::WaylandSurfaceGrabber(WaylandSurface *surface, QObject *parent) - : QObject(*(new WaylandSurfaceGrabberPrivate), parent) + : QObject(parent) + , d_ptr(new WaylandSurfaceGrabberPrivate(this)) { Q_D(WaylandSurfaceGrabber); d->surface = surface; } +WaylandSurfaceGrabber::~WaylandSurfaceGrabber() +{ +} + /*! * Returns the surface set on this object */ diff --git a/src/compositor/compositor_api/aurorawaylandsurfacegrabber.h b/src/compositor/compositor_api/aurorawaylandsurfacegrabber.h index fa4689814..0ec051f79 100644 --- a/src/compositor/compositor_api/aurorawaylandsurfacegrabber.h +++ b/src/compositor/compositor_api/aurorawaylandsurfacegrabber.h @@ -52,7 +52,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandSurfaceGrabber : public QObject RendererNotReady, }; Q_ENUM(Error) + explicit WaylandSurfaceGrabber(WaylandSurface *surface, QObject *parent = nullptr); + ~WaylandSurfaceGrabber(); WaylandSurface *surface() const; void grab(); @@ -60,6 +62,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandSurfaceGrabber : public QObject Q_SIGNALS: void success(const QImage &image); void failed(Aurora::Compositor::WaylandSurfaceGrabber::Error error); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandtouch.cpp b/src/compositor/compositor_api/aurorawaylandtouch.cpp index fe634c76c..95981f71d 100644 --- a/src/compositor/compositor_api/aurorawaylandtouch.cpp +++ b/src/compositor/compositor_api/aurorawaylandtouch.cpp @@ -42,9 +42,9 @@ namespace Aurora { namespace Compositor { WaylandTouchPrivate::WaylandTouchPrivate(WaylandTouch *touch, WaylandSeat *seat) - : seat(seat) + : q_ptr(touch) + , seat(seat) { - Q_UNUSED(touch); } void WaylandTouchPrivate::touch_release(Resource *resource) @@ -118,7 +118,12 @@ int WaylandTouchPrivate::toSequentialWaylandId(int touchId) * Constructs a WaylandTouch for the \a seat and with the given \a parent. */ WaylandTouch::WaylandTouch(WaylandSeat *seat, QObject *parent) - : WaylandObject(*new WaylandTouchPrivate(this, seat), parent) + : WaylandObject(parent) + , d_ptr(new WaylandTouchPrivate(this, seat)) +{ +} + +WaylandTouch::~WaylandTouch() { } diff --git a/src/compositor/compositor_api/aurorawaylandtouch.h b/src/compositor/compositor_api/aurorawaylandtouch.h index dd49b2671..aca343ac8 100644 --- a/src/compositor/compositor_api/aurorawaylandtouch.h +++ b/src/compositor/compositor_api/aurorawaylandtouch.h @@ -54,6 +54,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandTouch : public WaylandObject Q_DECLARE_PRIVATE(WaylandTouch) public: WaylandTouch(WaylandSeat *seat, QObject *parent = nullptr); + ~WaylandTouch(); WaylandSeat *seat() const; WaylandCompositor *compositor() const; @@ -64,6 +65,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandTouch : public WaylandObject virtual void sendFullTouchEvent(WaylandSurface *surface, QTouchEvent *event); virtual void addClient(WaylandClient *client, uint32_t id, uint32_t version); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandtouch_p.h b/src/compositor/compositor_api/aurorawaylandtouch_p.h index 8b285316d..992c1d49d 100644 --- a/src/compositor/compositor_api/aurorawaylandtouch_p.h +++ b/src/compositor/compositor_api/aurorawaylandtouch_p.h @@ -59,7 +59,7 @@ namespace Aurora { namespace Compositor { -class LIRIAURORACOMPOSITOR_EXPORT WaylandTouchPrivate : public QObjectPrivate, public PrivateServer::wl_touch +class LIRIAURORACOMPOSITOR_EXPORT WaylandTouchPrivate : public PrivateServer::wl_touch { Q_DECLARE_PUBLIC(WaylandTouch) public: @@ -75,6 +75,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandTouchPrivate : public QObjectPrivate, p void touch_release(Resource *resource) override; int toSequentialWaylandId(int touchId); + WaylandTouch *q_ptr = nullptr; WaylandSeat *seat = nullptr; QVarLengthArray ids; }; diff --git a/src/compositor/compositor_api/aurorawaylandview.cpp b/src/compositor/compositor_api/aurorawaylandview.cpp index fa372383d..5a4ca85fd 100644 --- a/src/compositor/compositor_api/aurorawaylandview.cpp +++ b/src/compositor/compositor_api/aurorawaylandview.cpp @@ -42,6 +42,11 @@ namespace Aurora { namespace Compositor { +WaylandViewPrivate::WaylandViewPrivate(WaylandView *self) + : q_ptr(self) +{ +} + void WaylandViewPrivate::markSurfaceAsDestroyed(WaylandSurface *surface) { Q_Q(WaylandView); @@ -81,7 +86,8 @@ void WaylandViewPrivate::markSurfaceAsDestroyed(WaylandSurface *surface) * Constructs a WaylandView with the given \a renderObject and \a parent. */ WaylandView::WaylandView(QObject *renderObject, QObject *parent) - : QObject(*new WaylandViewPrivate(),parent) + : QObject(parent) + , d_ptr(new WaylandViewPrivate(this)) { d_func()->renderObject = renderObject; } diff --git a/src/compositor/compositor_api/aurorawaylandview.h b/src/compositor/compositor_api/aurorawaylandview.h index 7927d875c..e6805790b 100644 --- a/src/compositor/compositor_api/aurorawaylandview.h +++ b/src/compositor/compositor_api/aurorawaylandview.h @@ -91,6 +91,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandView : public QObject void outputChanged(); void bufferLockedChanged(); void allowDiscardFrontBufferChanged(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/compositor_api/aurorawaylandview_p.h b/src/compositor/compositor_api/aurorawaylandview_p.h index cdc9a22cb..d9d82858a 100644 --- a/src/compositor/compositor_api/aurorawaylandview_p.h +++ b/src/compositor/compositor_api/aurorawaylandview_p.h @@ -34,7 +34,6 @@ #include #include -#include #include @@ -56,14 +55,13 @@ namespace Compositor { class WaylandSurface; class WaylandOutput; -class WaylandViewPrivate : public QObjectPrivate +class WaylandViewPrivate { Q_DECLARE_PUBLIC(WaylandView) public: static WaylandViewPrivate *get(WaylandView *view) { return view->d_func(); } - WaylandViewPrivate() - { } + WaylandViewPrivate(WaylandView *self); void markSurfaceAsDestroyed(WaylandSurface *surface); void setSurface(WaylandSurface *newSurface); @@ -84,6 +82,9 @@ class WaylandViewPrivate : public QObjectPrivate bool forceAdvanceSucceed = false; bool allowDiscardFrontBuffer = false; bool independentFrameCallback = false; //If frame callbacks are independent of the main quick scene graph + +private: + WaylandView *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandidleinhibitv1.cpp b/src/compositor/extensions/aurorawaylandidleinhibitv1.cpp index e5fe26d6d..0d654ea82 100644 --- a/src/compositor/extensions/aurorawaylandidleinhibitv1.cpp +++ b/src/compositor/extensions/aurorawaylandidleinhibitv1.cpp @@ -84,7 +84,8 @@ namespace Compositor { Constructs a WaylandIdleInhibitManagerV1 object. */ WaylandIdleInhibitManagerV1::WaylandIdleInhibitManagerV1() - : WaylandCompositorExtensionTemplate(*new WaylandIdleInhibitManagerV1Private()) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandIdleInhibitManagerV1Private(this)) { } @@ -92,7 +93,8 @@ WaylandIdleInhibitManagerV1::WaylandIdleInhibitManagerV1() Constructs a WaylandIdleInhibitManagerV1 object for the provided \a compositor. */ WaylandIdleInhibitManagerV1::WaylandIdleInhibitManagerV1(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandIdleInhibitManagerV1Private()) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandIdleInhibitManagerV1Private(this)) { } @@ -126,6 +128,11 @@ const wl_interface *WaylandIdleInhibitManagerV1::interface() } +WaylandIdleInhibitManagerV1Private::WaylandIdleInhibitManagerV1Private(WaylandIdleInhibitManagerV1 *self) + : WaylandCompositorExtensionPrivate(self) +{ +} + void WaylandIdleInhibitManagerV1Private::zwp_idle_inhibit_manager_v1_create_inhibitor(Resource *resource, uint id, wl_resource *surfaceResource) { auto *surface = WaylandSurface::fromResource(surfaceResource); diff --git a/src/compositor/extensions/aurorawaylandidleinhibitv1.h b/src/compositor/extensions/aurorawaylandidleinhibitv1.h index acfbf4e9d..11f015abb 100644 --- a/src/compositor/extensions/aurorawaylandidleinhibitv1.h +++ b/src/compositor/extensions/aurorawaylandidleinhibitv1.h @@ -50,6 +50,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIdleInhibitManagerV1 : public WaylandCo void initialize() override; static const struct wl_interface *interface(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandidleinhibitv1_p.h b/src/compositor/extensions/aurorawaylandidleinhibitv1_p.h index 171177893..40266e83e 100644 --- a/src/compositor/extensions/aurorawaylandidleinhibitv1_p.h +++ b/src/compositor/extensions/aurorawaylandidleinhibitv1_p.h @@ -56,7 +56,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIdleInhibitManagerV1Private { Q_DECLARE_PUBLIC(WaylandIdleInhibitManagerV1) public: - explicit WaylandIdleInhibitManagerV1Private() = default; + explicit WaylandIdleInhibitManagerV1Private(WaylandIdleInhibitManagerV1 *self); class LIRIAURORACOMPOSITOR_EXPORT Inhibitor : public PrivateServer::zwp_idle_inhibitor_v1 diff --git a/src/compositor/extensions/aurorawaylandiviapplication.cpp b/src/compositor/extensions/aurorawaylandiviapplication.cpp index 203d53fbc..271501b2a 100644 --- a/src/compositor/extensions/aurorawaylandiviapplication.cpp +++ b/src/compositor/extensions/aurorawaylandiviapplication.cpp @@ -88,7 +88,8 @@ namespace Compositor { * Constructs a WaylandIviApplication object. */ WaylandIviApplication::WaylandIviApplication() - : WaylandCompositorExtensionTemplate(*new WaylandIviApplicationPrivate()) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandIviApplicationPrivate(this)) { } @@ -96,7 +97,12 @@ WaylandIviApplication::WaylandIviApplication() * Constructs a WaylandIviApplication object for the provided \a compositor. */ WaylandIviApplication::WaylandIviApplication(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandIviApplicationPrivate()) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandIviApplicationPrivate(this)) +{ +} + +WaylandIviApplication::~WaylandIviApplication() { } @@ -165,7 +171,8 @@ QByteArray WaylandIviApplication::interfaceName() * This signal is emitted when an IviSurface, \a iviSurface, has been created. */ -WaylandIviApplicationPrivate::WaylandIviApplicationPrivate() +WaylandIviApplicationPrivate::WaylandIviApplicationPrivate(WaylandIviApplication *self) + : WaylandCompositorExtensionPrivate(self) { } diff --git a/src/compositor/extensions/aurorawaylandiviapplication.h b/src/compositor/extensions/aurorawaylandiviapplication.h index 4ff2333e9..2cd8a44be 100644 --- a/src/compositor/extensions/aurorawaylandiviapplication.h +++ b/src/compositor/extensions/aurorawaylandiviapplication.h @@ -50,6 +50,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviApplication : public WaylandComposit public: WaylandIviApplication(); WaylandIviApplication(WaylandCompositor *compositor); + ~WaylandIviApplication(); void initialize() override; @@ -59,6 +60,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviApplication : public WaylandComposit Q_SIGNALS: void iviSurfaceRequested(Aurora::Compositor::WaylandSurface *surface, uint iviId, const Aurora::Compositor::WaylandResource &resource); void iviSurfaceCreated(Aurora::Compositor::WaylandIviSurface *iviSurface); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandiviapplication_p.h b/src/compositor/extensions/aurorawaylandiviapplication_p.h index 89b0ea393..83ef04276 100644 --- a/src/compositor/extensions/aurorawaylandiviapplication_p.h +++ b/src/compositor/extensions/aurorawaylandiviapplication_p.h @@ -59,7 +59,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviApplicationPrivate Q_DECLARE_PUBLIC(WaylandIviApplication) public: - WaylandIviApplicationPrivate(); + WaylandIviApplicationPrivate(WaylandIviApplication *self); static WaylandIviApplicationPrivate *get(WaylandIviApplication *iviApplication) { return iviApplication->d_func(); } void unregisterIviSurface(WaylandIviSurface *iviSurface); diff --git a/src/compositor/extensions/aurorawaylandivisurface.cpp b/src/compositor/extensions/aurorawaylandivisurface.cpp index ed047f91c..96b0654fe 100644 --- a/src/compositor/extensions/aurorawaylandivisurface.cpp +++ b/src/compositor/extensions/aurorawaylandivisurface.cpp @@ -74,7 +74,8 @@ WaylandSurfaceRole WaylandIviSurfacePrivate::s_role("ivi_surface"); * Constructs a WaylandIviSurface. */ WaylandIviSurface::WaylandIviSurface() - : WaylandShellSurfaceTemplate(*new WaylandIviSurfacePrivate()) + : WaylandShellSurfaceTemplate() + , d_ptr(new WaylandIviSurfacePrivate(this)) { } @@ -83,11 +84,16 @@ WaylandIviSurface::WaylandIviSurface() * given \a application, \a surface, \a iviId, and \a resource. */ WaylandIviSurface::WaylandIviSurface(WaylandIviApplication *application, WaylandSurface *surface, uint iviId, const WaylandResource &resource) - : WaylandShellSurfaceTemplate(*new WaylandIviSurfacePrivate()) + : WaylandShellSurfaceTemplate() + , d_ptr(new WaylandIviSurfacePrivate(this)) { initialize(application, surface, iviId, resource); } +WaylandIviSurface::~WaylandIviSurface() +{ +} + /*! * \qmlmethod void AuroraCompositor::IviSurface::initialize(IviApplication iviApplication, WaylandSurface surface, int iviId, WaylandResource resource) * @@ -216,7 +222,8 @@ void WaylandIviSurface::initialize() WaylandShellSurfaceTemplate::initialize(); } -WaylandIviSurfacePrivate::WaylandIviSurfacePrivate() +WaylandIviSurfacePrivate::WaylandIviSurfacePrivate(WaylandIviSurface *self) + : WaylandCompositorExtensionPrivate(self) { } diff --git a/src/compositor/extensions/aurorawaylandivisurface.h b/src/compositor/extensions/aurorawaylandivisurface.h index 6c79f6fc4..4535c0bc2 100644 --- a/src/compositor/extensions/aurorawaylandivisurface.h +++ b/src/compositor/extensions/aurorawaylandivisurface.h @@ -58,6 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviSurface : public WaylandShellSurface public: WaylandIviSurface(); WaylandIviSurface(WaylandIviApplication *application, WaylandSurface *surface, uint iviId, const WaylandResource &resource); + ~WaylandIviSurface(); Q_INVOKABLE void initialize(Aurora::Compositor::WaylandIviApplication *iviApplication, Aurora::Compositor::WaylandSurface *surface, @@ -82,6 +83,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviSurface : public WaylandShellSurface void iviIdChanged(); private: + QScopedPointer const d_ptr; + void initialize() override; }; diff --git a/src/compositor/extensions/aurorawaylandivisurface_p.h b/src/compositor/extensions/aurorawaylandivisurface_p.h index fc0a0d43d..7bd3cde74 100644 --- a/src/compositor/extensions/aurorawaylandivisurface_p.h +++ b/src/compositor/extensions/aurorawaylandivisurface_p.h @@ -59,7 +59,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviSurfacePrivate Q_DECLARE_PUBLIC(WaylandIviSurface) public: - WaylandIviSurfacePrivate(); + WaylandIviSurfacePrivate(WaylandIviSurface *self); static WaylandIviSurfacePrivate *get(WaylandIviSurface *iviSurface) { return iviSurface->d_func(); } protected: diff --git a/src/compositor/extensions/aurorawaylandpresentationtime.cpp b/src/compositor/extensions/aurorawaylandpresentationtime.cpp index 6f4bbef70..6cd671202 100644 --- a/src/compositor/extensions/aurorawaylandpresentationtime.cpp +++ b/src/compositor/extensions/aurorawaylandpresentationtime.cpp @@ -93,16 +93,22 @@ namespace Compositor { * Constructs a WaylandPresentationTime object for \a compositor. */ WaylandPresentationTime::WaylandPresentationTime(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandPresentationTimePrivate) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandPresentationTimePrivate(this)) { } +WaylandPresentationTime::~WaylandPresentationTime() +{ +} + /*! * Constructs an empty WaylandPresentationTime object. */ WaylandPresentationTime::WaylandPresentationTime() - : WaylandCompositorExtensionTemplate(*new WaylandPresentationTimePrivate) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandPresentationTimePrivate(this)) { } @@ -352,7 +358,8 @@ void PresentationFeedback::wp_presentation_feedback_destroy_resource(Resource *r delete this; } -WaylandPresentationTimePrivate::WaylandPresentationTimePrivate() +WaylandPresentationTimePrivate::WaylandPresentationTimePrivate(WaylandPresentationTime *self) + : WaylandCompositorExtensionPrivate(self) { } diff --git a/src/compositor/extensions/aurorawaylandpresentationtime_p.h b/src/compositor/extensions/aurorawaylandpresentationtime_p.h index 4e9eeb086..93e6b94b5 100644 --- a/src/compositor/extensions/aurorawaylandpresentationtime_p.h +++ b/src/compositor/extensions/aurorawaylandpresentationtime_p.h @@ -48,6 +48,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandPresentationTime : public WaylandCompos public: WaylandPresentationTime(); WaylandPresentationTime(WaylandCompositor *compositor); + ~WaylandPresentationTime(); WaylandCompositor *compositor() const; void initialize() override; @@ -59,6 +60,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandPresentationTime : public WaylandCompos signals: void presented(quint64 sequence, quint64 tv_sec, quint32 tv_nsec, quint32 refresh_nsec); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandpresentationtime_p_p.h b/src/compositor/extensions/aurorawaylandpresentationtime_p_p.h index e1132692d..9d6aa353d 100644 --- a/src/compositor/extensions/aurorawaylandpresentationtime_p_p.h +++ b/src/compositor/extensions/aurorawaylandpresentationtime_p_p.h @@ -99,7 +99,7 @@ class WaylandPresentationTimePrivate : public WaylandCompositorExtensionPrivate, { Q_DECLARE_PUBLIC(WaylandPresentationTime) public: - WaylandPresentationTimePrivate(); + WaylandPresentationTimePrivate(WaylandPresentationTime *self); protected: void wp_presentation_feedback(Resource *resource, struct ::wl_resource *surface, uint32_t callback) override; diff --git a/src/compositor/extensions/aurorawaylandqttextinputmethod.h b/src/compositor/extensions/aurorawaylandqttextinputmethod.h index cb03e0991..670b22e5e 100644 --- a/src/compositor/extensions/aurorawaylandqttextinputmethod.h +++ b/src/compositor/extensions/aurorawaylandqttextinputmethod.h @@ -71,6 +71,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQtTextInputMethod : public WaylandCompo void surfaceEnabled(Aurora::Compositor::WaylandSurface *surface); void surfaceDisabled(Aurora::Compositor::WaylandSurface *surface); +private: + QScopedPointer const d_ptr; + private Q_SLOTS: void sendVisibleChanged(); void sendKeyboardRectangleChanged(); diff --git a/src/compositor/extensions/aurorawaylandqtwindowmanager.cpp b/src/compositor/extensions/aurorawaylandqtwindowmanager.cpp index 2315a636f..507c04759 100644 --- a/src/compositor/extensions/aurorawaylandqtwindowmanager.cpp +++ b/src/compositor/extensions/aurorawaylandqtwindowmanager.cpp @@ -41,7 +41,8 @@ namespace Aurora { namespace Compositor { -WaylandQtWindowManagerPrivate::WaylandQtWindowManagerPrivate() +WaylandQtWindowManagerPrivate::WaylandQtWindowManagerPrivate(WaylandQtWindowManager *self) + : WaylandCompositorExtensionPrivate(self) { } @@ -78,12 +79,18 @@ void WaylandQtWindowManagerPrivate::windowmanager_open_url(Resource *resource, u } WaylandQtWindowManager::WaylandQtWindowManager() - : WaylandCompositorExtensionTemplate(*new WaylandQtWindowManagerPrivate()) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandQtWindowManagerPrivate(this)) { } WaylandQtWindowManager::WaylandQtWindowManager(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandQtWindowManagerPrivate()) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandQtWindowManagerPrivate(this)) +{ +} + +WaylandQtWindowManager::~WaylandQtWindowManager() { } diff --git a/src/compositor/extensions/aurorawaylandqtwindowmanager.h b/src/compositor/extensions/aurorawaylandqtwindowmanager.h index 0575227b0..7608fe1c1 100644 --- a/src/compositor/extensions/aurorawaylandqtwindowmanager.h +++ b/src/compositor/extensions/aurorawaylandqtwindowmanager.h @@ -50,6 +50,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQtWindowManager : public WaylandComposi public: WaylandQtWindowManager(); explicit WaylandQtWindowManager(WaylandCompositor *compositor); + ~WaylandQtWindowManager(); bool showIsFullScreen() const; void setShowIsFullScreen(bool value); @@ -64,6 +65,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQtWindowManager : public WaylandComposi Q_SIGNALS: void showIsFullScreenChanged(); void openUrl(Aurora::Compositor::WaylandClient *client, const QUrl &url); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandqtwindowmanager_p.h b/src/compositor/extensions/aurorawaylandqtwindowmanager_p.h index 916456ae8..4658a6f4f 100644 --- a/src/compositor/extensions/aurorawaylandqtwindowmanager_p.h +++ b/src/compositor/extensions/aurorawaylandqtwindowmanager_p.h @@ -58,7 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandQtWindowManagerPrivate { Q_DECLARE_PUBLIC(WaylandQtWindowManager) public: - WaylandQtWindowManagerPrivate(); + WaylandQtWindowManagerPrivate(WaylandQtWindowManager *self); protected: void windowmanager_bind_resource(Resource *resource) override; diff --git a/src/compositor/extensions/aurorawaylandshell.cpp b/src/compositor/extensions/aurorawaylandshell.cpp index 8b730b8ad..7c9acd87e 100644 --- a/src/compositor/extensions/aurorawaylandshell.cpp +++ b/src/compositor/extensions/aurorawaylandshell.cpp @@ -34,16 +34,25 @@ namespace Aurora { namespace Compositor { -WaylandShellPrivate::WaylandShellPrivate() +WaylandShellPrivate::WaylandShellPrivate(WaylandShell *self) + : WaylandCompositorExtensionPrivate(self) + , q_ptr(self) { } WaylandShell::WaylandShell() + : WaylandCompositorExtension() + , d_ptr(new WaylandShellPrivate(this)) { } WaylandShell::WaylandShell(WaylandObject *waylandObject) - : WaylandCompositorExtension(waylandObject, *new WaylandShellPrivate()) + : WaylandCompositorExtension(waylandObject) + , d_ptr(new WaylandShellPrivate(this)) +{ +} + +WaylandShell::~WaylandShell() { } @@ -84,16 +93,6 @@ void WaylandShell::setFocusPolicy(WaylandShell::FocusPolicy focusPolicy) emit focusPolicyChanged(); } -WaylandShell::WaylandShell(WaylandShellPrivate &dd) - : WaylandCompositorExtension(dd) -{ -} - -WaylandShell::WaylandShell(WaylandObject *container, WaylandShellPrivate &dd) - : WaylandCompositorExtension(container, dd) -{ -} - } // namespace Compositor } // namespace Aurora diff --git a/src/compositor/extensions/aurorawaylandshell.h b/src/compositor/extensions/aurorawaylandshell.h index 91fee857d..fb716d860 100644 --- a/src/compositor/extensions/aurorawaylandshell.h +++ b/src/compositor/extensions/aurorawaylandshell.h @@ -58,6 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShell : public WaylandCompositorExtensi WaylandShell(); WaylandShell(WaylandObject *waylandObject); + ~WaylandShell(); FocusPolicy focusPolicy() const; void setFocusPolicy(FocusPolicy focusPolicy); @@ -65,9 +66,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShell : public WaylandCompositorExtensi Q_SIGNALS: void focusPolicyChanged(); -protected: - explicit WaylandShell(WaylandShellPrivate &dd); - explicit WaylandShell(WaylandObject *container, WaylandShellPrivate &dd); +private: + QScopedPointer const d_ptr; }; template @@ -92,15 +92,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShellTemplate : public WaylandShell if (!container) return nullptr; return qobject_cast(container->extension(T::interfaceName())); } - -protected: - WaylandShellTemplate(WaylandShellPrivate &dd) - : WaylandShell(dd) - { } - - WaylandShellTemplate(WaylandObject *container, WaylandShellPrivate &dd) - : WaylandShell(container,dd) - { } }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandshell_p.h b/src/compositor/extensions/aurorawaylandshell_p.h index 456dc48f4..8da666a7c 100644 --- a/src/compositor/extensions/aurorawaylandshell_p.h +++ b/src/compositor/extensions/aurorawaylandshell_p.h @@ -52,9 +52,12 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShellPrivate : public WaylandCompositor { Q_DECLARE_PUBLIC(WaylandShell) public: - WaylandShellPrivate(); + WaylandShellPrivate(WaylandShell *self); WaylandShell::FocusPolicy focusPolicy = WaylandShell::AutomaticFocus; + +protected: + WaylandShell *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandshellsurface.h b/src/compositor/extensions/aurorawaylandshellsurface.h index 82750089d..cb86c3cbb 100644 --- a/src/compositor/extensions/aurorawaylandshellsurface.h +++ b/src/compositor/extensions/aurorawaylandshellsurface.h @@ -56,10 +56,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShellSurface : public WaylandCompositor WaylandShellSurface(WaylandObject *waylandObject) : WaylandCompositorExtension(waylandObject) {} virtual Qt::WindowType windowType() const { return Qt::WindowType::Window; } -protected: - WaylandShellSurface(WaylandCompositorExtensionPrivate &dd) : WaylandCompositorExtension(dd){} - WaylandShellSurface(WaylandObject *container, WaylandCompositorExtensionPrivate &dd) : WaylandCompositorExtension(container, dd) {} - Q_SIGNALS: void windowTypeChanged(); }; @@ -82,15 +78,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShellSurfaceTemplate : public WaylandSh if (!container) return nullptr; return qobject_cast(container->extension(T::interfaceName())); } - -protected: - WaylandShellSurfaceTemplate(WaylandCompositorExtensionPrivate &dd) - : WaylandShellSurface(dd) - { } - - WaylandShellSurfaceTemplate(WaylandObject *container, WaylandCompositorExtensionPrivate &dd) - : WaylandShellSurface(container,dd) - { } }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandtextinput.cpp b/src/compositor/extensions/aurorawaylandtextinput.cpp index 217fec958..d6acd769a 100644 --- a/src/compositor/extensions/aurorawaylandtextinput.cpp +++ b/src/compositor/extensions/aurorawaylandtextinput.cpp @@ -109,8 +109,9 @@ Qt::InputMethodQueries WaylandTextInputClientState::mergeChanged(const WaylandTe return queries; } -WaylandTextInputPrivate::WaylandTextInputPrivate(WaylandCompositor *compositor) - : compositor(compositor) +WaylandTextInputPrivate::WaylandTextInputPrivate(WaylandTextInput *self, WaylandCompositor *compositor) + : WaylandCompositorExtensionPrivate(self) + , compositor(compositor) , currentState(new WaylandTextInputClientState) , pendingState(new WaylandTextInputClientState) { @@ -504,7 +505,8 @@ void WaylandTextInputPrivate::zwp_text_input_v2_set_surrounding_text(Resource *r } WaylandTextInput::WaylandTextInput(WaylandObject *container, WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(container, *new WaylandTextInputPrivate(compositor)) + : WaylandCompositorExtensionTemplate(container) + , d_ptr(new WaylandTextInputPrivate(this, compositor)) { connect(&d_func()->focusDestroyListener, &WaylandDestroyListener::fired, this, &WaylandTextInput::focusSurfaceDestroyed); diff --git a/src/compositor/extensions/aurorawaylandtextinput.h b/src/compositor/extensions/aurorawaylandtextinput.h index e52ee209e..1a88ee1b5 100644 --- a/src/compositor/extensions/aurorawaylandtextinput.h +++ b/src/compositor/extensions/aurorawaylandtextinput.h @@ -73,6 +73,8 @@ class WaylandTextInput : public WaylandCompositorExtensionTemplate const d_ptr; + void focusSurfaceDestroyed(void *); void sendInputPanelState(); void sendTextDirection(); diff --git a/src/compositor/extensions/aurorawaylandtextinput_p.h b/src/compositor/extensions/aurorawaylandtextinput_p.h index c6de73a44..3e1c57dfd 100644 --- a/src/compositor/extensions/aurorawaylandtextinput_p.h +++ b/src/compositor/extensions/aurorawaylandtextinput_p.h @@ -83,7 +83,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandTextInputPrivate : public WaylandCompos { Q_DECLARE_PUBLIC(WaylandTextInput) public: - explicit WaylandTextInputPrivate(WaylandCompositor *compositor); + explicit WaylandTextInputPrivate(WaylandTextInput *self, WaylandCompositor *compositor); void sendInputMethodEvent(QInputMethodEvent *event); void sendKeyEvent(QKeyEvent *event); diff --git a/src/compositor/extensions/aurorawaylandtextinputmanager.cpp b/src/compositor/extensions/aurorawaylandtextinputmanager.cpp index 1be574071..fcb1edb58 100644 --- a/src/compositor/extensions/aurorawaylandtextinputmanager.cpp +++ b/src/compositor/extensions/aurorawaylandtextinputmanager.cpp @@ -39,7 +39,8 @@ namespace Aurora { namespace Compositor { -WaylandTextInputManagerPrivate::WaylandTextInputManagerPrivate() +WaylandTextInputManagerPrivate::WaylandTextInputManagerPrivate(WaylandTextInputManager *self) + : WaylandCompositorExtensionPrivate(self) { } @@ -87,12 +88,18 @@ void WaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(Re */ WaylandTextInputManager::WaylandTextInputManager() - : WaylandCompositorExtensionTemplate(*new WaylandTextInputManagerPrivate) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandTextInputManagerPrivate(this)) { } WaylandTextInputManager::WaylandTextInputManager(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandTextInputManagerPrivate) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandTextInputManagerPrivate(this)) +{ +} + +WaylandTextInputManager::~WaylandTextInputManager() { } diff --git a/src/compositor/extensions/aurorawaylandtextinputmanager.h b/src/compositor/extensions/aurorawaylandtextinputmanager.h index 7b9436d85..553e1de36 100644 --- a/src/compositor/extensions/aurorawaylandtextinputmanager.h +++ b/src/compositor/extensions/aurorawaylandtextinputmanager.h @@ -47,11 +47,15 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandTextInputManager : public WaylandCompos public: WaylandTextInputManager(); WaylandTextInputManager(WaylandCompositor *compositor); + ~WaylandTextInputManager(); void initialize() override; static const struct wl_interface *interface(); static QByteArray interfaceName(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandtextinputmanager_p.h b/src/compositor/extensions/aurorawaylandtextinputmanager_p.h index 28ac0bf5b..8106ebfc7 100644 --- a/src/compositor/extensions/aurorawaylandtextinputmanager_p.h +++ b/src/compositor/extensions/aurorawaylandtextinputmanager_p.h @@ -53,7 +53,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandTextInputManagerPrivate : public Waylan { Q_DECLARE_PUBLIC(WaylandTextInputManager) public: - WaylandTextInputManagerPrivate(); + WaylandTextInputManagerPrivate(WaylandTextInputManager *self); protected: void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override; diff --git a/src/compositor/extensions/aurorawaylandviewporter.cpp b/src/compositor/extensions/aurorawaylandviewporter.cpp index 6379e7319..1d792a309 100644 --- a/src/compositor/extensions/aurorawaylandviewporter.cpp +++ b/src/compositor/extensions/aurorawaylandviewporter.cpp @@ -54,7 +54,8 @@ namespace Compositor { Constructs a WaylandViewporter object. */ WaylandViewporter::WaylandViewporter() - : WaylandCompositorExtensionTemplate(*new WaylandViewporterPrivate) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandViewporterPrivate(this)) { } @@ -62,7 +63,12 @@ WaylandViewporter::WaylandViewporter() * Constructs a WaylandViewporter object for the provided \a compositor. */ WaylandViewporter::WaylandViewporter(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandViewporterPrivate()) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandViewporterPrivate(this)) +{ +} + +WaylandViewporter::~WaylandViewporter() { } @@ -90,6 +96,11 @@ const wl_interface *WaylandViewporter::interface() return WaylandViewporterPrivate::interface(); } +WaylandViewporterPrivate::WaylandViewporterPrivate(WaylandViewporter *self) + : WaylandCompositorExtensionPrivate(self) +{ +} + void WaylandViewporterPrivate::wp_viewporter_destroy(Resource *resource) { // Viewport objects are allowed ot outlive the viewporter diff --git a/src/compositor/extensions/aurorawaylandviewporter.h b/src/compositor/extensions/aurorawaylandviewporter.h index c4c6b6535..0916f120b 100644 --- a/src/compositor/extensions/aurorawaylandviewporter.h +++ b/src/compositor/extensions/aurorawaylandviewporter.h @@ -47,10 +47,14 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandViewporter public: explicit WaylandViewporter(); explicit WaylandViewporter(WaylandCompositor *compositor); + ~WaylandViewporter(); void initialize() override; static const struct wl_interface *interface(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandviewporter_p.h b/src/compositor/extensions/aurorawaylandviewporter_p.h index 7323dd565..26079d392 100644 --- a/src/compositor/extensions/aurorawaylandviewporter_p.h +++ b/src/compositor/extensions/aurorawaylandviewporter_p.h @@ -58,7 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandViewporterPrivate { Q_DECLARE_PUBLIC(WaylandViewporter) public: - explicit WaylandViewporterPrivate() = default; + explicit WaylandViewporterPrivate(WaylandViewporter *self); class LIRIAURORACOMPOSITOR_EXPORT Viewport : public PrivateServer::wp_viewport diff --git a/src/compositor/extensions/aurorawaylandwlshell.cpp b/src/compositor/extensions/aurorawaylandwlshell.cpp index e7137b66f..e3b9d5e9d 100644 --- a/src/compositor/extensions/aurorawaylandwlshell.cpp +++ b/src/compositor/extensions/aurorawaylandwlshell.cpp @@ -50,7 +50,8 @@ namespace Compositor { WaylandSurfaceRole WaylandWlShellSurfacePrivate::s_role("wl_shell_surface"); -WaylandWlShellPrivate::WaylandWlShellPrivate() +WaylandWlShellPrivate::WaylandWlShellPrivate(WaylandWlShell *self) + : WaylandShellPrivate(self) { } @@ -92,7 +93,8 @@ void WaylandWlShellPrivate::unregisterShellSurface(WaylandWlShellSurface *shellS qWarning("Unexpected state. Can't find registered shell surface."); } -WaylandWlShellSurfacePrivate::WaylandWlShellSurfacePrivate() +WaylandWlShellSurfacePrivate::WaylandWlShellSurfacePrivate(WaylandWlShellSurface *self) + : WaylandCompositorExtensionPrivate(self) { } @@ -289,16 +291,23 @@ void WaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource, * Constructs a WaylandWlShell object. */ WaylandWlShell::WaylandWlShell() - : WaylandShellTemplate(*new WaylandWlShellPrivate()) -{ } + : WaylandShellTemplate() + , d_ptr(new WaylandWlShellPrivate(this)) +{ +} /*! * Constructs a WaylandWlShell object for the provided \a compositor. */ WaylandWlShell::WaylandWlShell(WaylandCompositor *compositor) - : WaylandShellTemplate(compositor, *new WaylandWlShellPrivate()) -{ } + : WaylandShellTemplate(compositor) + , d_ptr(new WaylandWlShellPrivate(this)) +{ +} +WaylandWlShell::~WaylandWlShell() +{ +} /*! * Initializes the WlShell extension. @@ -445,7 +454,8 @@ QByteArray WaylandWlShell::interfaceName() * Constructs a WaylandWlShellSurface. */ WaylandWlShellSurface::WaylandWlShellSurface() - : WaylandShellSurfaceTemplate(*new WaylandWlShellSurfacePrivate) + : WaylandShellSurfaceTemplate() + , d_ptr(new WaylandWlShellSurfacePrivate(this)) { } @@ -453,7 +463,8 @@ WaylandWlShellSurface::WaylandWlShellSurface() * Constructs a WaylandWlShellSurface for \a surface and initializes it with the given \a shell and resource \a res. */ WaylandWlShellSurface::WaylandWlShellSurface(WaylandWlShell *shell, WaylandSurface *surface, const WaylandResource &res) - : WaylandShellSurfaceTemplate(*new WaylandWlShellSurfacePrivate) + : WaylandShellSurfaceTemplate() + , d_ptr(new WaylandWlShellSurfacePrivate(this)) { initialize(shell, surface, res); } diff --git a/src/compositor/extensions/aurorawaylandwlshell.h b/src/compositor/extensions/aurorawaylandwlshell.h index d065130ec..a2876cfa8 100644 --- a/src/compositor/extensions/aurorawaylandwlshell.h +++ b/src/compositor/extensions/aurorawaylandwlshell.h @@ -58,6 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandWlShell : public WaylandShellTemplate shellSurfaces() const; @@ -74,6 +75,9 @@ public Q_SLOTS: Q_SIGNALS: void wlShellSurfaceRequested(Aurora::Compositor::WaylandSurface *surface, const Aurora::Compositor::WaylandResource &resource); void wlShellSurfaceCreated(Aurora::Compositor::WaylandWlShellSurface *shellSurface); + +private: + QScopedPointer const d_ptr; }; class LIRIAURORACOMPOSITOR_EXPORT WaylandWlShellSurface : public WaylandShellSurfaceTemplate @@ -157,6 +161,8 @@ public Q_SLOTS: void setMaximized(Aurora::Compositor::WaylandOutput *output); private: + QScopedPointer const d_ptr; + void initialize() override; }; diff --git a/src/compositor/extensions/aurorawaylandwlshell_p.h b/src/compositor/extensions/aurorawaylandwlshell_p.h index 96e22bee6..168c7d186 100644 --- a/src/compositor/extensions/aurorawaylandwlshell_p.h +++ b/src/compositor/extensions/aurorawaylandwlshell_p.h @@ -65,7 +65,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandWlShellPrivate { Q_DECLARE_PUBLIC(WaylandWlShell) public: - WaylandWlShellPrivate(); + WaylandWlShellPrivate(WaylandWlShell *self); void unregisterShellSurface(WaylandWlShellSurface *shellSurface); @@ -83,7 +83,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandWlShellSurfacePrivate { Q_DECLARE_PUBLIC(WaylandWlShellSurface) public: - WaylandWlShellSurfacePrivate(); + WaylandWlShellSurfacePrivate(WaylandWlShellSurface *self); ~WaylandWlShellSurfacePrivate() override; static WaylandWlShellSurfacePrivate *get(WaylandWlShellSurface *surface) { return surface->d_func(); } diff --git a/src/compositor/extensions/aurorawaylandxdgdecorationv1.cpp b/src/compositor/extensions/aurorawaylandxdgdecorationv1.cpp index a0c67c084..cb91f23f9 100644 --- a/src/compositor/extensions/aurorawaylandxdgdecorationv1.cpp +++ b/src/compositor/extensions/aurorawaylandxdgdecorationv1.cpp @@ -94,7 +94,12 @@ namespace Compositor { Constructs a WaylandXdgDecorationManagerV1 object. */ WaylandXdgDecorationManagerV1::WaylandXdgDecorationManagerV1() - : WaylandCompositorExtensionTemplate(*new WaylandXdgDecorationManagerV1Private) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandXdgDecorationManagerV1Private(this)) +{ +} + +WaylandXdgDecorationManagerV1::~WaylandXdgDecorationManagerV1() { } @@ -154,6 +159,11 @@ const wl_interface *WaylandXdgDecorationManagerV1::interface() return WaylandXdgDecorationManagerV1Private::interface(); } +WaylandXdgDecorationManagerV1Private::WaylandXdgDecorationManagerV1Private(WaylandXdgDecorationManagerV1 *self) + : WaylandCompositorExtensionPrivate(self) +{ +} + void WaylandXdgDecorationManagerV1Private::zxdg_decoration_manager_v1_get_toplevel_decoration( Resource *resource, uint id, wl_resource *toplevelResource) { diff --git a/src/compositor/extensions/aurorawaylandxdgdecorationv1.h b/src/compositor/extensions/aurorawaylandxdgdecorationv1.h index cd3b36ab6..d3ec09339 100644 --- a/src/compositor/extensions/aurorawaylandxdgdecorationv1.h +++ b/src/compositor/extensions/aurorawaylandxdgdecorationv1.h @@ -47,6 +47,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgDecorationManagerV1 : public Wayland public: explicit WaylandXdgDecorationManagerV1(); + ~WaylandXdgDecorationManagerV1(); void initialize() override; @@ -57,6 +58,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgDecorationManagerV1 : public Wayland Q_SIGNALS: void preferredModeChanged(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandxdgdecorationv1_p.h b/src/compositor/extensions/aurorawaylandxdgdecorationv1_p.h index 690e9c9aa..5acfc3e8b 100644 --- a/src/compositor/extensions/aurorawaylandxdgdecorationv1_p.h +++ b/src/compositor/extensions/aurorawaylandxdgdecorationv1_p.h @@ -61,7 +61,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgDecorationManagerV1Private Q_DECLARE_PUBLIC(WaylandXdgDecorationManagerV1) public: using DecorationMode = WaylandXdgToplevel::DecorationMode; - explicit WaylandXdgDecorationManagerV1Private() {} + explicit WaylandXdgDecorationManagerV1Private(WaylandXdgDecorationManagerV1 *self); protected: void zxdg_decoration_manager_v1_get_toplevel_decoration(Resource *resource, uint id, ::wl_resource *toplevelResource) override; diff --git a/src/compositor/extensions/aurorawaylandxdgoutputv1.cpp b/src/compositor/extensions/aurorawaylandxdgoutputv1.cpp index b508d22de..770449cbd 100644 --- a/src/compositor/extensions/aurorawaylandxdgoutputv1.cpp +++ b/src/compositor/extensions/aurorawaylandxdgoutputv1.cpp @@ -114,7 +114,8 @@ namespace Compositor { * Constructs a WaylandXdgOutputManagerV1 object. */ WaylandXdgOutputManagerV1::WaylandXdgOutputManagerV1() - : WaylandCompositorExtensionTemplate(*new WaylandXdgOutputManagerV1Private()) + : WaylandCompositorExtensionTemplate() + , d_ptr(new WaylandXdgOutputManagerV1Private(this)) { } @@ -122,7 +123,12 @@ WaylandXdgOutputManagerV1::WaylandXdgOutputManagerV1() * Constructs a WaylandXdgOutputManagerV1 object for the provided \a compositor. */ WaylandXdgOutputManagerV1::WaylandXdgOutputManagerV1(WaylandCompositor *compositor) - : WaylandCompositorExtensionTemplate(compositor, *new WaylandXdgOutputManagerV1Private()) + : WaylandCompositorExtensionTemplate(compositor) + , d_ptr(new WaylandXdgOutputManagerV1Private(this)) +{ +} + +WaylandXdgOutputManagerV1::~WaylandXdgOutputManagerV1() { } @@ -154,6 +160,11 @@ const wl_interface *WaylandXdgOutputManagerV1::interface() // WaylandXdgOutputManagerV1Private +WaylandXdgOutputManagerV1Private::WaylandXdgOutputManagerV1Private(WaylandXdgOutputManagerV1 *self) + : WaylandCompositorExtensionPrivate(self) +{ +} + void WaylandXdgOutputManagerV1Private::registerXdgOutput(WaylandOutput *output, WaylandXdgOutputV1 *xdgOutput) { if (!xdgOutputs.contains(output)) { @@ -205,12 +216,14 @@ void WaylandXdgOutputManagerV1Private::zxdg_output_manager_v1_get_xdg_output(Res // WaylandXdgOutputV1 WaylandXdgOutputV1::WaylandXdgOutputV1() - : QObject(*new WaylandXdgOutputV1Private) + : QObject() + , d_ptr(new WaylandXdgOutputV1Private(this)) { } WaylandXdgOutputV1::WaylandXdgOutputV1(WaylandOutput *output, WaylandXdgOutputManagerV1 *manager) - : QObject(*new WaylandXdgOutputV1Private) + : QObject() + , d_ptr(new WaylandXdgOutputV1Private(this)) { Q_D(WaylandXdgOutputV1); @@ -477,6 +490,12 @@ QRect WaylandXdgOutputV1::logicalGeometry() const // WaylandXdgOutputV1Private +WaylandXdgOutputV1Private::WaylandXdgOutputV1Private(WaylandXdgOutputV1 *self) + : PrivateServer::zxdg_output_v1() + , q_ptr(self) +{ +} + void WaylandXdgOutputV1Private::sendLogicalPosition(const QPoint &position) { const auto values = resourceMap().values(); diff --git a/src/compositor/extensions/aurorawaylandxdgoutputv1.h b/src/compositor/extensions/aurorawaylandxdgoutputv1.h index 142090f28..0885c8743 100644 --- a/src/compositor/extensions/aurorawaylandxdgoutputv1.h +++ b/src/compositor/extensions/aurorawaylandxdgoutputv1.h @@ -51,10 +51,14 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputManagerV1 public: explicit WaylandXdgOutputManagerV1(); WaylandXdgOutputManagerV1(WaylandCompositor *compositor); + ~WaylandXdgOutputManagerV1(); void initialize() override; static const wl_interface *interface(); + +private: + QScopedPointer const d_ptr; }; class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputV1 : public QObject @@ -102,6 +106,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputV1 : public QObject void logicalGeometryChanged(); void nameChanged(); void descriptionChanged(); + +private: + QScopedPointer const d_ptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandxdgoutputv1_p.h b/src/compositor/extensions/aurorawaylandxdgoutputv1_p.h index a1f50197a..d4ae4e5af 100644 --- a/src/compositor/extensions/aurorawaylandxdgoutputv1_p.h +++ b/src/compositor/extensions/aurorawaylandxdgoutputv1_p.h @@ -58,7 +58,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputManagerV1Private { Q_DECLARE_PUBLIC(WaylandXdgOutputManagerV1) public: - explicit WaylandXdgOutputManagerV1Private() = default; + explicit WaylandXdgOutputManagerV1Private(WaylandXdgOutputManagerV1 *self); void registerXdgOutput(WaylandOutput *output, WaylandXdgOutputV1 *xdgOutput); void unregisterXdgOutput(WaylandOutput *output); @@ -74,12 +74,11 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputManagerV1Private }; class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputV1Private - : public QObjectPrivate - , public PrivateServer::zxdg_output_v1 + : public PrivateServer::zxdg_output_v1 { Q_DECLARE_PUBLIC(WaylandXdgOutputV1) public: - explicit WaylandXdgOutputV1Private() = default; + explicit WaylandXdgOutputV1Private(WaylandXdgOutputV1 *self); void sendLogicalPosition(const QPoint &position); void sendLogicalSize(const QSize &size); @@ -102,6 +101,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgOutputV1Private protected: void zxdg_output_v1_bind_resource(Resource *resource) override; void zxdg_output_v1_destroy(Resource *resource) override; + +private: + WaylandXdgOutputV1 *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/compositor/extensions/aurorawaylandxdgshell.cpp b/src/compositor/extensions/aurorawaylandxdgshell.cpp index 58b22639b..da81f7a6c 100644 --- a/src/compositor/extensions/aurorawaylandxdgshell.cpp +++ b/src/compositor/extensions/aurorawaylandxdgshell.cpp @@ -49,7 +49,8 @@ namespace Aurora { namespace Compositor { -WaylandXdgShellPrivate::WaylandXdgShellPrivate() +WaylandXdgShellPrivate::WaylandXdgShellPrivate(WaylandXdgShell *self) + : WaylandShellPrivate(self) { } @@ -179,7 +180,8 @@ void WaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t seria * Constructs a WaylandXdgShell object. */ WaylandXdgShell::WaylandXdgShell() - : WaylandShellTemplate(*new WaylandXdgShellPrivate()) + : WaylandShellTemplate() + , d_ptr(new WaylandXdgShellPrivate(this)) { } @@ -187,7 +189,12 @@ WaylandXdgShell::WaylandXdgShell() * Constructs a WaylandXdgShell object for the provided \a compositor. */ WaylandXdgShell::WaylandXdgShell(WaylandCompositor *compositor) - : WaylandShellTemplate(compositor, *new WaylandXdgShellPrivate()) + : WaylandShellTemplate(compositor) + , d_ptr(new WaylandXdgShellPrivate(this)) +{ +} + +WaylandXdgShell::~WaylandXdgShell() { } @@ -278,7 +285,8 @@ void WaylandXdgShell::handleFocusChanged(WaylandSurface *newSurface, WaylandSurf WaylandXdgSurfacePrivate::get(oldXdgSurface)->handleFocusLost(); } -WaylandXdgSurfacePrivate::WaylandXdgSurfacePrivate() +WaylandXdgSurfacePrivate::WaylandXdgSurfacePrivate(WaylandXdgSurface *self) + : WaylandCompositorExtensionPrivate(self) { } @@ -488,7 +496,8 @@ void WaylandXdgSurfacePrivate::xdg_surface_set_window_geometry(PrivateServer::xd * Constructs a WaylandXdgSurface. */ WaylandXdgSurface::WaylandXdgSurface() - : WaylandShellSurfaceTemplate(*new WaylandXdgSurfacePrivate) + : WaylandShellSurfaceTemplate() + , d_ptr(new WaylandXdgSurfacePrivate(this)) { } @@ -497,11 +506,16 @@ WaylandXdgSurface::WaylandXdgSurface() * given \a xdgShell, \a surface, and resource \a res. */ WaylandXdgSurface::WaylandXdgSurface(WaylandXdgShell *xdgShell, WaylandSurface *surface, const WaylandResource &res) - : WaylandShellSurfaceTemplate(*new WaylandXdgSurfacePrivate) + : WaylandShellSurfaceTemplate() + , d_ptr(new WaylandXdgSurfacePrivate(this)) { initialize(xdgShell, surface, res); } +WaylandXdgSurface::~WaylandXdgSurface() +{ +} + /*! * \qmlmethod void AuroraCompositor::XdgSurface::initialize(object xdgShell, object surface, object client, int id) * @@ -736,7 +750,8 @@ WaylandQuickShellIntegration *WaylandXdgSurface::createIntegration(WaylandQuickS * Constructs a WaylandXdgToplevel for the given \a xdgSurface and \a resource. */ WaylandXdgToplevel::WaylandXdgToplevel(WaylandXdgSurface *xdgSurface, WaylandResource &resource) - : QObject(*new WaylandXdgToplevelPrivate(xdgSurface, resource)) + : QObject() + , d_ptr(new WaylandXdgToplevelPrivate(this, xdgSurface, resource)) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QList states; @@ -1307,8 +1322,9 @@ QList WaylandXdgToplevel::statesAsInts() const WaylandSurfaceRole WaylandXdgToplevelPrivate::s_role("xdg_toplevel"); -WaylandXdgToplevelPrivate::WaylandXdgToplevelPrivate(WaylandXdgSurface *xdgSurface, const WaylandResource &resource) +WaylandXdgToplevelPrivate::WaylandXdgToplevelPrivate(WaylandXdgToplevel *self, WaylandXdgSurface *xdgSurface, const WaylandResource &resource) : m_xdgSurface(xdgSurface) + , q_ptr(self) { init(resource.resource()); } @@ -1595,7 +1611,12 @@ void WaylandXdgToplevelPrivate::xdg_toplevel_set_minimized(PrivateServer::xdg_to */ WaylandXdgPopup::WaylandXdgPopup(WaylandXdgSurface *xdgSurface, WaylandXdgSurface *parentXdgSurface, WaylandXdgPositioner *positioner, WaylandResource &resource) - : QObject(*new WaylandXdgPopupPrivate(xdgSurface, parentXdgSurface, positioner, resource)) + : QObject() + , d_ptr(new WaylandXdgPopupPrivate(this, xdgSurface, parentXdgSurface, positioner, resource)) +{ +} + +WaylandXdgPopup::~WaylandXdgPopup() { } @@ -1919,9 +1940,11 @@ WaylandSurfaceRole *WaylandXdgPopup::role() return &WaylandXdgPopupPrivate::s_role; } -WaylandXdgPopupPrivate::WaylandXdgPopupPrivate(WaylandXdgSurface *xdgSurface, WaylandXdgSurface *parentXdgSurface, - WaylandXdgPositioner *positioner, const WaylandResource &resource) - : m_xdgSurface(xdgSurface) +WaylandXdgPopupPrivate::WaylandXdgPopupPrivate(WaylandXdgPopup *self, + WaylandXdgSurface *xdgSurface, WaylandXdgSurface *parentXdgSurface, + WaylandXdgPositioner *positioner, const WaylandResource &resource) + : q_ptr(self) + , m_xdgSurface(xdgSurface) , m_parentXdgSurface(parentXdgSurface) , m_positionerData(positioner->m_data) { @@ -1934,6 +1957,10 @@ WaylandXdgPopupPrivate::WaylandXdgPopupPrivate(WaylandXdgSurface *xdgSurface, Wa sendConfigure(QRect(m_positionerData.unconstrainedPosition(), m_positionerData.size)); } +WaylandXdgPopupPrivate::~WaylandXdgPopupPrivate() +{ +} + void WaylandXdgPopupPrivate::handleAckConfigure(uint serial) { Q_Q(WaylandXdgPopup); diff --git a/src/compositor/extensions/aurorawaylandxdgshell.h b/src/compositor/extensions/aurorawaylandxdgshell.h index c5ce06e70..a7f46148d 100644 --- a/src/compositor/extensions/aurorawaylandxdgshell.h +++ b/src/compositor/extensions/aurorawaylandxdgshell.h @@ -65,6 +65,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgShell : public WaylandShellTemplate< public: explicit WaylandXdgShell(); explicit WaylandXdgShell(WaylandCompositor *compositor); + ~WaylandXdgShell(); void initialize() override; @@ -83,6 +84,9 @@ public Q_SLOTS: private Q_SLOTS: void handleSeatChanged(Aurora::Compositor::WaylandSeat *newSeat, Aurora::Compositor::WaylandSeat *oldSeat); void handleFocusChanged(Aurora::Compositor::WaylandSurface *newSurface, Aurora::Compositor::WaylandSurface *oldSurface); + +private: + QScopedPointer const d_ptr; }; class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurface : public WaylandShellSurfaceTemplate @@ -101,6 +105,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurface : public WaylandShellSurface public: explicit WaylandXdgSurface(); explicit WaylandXdgSurface(WaylandXdgShell* xdgShell, WaylandSurface *surface, const WaylandResource &resource); + ~WaylandXdgSurface(); Q_INVOKABLE void initialize(Aurora::Compositor::WaylandXdgShell* xdgShell, Aurora::Compositor::WaylandSurface *surface, const Aurora::Compositor::WaylandResource &resource); @@ -128,6 +133,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurface : public WaylandShellSurface void windowGeometryChanged(); private: + QScopedPointer const d_ptr; + void initialize() override; private Q_SLOTS: @@ -233,6 +240,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgToplevel : public QObject void decorationModeChanged(); private: + QScopedPointer const d_ptr; + QList statesAsInts() const; }; @@ -255,6 +264,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgPopup : public QObject Q_PROPERTY(QSize positionerSize READ positionerSize CONSTANT) Q_PROPERTY(QPoint unconstrainedPosition READ unconstrainedPosition CONSTANT) public: + ~WaylandXdgPopup(); + WaylandXdgSurface *xdgSurface() const; WaylandXdgSurface *parentXdgSurface() const; QRect configuredGeometry() const; @@ -279,6 +290,8 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgPopup : public QObject void configuredGeometryChanged(); private: + QScopedPointer const d_ptr; + explicit WaylandXdgPopup(WaylandXdgSurface *xdgSurface, WaylandXdgSurface *parentXdgSurface, WaylandXdgPositioner *positioner, WaylandResource &resource); friend class WaylandXdgSurfacePrivate; diff --git a/src/compositor/extensions/aurorawaylandxdgshell_p.h b/src/compositor/extensions/aurorawaylandxdgshell_p.h index e79204652..da3d7c2cf 100644 --- a/src/compositor/extensions/aurorawaylandxdgshell_p.h +++ b/src/compositor/extensions/aurorawaylandxdgshell_p.h @@ -74,7 +74,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgShellPrivate { Q_DECLARE_PUBLIC(WaylandXdgShell) public: - WaylandXdgShellPrivate(); + WaylandXdgShellPrivate(WaylandXdgShell *self); void ping(Resource *resource, uint32_t serial); void registerXdgSurface(WaylandXdgSurface *xdgSurface); void unregisterXdgSurface(WaylandXdgSurface *xdgSurface); @@ -99,7 +99,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurfacePrivate { Q_DECLARE_PUBLIC(WaylandXdgSurface) public: - WaylandXdgSurfacePrivate(); + WaylandXdgSurfacePrivate(WaylandXdgSurface *self); void setWindowType(Qt::WindowType windowType); void handleFocusLost(); void handleFocusReceived(); @@ -127,7 +127,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurfacePrivate void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; }; -class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgToplevelPrivate : public QObjectPrivate, public PrivateServer::xdg_toplevel +class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgToplevelPrivate : public PrivateServer::xdg_toplevel { Q_DECLARE_PUBLIC(WaylandXdgToplevel) public: @@ -151,7 +151,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgToplevelPrivate : public QObjectPriv uint serial = 0; }; - WaylandXdgToplevelPrivate(WaylandXdgSurface *xdgSurface, const WaylandResource& resource); + WaylandXdgToplevelPrivate(WaylandXdgToplevel *self, WaylandXdgSurface *xdgSurface, const WaylandResource& resource); ConfigureEvent lastSentConfigure() const { return m_pendingConfigures.empty() ? m_lastAckedConfigure : m_pendingConfigures.last(); } void handleAckConfigure(uint serial); //TODO: move? void handleFocusLost(); @@ -191,9 +191,12 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgToplevelPrivate : public QObjectPriv WaylandXdgToplevelDecorationV1 *m_decoration = nullptr; static WaylandSurfaceRole s_role; + +private: + WaylandXdgToplevel *q_ptr = nullptr; }; -class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgPopupPrivate : public QObjectPrivate, public PrivateServer::xdg_popup +class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgPopupPrivate : public PrivateServer::xdg_popup { Q_DECLARE_PUBLIC(WaylandXdgPopup) public: @@ -202,8 +205,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgPopupPrivate : public QObjectPrivate uint serial; }; - WaylandXdgPopupPrivate(WaylandXdgSurface *xdgSurface, WaylandXdgSurface *parentXdgSurface, + WaylandXdgPopupPrivate(WaylandXdgPopup *self, WaylandXdgSurface *xdgSurface, WaylandXdgSurface *parentXdgSurface, WaylandXdgPositioner *positioner, const WaylandResource& resource); + ~WaylandXdgPopupPrivate(); void handleAckConfigure(uint serial); @@ -219,6 +223,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgPopupPrivate : public QObjectPrivate void xdg_popup_grab(Resource *resource, struct ::wl_resource *seat, uint32_t serial) override; private: + WaylandXdgPopup *q_ptr = nullptr; WaylandXdgSurface *m_xdgSurface = nullptr; WaylandXdgSurface *m_parentXdgSurface = nullptr; WaylandXdgPositionerData m_positionerData; diff --git a/src/compositor/global/aurorawaylandcompositorextension.cpp b/src/compositor/global/aurorawaylandcompositorextension.cpp index c23f56c00..ce44184bc 100644 --- a/src/compositor/global/aurorawaylandcompositorextension.cpp +++ b/src/compositor/global/aurorawaylandcompositorextension.cpp @@ -105,7 +105,8 @@ namespace Compositor { * \sa setExtensionContainer() */ WaylandCompositorExtension::WaylandCompositorExtension() - : WaylandObject(*new WaylandCompositorExtensionPrivate()) + : WaylandObject() + , d_ptr(new WaylandCompositorExtensionPrivate(this)) { } @@ -119,19 +120,8 @@ WaylandCompositorExtension::WaylandCompositorExtension() * The WaylandCompositorExtension will remove itself again when it is destroyed. */ WaylandCompositorExtension::WaylandCompositorExtension(WaylandObject *container) - : WaylandObject(*new WaylandCompositorExtensionPrivate()) -{ - d_func()->extension_container = container; - QCoreApplication::postEvent(this, new QEvent(QEvent::Polish)); -} - -WaylandCompositorExtension::WaylandCompositorExtension(WaylandCompositorExtensionPrivate &dd) - : WaylandObject(dd) -{ -} - -WaylandCompositorExtension::WaylandCompositorExtension(WaylandObject *container, WaylandCompositorExtensionPrivate &dd) - : WaylandObject(dd) + : WaylandObject() + , d_ptr(new WaylandCompositorExtensionPrivate(this)) { d_func()->extension_container = container; QCoreApplication::postEvent(this, new QEvent(QEvent::Polish)); @@ -242,11 +232,6 @@ WaylandObject::WaylandObject(QObject *parent) { } -WaylandObject::WaylandObject(QObjectPrivate &d, QObject *parent) - :QObject(d, parent) -{ -} - WaylandObject::~WaylandObject() { diff --git a/src/compositor/global/aurorawaylandcompositorextension.h b/src/compositor/global/aurorawaylandcompositorextension.h index 3e09c034f..c04f2e0fb 100644 --- a/src/compositor/global/aurorawaylandcompositorextension.h +++ b/src/compositor/global/aurorawaylandcompositorextension.h @@ -59,7 +59,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandObject : public QObject protected: WaylandObject(QObject *parent = nullptr); - WaylandObject(QObjectPrivate &d, QObject *parent = nullptr); QList extension_vector; }; @@ -86,10 +85,10 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorExtension : public WaylandObj virtual const struct wl_interface *extensionInterface() const = 0; protected: - WaylandCompositorExtension(WaylandCompositorExtensionPrivate &dd); - WaylandCompositorExtension(WaylandObject *container, WaylandCompositorExtensionPrivate &dd); - bool event(QEvent *event) override; + +private: + QScopedPointer const d_ptr; }; template @@ -114,15 +113,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorExtensionTemplate : public Wa if (!container) return nullptr; return qobject_cast(container->extension(T::interfaceName())); } - -protected: - WaylandCompositorExtensionTemplate(WaylandCompositorExtensionPrivate &dd) - : WaylandCompositorExtension(dd) - { } - - WaylandCompositorExtensionTemplate(WaylandObject *container, WaylandCompositorExtensionPrivate &dd) - : WaylandCompositorExtension(container,dd) - { } }; } // namespace Compositor diff --git a/src/compositor/global/aurorawaylandcompositorextension_p.h b/src/compositor/global/aurorawaylandcompositorextension_p.h index 92eef0370..e839d09d7 100644 --- a/src/compositor/global/aurorawaylandcompositorextension_p.h +++ b/src/compositor/global/aurorawaylandcompositorextension_p.h @@ -41,20 +41,19 @@ // We mean it. // -#include - #include namespace Aurora { namespace Compositor { -class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorExtensionPrivate : public QObjectPrivate +class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorExtensionPrivate { Q_DECLARE_PUBLIC(WaylandCompositorExtension) public: - WaylandCompositorExtensionPrivate() + WaylandCompositorExtensionPrivate(WaylandCompositorExtension *self) + : q_ptr(self) { } @@ -62,6 +61,9 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandCompositorExtensionPrivate : public QOb WaylandObject *extension_container = nullptr; bool initialized = false; + +protected: + WaylandCompositorExtension *q_ptr = nullptr; }; } // namespace Compositor diff --git a/src/platformsupport/libinput/libinputhandler.cpp b/src/platformsupport/libinput/libinputhandler.cpp index 3bdeee283..c1a69dd2f 100644 --- a/src/platformsupport/libinput/libinputhandler.cpp +++ b/src/platformsupport/libinput/libinputhandler.cpp @@ -48,8 +48,9 @@ const struct libinput_interface LibInputHandlerPrivate::liInterface = { LibInputHandlerPrivate::restrictedCloseCallback }; -LibInputHandlerPrivate::LibInputHandlerPrivate() - : initialized(false) +LibInputHandlerPrivate::LibInputHandlerPrivate(LibInputHandler *self) + : q_ptr(self) + , initialized(false) , udev(nullptr) , li(nullptr) , keyboard(nullptr) @@ -254,7 +255,8 @@ void LibInputHandlerPrivate::restrictedClose(int fd) */ LibInputHandler::LibInputHandler(QObject *parent) - : QObject(*new LibInputHandlerPrivate, parent) + : QObject(parent) + , d_ptr(new LibInputHandlerPrivate(this)) { Q_D(LibInputHandler); @@ -278,6 +280,10 @@ LibInputHandler::LibInputHandler(QObject *parent) }); } +LibInputHandler::~LibInputHandler() +{ +} + bool LibInputHandler::isSuspended() const { Q_D(const LibInputHandler); diff --git a/src/platformsupport/libinput/libinputhandler.h b/src/platformsupport/libinput/libinputhandler.h index a8cceb18c..fe7cd48d1 100644 --- a/src/platformsupport/libinput/libinputhandler.h +++ b/src/platformsupport/libinput/libinputhandler.h @@ -84,6 +84,7 @@ class LIRIAURORALIBINPUT_EXPORT LibInputHandler : public QObject Q_DECLARE_FLAGS(Capabilities, CapabilityFlag) LibInputHandler(QObject *parent = 0); + ~LibInputHandler(); LibInputHandler::Capabilities capabilities() const; @@ -128,6 +129,9 @@ public Q_SLOTS: private Q_SLOTS: void handleEvents(); + +private: + QScopedPointer const d_ptr; }; Q_DECLARE_OPERATORS_FOR_FLAGS(LibInputHandler::Capabilities) diff --git a/src/platformsupport/libinput/libinputhandler_p.h b/src/platformsupport/libinput/libinputhandler_p.h index e84cec470..b711dce22 100644 --- a/src/platformsupport/libinput/libinputhandler_p.h +++ b/src/platformsupport/libinput/libinputhandler_p.h @@ -55,11 +55,11 @@ namespace Liri { namespace Platform { -class LIRIAURORALIBINPUT_EXPORT LibInputHandlerPrivate : public QObjectPrivate +class LIRIAURORALIBINPUT_EXPORT LibInputHandlerPrivate { Q_DECLARE_PUBLIC(LibInputHandler) public: - LibInputHandlerPrivate(); + LibInputHandlerPrivate(LibInputHandler *self); ~LibInputHandlerPrivate(); void setup(); @@ -95,6 +95,8 @@ class LIRIAURORALIBINPUT_EXPORT LibInputHandlerPrivate : public QObjectPrivate static const struct libinput_interface liInterface; private: + LibInputHandler *q_ptr = nullptr; + int restrictedOpen(const char *path, int flags); void restrictedClose(int fd); }; diff --git a/src/platformsupport/libinput/libinputkeyboard.cpp b/src/platformsupport/libinput/libinputkeyboard.cpp index 3eecee899..c1e03f9c5 100644 --- a/src/platformsupport/libinput/libinputkeyboard.cpp +++ b/src/platformsupport/libinput/libinputkeyboard.cpp @@ -49,8 +49,9 @@ namespace Platform { * LibInputKeyboardPrivate */ -LibInputKeyboardPrivate::LibInputKeyboardPrivate(LibInputHandler *h) - : handler(h) +LibInputKeyboardPrivate::LibInputKeyboardPrivate(LibInputKeyboard *self, LibInputHandler *h) + : q_ptr(self) + , handler(h) , context(nullptr) , keymap(nullptr) , state(nullptr) @@ -105,12 +106,17 @@ LibInputKeyboardPrivate::~LibInputKeyboardPrivate() */ LibInputKeyboard::LibInputKeyboard(LibInputHandler *handler, QObject *parent) - : QObject(*new LibInputKeyboardPrivate(handler), parent) + : QObject(parent) + , d_ptr(new LibInputKeyboardPrivate(this, handler)) { Q_D(LibInputKeyboard); connect(&d->repeatTimer, &QTimer::timeout, this, &LibInputKeyboard::handleRepeat); } +LibInputKeyboard::~LibInputKeyboard() +{ +} + void LibInputKeyboard::handleKey(libinput_event_keyboard *event) { Q_D(LibInputKeyboard); diff --git a/src/platformsupport/libinput/libinputkeyboard.h b/src/platformsupport/libinput/libinputkeyboard.h index dd88c1e16..462a3ee71 100644 --- a/src/platformsupport/libinput/libinputkeyboard.h +++ b/src/platformsupport/libinput/libinputkeyboard.h @@ -52,11 +52,15 @@ class LIRIAURORALIBINPUT_EXPORT LibInputKeyboard : public QObject Q_DECLARE_PRIVATE(LibInputKeyboard) public: explicit LibInputKeyboard(LibInputHandler *handler, QObject *parent = 0); + ~LibInputKeyboard(); void handleKey(libinput_event_keyboard *event); private Q_SLOTS: void handleRepeat(); + +private: + QScopedPointer const d_ptr; }; } // namespace Platform diff --git a/src/platformsupport/libinput/libinputkeyboard_p.h b/src/platformsupport/libinput/libinputkeyboard_p.h index 1476c970a..dfe84293d 100644 --- a/src/platformsupport/libinput/libinputkeyboard_p.h +++ b/src/platformsupport/libinput/libinputkeyboard_p.h @@ -34,8 +34,6 @@ #ifndef LIRI_LIBINPUTKEYBOARD_P_H #define LIRI_LIBINPUTKEYBOARD_P_H -#include - #include "eglfsxkb.h" #include "libinputhandler.h" #include "libinputkeyboard.h" @@ -57,11 +55,11 @@ namespace Liri { namespace Platform { -class LIRIAURORALIBINPUT_EXPORT LibInputKeyboardPrivate : public QObjectPrivate +class LIRIAURORALIBINPUT_EXPORT LibInputKeyboardPrivate { Q_DECLARE_PUBLIC(LibInputKeyboard) public: - LibInputKeyboardPrivate(LibInputHandler *h); + LibInputKeyboardPrivate(LibInputKeyboard *self, LibInputHandler *h); ~LibInputKeyboardPrivate(); LibInputHandler *handler; @@ -83,6 +81,9 @@ class LIRIAURORALIBINPUT_EXPORT LibInputKeyboardPrivate : public QObjectPrivate QString text; ushort repeatCount; } repeatData; + +private: + LibInputKeyboard *q_ptr = nullptr; }; } // namespace Platform