From 68ce470231be3858467d0a1d172751d382cc99be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 20 Nov 2014 16:40:14 +0100 Subject: [PATCH] Add a parentResource to Resource --- .../autotests/client/test_datadevice.cpp | 1 + .../autotests/client/test_datasource.cpp | 1 + .../autotests/client/test_wayland_region.cpp | 1 + .../autotests/client/test_wayland_shell.cpp | 1 + .../client/test_wayland_subsurface.cpp | 1 + .../autotests/client/test_wayland_surface.cpp | 1 + src/wayland/compositor_interface.cpp | 4 ++-- src/wayland/datadevice_interface.cpp | 12 ++++++------ src/wayland/datadevice_interface.h | 2 +- src/wayland/datadevicemanager_interface.cpp | 4 ++-- src/wayland/dataoffer_interface.cpp | 10 +++++----- src/wayland/dataoffer_interface.h | 2 +- src/wayland/datasource_interface.cpp | 10 +++++----- src/wayland/datasource_interface.h | 2 +- src/wayland/region_interface.cpp | 10 +++++----- src/wayland/server/region_interface.h | 2 +- src/wayland/server/resource.cpp | 10 ++++++++-- src/wayland/server/resource.h | 1 + src/wayland/server/resource_p.h | 3 ++- src/wayland/server/shell_interface.cpp | 18 +++++++++--------- src/wayland/server/shell_interface.h | 2 +- src/wayland/subcompositor_interface.cpp | 10 +++++----- src/wayland/subcompositor_interface.h | 2 +- src/wayland/subsurface_interface_p.h | 2 +- src/wayland/surface_interface.cpp | 8 ++++---- src/wayland/surface_interface.h | 2 +- src/wayland/surface_interface_p.h | 2 +- 27 files changed, 69 insertions(+), 55 deletions(-) diff --git a/src/wayland/autotests/client/test_datadevice.cpp b/src/wayland/autotests/client/test_datadevice.cpp index a5bff84581..fc9398d54b 100644 --- a/src/wayland/autotests/client/test_datadevice.cpp +++ b/src/wayland/autotests/client/test_datadevice.cpp @@ -189,6 +189,7 @@ void TestDataDevice::testCreate() QVERIFY(!deviceInterface->origin()); QVERIFY(!deviceInterface->icon()); QVERIFY(!deviceInterface->selection()); + QVERIFY(deviceInterface->parentResource()); } void TestDataDevice::testDrag() diff --git a/src/wayland/autotests/client/test_datasource.cpp b/src/wayland/autotests/client/test_datasource.cpp index 73c520988f..d391b85734 100644 --- a/src/wayland/autotests/client/test_datasource.cpp +++ b/src/wayland/autotests/client/test_datasource.cpp @@ -143,6 +143,7 @@ void TestDataSource::testOffer() QPointer serverDataSource = dataSourceCreatedSpy.first().first().value(); QVERIFY(!serverDataSource.isNull()); QCOMPARE(serverDataSource->mimeTypes().count(), 0); + QVERIFY(serverDataSource->parentResource()); QSignalSpy offeredSpy(serverDataSource.data(), SIGNAL(mimeTypeOffered(const QString&))); QVERIFY(offeredSpy.isValid()); diff --git a/src/wayland/autotests/client/test_wayland_region.cpp b/src/wayland/autotests/client/test_wayland_region.cpp index 5d5d02762e..2fda3d69e0 100644 --- a/src/wayland/autotests/client/test_wayland_region.cpp +++ b/src/wayland/autotests/client/test_wayland_region.cpp @@ -167,6 +167,7 @@ void TestRegion::testCreateWithRegion() auto serverRegion = regionCreatedSpy.first().first().value(); QVERIFY(serverRegion); QCOMPARE(serverRegion->region(), QRegion(0, 0, 10, 20)); + QVERIFY(serverRegion->parentResource()); } void TestRegion::testCreateUniquePtr() diff --git a/src/wayland/autotests/client/test_wayland_shell.cpp b/src/wayland/autotests/client/test_wayland_shell.cpp index 7e5963d100..2957baf426 100644 --- a/src/wayland/autotests/client/test_wayland_shell.cpp +++ b/src/wayland/autotests/client/test_wayland_shell.cpp @@ -223,6 +223,7 @@ void TestWaylandShell::testFullscreen() QVERIFY(serverSurfaceSpy.wait()); ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value(); QVERIFY(serverSurface); + QVERIFY(serverSurface->parentResource()); QSignalSpy fullscreenSpy(serverSurface, SIGNAL(fullscreenChanged(bool))); QVERIFY(fullscreenSpy.isValid()); diff --git a/src/wayland/autotests/client/test_wayland_subsurface.cpp b/src/wayland/autotests/client/test_wayland_subsurface.cpp index c94ebfba6f..03ffb50746 100644 --- a/src/wayland/autotests/client/test_wayland_subsurface.cpp +++ b/src/wayland/autotests/client/test_wayland_subsurface.cpp @@ -188,6 +188,7 @@ void TestSubSurface::testCreate() QVERIFY(subSurfaceCreatedSpy.wait()); SubSurfaceInterface *serverSubSurface = subSurfaceCreatedSpy.first().first().value(); QVERIFY(serverSubSurface); + QVERIFY(serverSubSurface->parentSurface()); QCOMPARE(serverSubSurface->parentSurface().data(), serverParentSurface); QCOMPARE(serverSubSurface->surface().data(), serverSurface); QCOMPARE(serverSurface->subSurface().data(), serverSubSurface); diff --git a/src/wayland/autotests/client/test_wayland_surface.cpp b/src/wayland/autotests/client/test_wayland_surface.cpp index 8ae6f9ceab..58f2fae6ce 100644 --- a/src/wayland/autotests/client/test_wayland_surface.cpp +++ b/src/wayland/autotests/client/test_wayland_surface.cpp @@ -193,6 +193,7 @@ void TestWaylandSurface::testDamage() KWayland::Server::SurfaceInterface *serverSurface = serverSurfaceCreated.first().first().value(); QVERIFY(serverSurface); QCOMPARE(serverSurface->damage(), QRegion()); + QVERIFY(serverSurface->parentResource()); QSignalSpy damageSpy(serverSurface, SIGNAL(damaged(QRegion))); QVERIFY(damageSpy.isValid()); diff --git a/src/wayland/compositor_interface.cpp b/src/wayland/compositor_interface.cpp index a1625f35c7..59fa274191 100644 --- a/src/wayland/compositor_interface.cpp +++ b/src/wayland/compositor_interface.cpp @@ -95,7 +95,7 @@ void CompositorInterface::Private::createSurfaceCallback(wl_client *client, wl_r void CompositorInterface::Private::createSurface(wl_client *client, wl_resource *resource, uint32_t id) { - SurfaceInterface *surface = new SurfaceInterface(q); + SurfaceInterface *surface = new SurfaceInterface(q, resource); surface->create(display->getConnection(client), wl_resource_get_version(resource), id); if (!surface->resource()) { wl_resource_post_no_memory(resource); @@ -112,7 +112,7 @@ void CompositorInterface::Private::createRegionCallback(wl_client *client, wl_re void CompositorInterface::Private::createRegion(wl_client *client, wl_resource *resource, uint32_t id) { - RegionInterface *region = new RegionInterface(q); + RegionInterface *region = new RegionInterface(q, resource); region->create(display->getConnection(client), wl_resource_get_version(resource), id); if (!region->resource()) { wl_resource_post_no_memory(resource); diff --git a/src/wayland/datadevice_interface.cpp b/src/wayland/datadevice_interface.cpp index 316b9b87e3..79559ff6b0 100644 --- a/src/wayland/datadevice_interface.cpp +++ b/src/wayland/datadevice_interface.cpp @@ -36,7 +36,7 @@ namespace Server class DataDeviceInterface::Private : public Resource::Private { public: - Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager); + Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager, wl_resource *parentResource); ~Private(); DataOfferInterface *createDataOffer(DataSourceInterface *source); @@ -65,8 +65,8 @@ const struct wl_data_device_interface DataDeviceInterface::Private::s_interface setSelectionCallback }; -DataDeviceInterface::Private::Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager) - : Resource::Private(q, manager, &wl_data_device_interface, &s_interface) +DataDeviceInterface::Private::Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager, wl_resource *parentResource) + : Resource::Private(q, manager, parentResource, &wl_data_device_interface, &s_interface) , seat(seat) { } @@ -116,7 +116,7 @@ void DataDeviceInterface::Private::setSelection(DataSourceInterface *dataSource) DataOfferInterface *DataDeviceInterface::Private::createDataOffer(DataSourceInterface *source) { Q_Q(DataDeviceInterface); - DataOfferInterface *offer = new DataOfferInterface(source, q); + DataOfferInterface *offer = new DataOfferInterface(source, q, resource); auto c = q->global()->display()->getConnection(wl_resource_get_client(resource)); offer->create(c, wl_resource_get_version(resource), 0); if (!offer->resource()) { @@ -129,8 +129,8 @@ DataOfferInterface *DataDeviceInterface::Private::createDataOffer(DataSourceInte return offer; } -DataDeviceInterface::DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent) - : Resource(new Private(seat, this, parent)) +DataDeviceInterface::DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent, wl_resource *parentResource) + : Resource(new Private(seat, this, parent, parentResource)) { } diff --git a/src/wayland/datadevice_interface.h b/src/wayland/datadevice_interface.h index bf56128bc8..b113b22377 100644 --- a/src/wayland/datadevice_interface.h +++ b/src/wayland/datadevice_interface.h @@ -58,7 +58,7 @@ Q_SIGNALS: private: friend class DataDeviceManagerInterface; - explicit DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent); + explicit DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent, wl_resource *parentResource); class Private; Private *d_func() const; diff --git a/src/wayland/datadevicemanager_interface.cpp b/src/wayland/datadevicemanager_interface.cpp index b2b590dce8..5f1b089665 100644 --- a/src/wayland/datadevicemanager_interface.cpp +++ b/src/wayland/datadevicemanager_interface.cpp @@ -87,7 +87,7 @@ void DataDeviceManagerInterface::Private::createDataSourceCallback(wl_client *cl void DataDeviceManagerInterface::Private::createDataSource(wl_client *client, wl_resource *resource, uint32_t id) { - DataSourceInterface *dataSource = new DataSourceInterface(q); + DataSourceInterface *dataSource = new DataSourceInterface(q, resource); dataSource->create(display->getConnection(client), wl_resource_get_version(resource), id); if (!dataSource->resource()) { wl_resource_post_no_memory(resource); @@ -104,7 +104,7 @@ void DataDeviceManagerInterface::Private::getDataDeviceCallback(wl_client *clien void DataDeviceManagerInterface::Private::getDataDevice(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *seat) { - DataDeviceInterface *dataDevice = new DataDeviceInterface(SeatInterface::get(seat), q); + DataDeviceInterface *dataDevice = new DataDeviceInterface(SeatInterface::get(seat), q, resource); dataDevice->create(display->getConnection(client), wl_resource_get_version(resource), id); if (!dataDevice->resource()) { wl_resource_post_no_memory(resource); diff --git a/src/wayland/dataoffer_interface.cpp b/src/wayland/dataoffer_interface.cpp index 261c1faa03..bb25df18a7 100644 --- a/src/wayland/dataoffer_interface.cpp +++ b/src/wayland/dataoffer_interface.cpp @@ -34,7 +34,7 @@ namespace Server class DataOfferInterface::Private : public Resource::Private { public: - Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q); + Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q, wl_resource *parentResource); ~Private(); DataSourceInterface *source; DataDeviceInterface *dataDevice; @@ -57,8 +57,8 @@ const struct wl_data_offer_interface DataOfferInterface::Private::s_interface = destroyCallback }; -DataOfferInterface::Private::Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q) - : Resource::Private(q, nullptr, &wl_data_offer_interface, &s_interface) +DataOfferInterface::Private::Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q, wl_resource *parentResource) + : Resource::Private(q, nullptr, parentResource, &wl_data_offer_interface, &s_interface) , source(source) , dataDevice(parentInterface) { @@ -92,8 +92,8 @@ void DataOfferInterface::Private::receive(const QString &mimeType, qint32 fd) source->requestData(mimeType, fd); } -DataOfferInterface::DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface) - : Resource(new Private(source, parentInterface, this), parentInterface) +DataOfferInterface::DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface, wl_resource *parentResource) + : Resource(new Private(source, parentInterface, this, parentResource), parentInterface) { connect(source, &DataSourceInterface::mimeTypeOffered, this, [this](const QString &mimeType) { diff --git a/src/wayland/dataoffer_interface.h b/src/wayland/dataoffer_interface.h index 4a7a13de4f..94e97aca3d 100644 --- a/src/wayland/dataoffer_interface.h +++ b/src/wayland/dataoffer_interface.h @@ -44,7 +44,7 @@ public: private: friend class DataDeviceInterface; - explicit DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface); + explicit DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface, wl_resource *parentResource); class Private; Private *d_func() const; diff --git a/src/wayland/datasource_interface.cpp b/src/wayland/datasource_interface.cpp index 513193b49c..0fffe7e6fd 100644 --- a/src/wayland/datasource_interface.cpp +++ b/src/wayland/datasource_interface.cpp @@ -33,7 +33,7 @@ namespace Server class DataSourceInterface::Private : public Resource::Private { public: - Private(DataSourceInterface *q, DataDeviceManagerInterface *parent); + Private(DataSourceInterface *q, DataDeviceManagerInterface *parent, wl_resource *parentResource); ~Private(); QStringList mimeTypes; @@ -55,8 +55,8 @@ const struct wl_data_source_interface DataSourceInterface::Private::s_interface destroyCallack }; -DataSourceInterface::Private::Private(DataSourceInterface *q, DataDeviceManagerInterface *parent) - : Resource::Private(q, parent, &wl_data_source_interface, &s_interface) +DataSourceInterface::Private::Private(DataSourceInterface *q, DataDeviceManagerInterface *parent, wl_resource *parentResource) + : Resource::Private(q, parent, parentResource, &wl_data_source_interface, &s_interface) { } @@ -81,8 +81,8 @@ void DataSourceInterface::Private::offer(const QString &mimeType) emit q->mimeTypeOffered(mimeType); } -DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent) - : Resource(new Private(this, parent)) +DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource) + : Resource(new Private(this, parent, parentResource)) { } diff --git a/src/wayland/datasource_interface.h b/src/wayland/datasource_interface.h index e901b1cb93..1a03408d30 100644 --- a/src/wayland/datasource_interface.h +++ b/src/wayland/datasource_interface.h @@ -51,7 +51,7 @@ Q_SIGNALS: private: friend class DataDeviceManagerInterface; - explicit DataSourceInterface(DataDeviceManagerInterface *parent); + explicit DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource); class Private; Private *d_func() const; diff --git a/src/wayland/region_interface.cpp b/src/wayland/region_interface.cpp index c50b720a06..5889c46b0b 100644 --- a/src/wayland/region_interface.cpp +++ b/src/wayland/region_interface.cpp @@ -31,7 +31,7 @@ namespace Server class RegionInterface::Private : public Resource::Private { public: - Private(CompositorInterface *compositor, RegionInterface *q); + Private(CompositorInterface *compositor, RegionInterface *q, wl_resource *parentResource); ~Private(); QRegion qtRegion; @@ -55,8 +55,8 @@ const struct wl_region_interface RegionInterface::Private::s_interface = { subtractCallback }; -RegionInterface::Private::Private(CompositorInterface *compositor, RegionInterface *q) - : Resource::Private(q, compositor, &wl_region_interface, &s_interface) +RegionInterface::Private::Private(CompositorInterface *compositor, RegionInterface *q, wl_resource *parentResource) + : Resource::Private(q, compositor, parentResource, &wl_region_interface, &s_interface) { } @@ -97,8 +97,8 @@ void RegionInterface::Private::destroyCallback(wl_client *client, wl_resource *r cast(r)->q_func()->deleteLater(); } -RegionInterface::RegionInterface(CompositorInterface *parent) - : Resource(new Private(parent, this), parent) +RegionInterface::RegionInterface(CompositorInterface *parent, wl_resource *parentResource) + : Resource(new Private(parent, this, parentResource), parent) { } diff --git a/src/wayland/server/region_interface.h b/src/wayland/server/region_interface.h index 9ffe4f8566..c0c6820919 100644 --- a/src/wayland/server/region_interface.h +++ b/src/wayland/server/region_interface.h @@ -48,7 +48,7 @@ Q_SIGNALS: private: friend class CompositorInterface; - explicit RegionInterface(CompositorInterface *parent); + explicit RegionInterface(CompositorInterface *parent, wl_resource *parentResource); class Private; Private *d_func() const; diff --git a/src/wayland/server/resource.cpp b/src/wayland/server/resource.cpp index d632fa2938..0e128249cc 100644 --- a/src/wayland/server/resource.cpp +++ b/src/wayland/server/resource.cpp @@ -30,8 +30,9 @@ namespace Server QList Resource::Private::s_allResources; -Resource::Private::Private(Resource *q, Global *g, const wl_interface *interface, const void *implementation) - : global(g) +Resource::Private::Private(Resource *q, Global *g, wl_resource *parentResource, const wl_interface *interface, const void *implementation) + : parentResource(parentResource) + , global(g) , q(q) , m_interface(interface) , m_interfaceImplementation(implementation) @@ -94,5 +95,10 @@ wl_resource *Resource::resource() return d->resource; } +wl_resource *Resource::parentResource() const +{ + return d->parentResource; +} + } } diff --git a/src/wayland/server/resource.h b/src/wayland/server/resource.h index 8baf64d27a..38355c4609 100644 --- a/src/wayland/server/resource.h +++ b/src/wayland/server/resource.h @@ -45,6 +45,7 @@ public: wl_resource *resource(); ClientConnection *client(); Global *global(); + wl_resource *parentResource() const; protected: class Private; diff --git a/src/wayland/server/resource_p.h b/src/wayland/server/resource_p.h index 56c90614dd..cc365dc9f1 100644 --- a/src/wayland/server/resource_p.h +++ b/src/wayland/server/resource_p.h @@ -35,6 +35,7 @@ public: virtual ~Private(); void create(ClientConnection *client, quint32 version, quint32 id); + wl_resource *parentResource = nullptr; wl_resource *resource = nullptr; ClientConnection *client = nullptr; Global *global; @@ -55,7 +56,7 @@ public: } protected: - explicit Private(Resource *q, Global *g, const wl_interface *interface, const void *implementation); + explicit Private(Resource *q, Global *g, wl_resource *parentResource, const wl_interface *interface, const void *implementation); template static Derived *cast(wl_resource *r) { diff --git a/src/wayland/server/shell_interface.cpp b/src/wayland/server/shell_interface.cpp index 80893752da..0360aecee0 100644 --- a/src/wayland/server/shell_interface.cpp +++ b/src/wayland/server/shell_interface.cpp @@ -44,7 +44,7 @@ public: private: static void createSurfaceCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface); void bind(wl_client *client, uint32_t version, uint32_t id) override; - void createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface); + void createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface, wl_resource *parentResource); ShellInterface *q; static const struct wl_shell_interface s_interface; @@ -65,7 +65,7 @@ const struct wl_shell_interface ShellInterface::Private::s_interface = { class ShellSurfaceInterface::Private : public Resource::Private { public: - Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface); + Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface, wl_resource *parentResource); void setFullscreen(bool fullscreen); void setToplevel(bool toplevel); void ping(); @@ -126,10 +126,10 @@ void ShellInterface::Private::bind(wl_client *client, uint32_t version, uint32_t void ShellInterface::Private::createSurfaceCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface) { auto s = reinterpret_cast(wl_resource_get_user_data(resource)); - s->createSurface(client, wl_resource_get_version(resource), id, SurfaceInterface::get(surface)); + s->createSurface(client, wl_resource_get_version(resource), id, SurfaceInterface::get(surface), resource); } -void ShellInterface::Private::createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface) +void ShellInterface::Private::createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface, wl_resource *parentResource) { auto it = std::find_if(surfaces.constBegin(), surfaces.constEnd(), [surface](ShellSurfaceInterface *s) { @@ -140,7 +140,7 @@ void ShellInterface::Private::createSurface(wl_client *client, uint32_t version, wl_resource_post_error(surface->resource(), WL_DISPLAY_ERROR_INVALID_OBJECT, "ShellSurface already created"); return; } - ShellSurfaceInterface *shellSurface = new ShellSurfaceInterface(q, surface); + ShellSurfaceInterface *shellSurface = new ShellSurfaceInterface(q, surface, parentResource); surfaces << shellSurface; QObject::connect(shellSurface, &ShellSurfaceInterface::destroyed, q, [this, shellSurface] { @@ -154,8 +154,8 @@ void ShellInterface::Private::createSurface(wl_client *client, uint32_t version, /********************************* * ShellSurfaceInterface *********************************/ -ShellSurfaceInterface::Private::Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface) - : Resource::Private(q, shell, &wl_shell_surface_interface, &s_interface) +ShellSurfaceInterface::Private::Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface, wl_resource *parentResource) + : Resource::Private(q, shell, parentResource, &wl_shell_surface_interface, &s_interface) , surface(surface) , pingTimer(new QTimer) { @@ -176,8 +176,8 @@ const struct wl_shell_surface_interface ShellSurfaceInterface::Private::s_interf setClassCallback }; -ShellSurfaceInterface::ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent) - : Resource(new Private(this, shell, parent), parent) +ShellSurfaceInterface::ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource) + : Resource(new Private(this, shell, parent, parentResource), parent) { Q_D(); connect(d->pingTimer.data(), &QTimer::timeout, this, &ShellSurfaceInterface::pingTimeout); diff --git a/src/wayland/server/shell_interface.h b/src/wayland/server/shell_interface.h index e2fe6e0500..4a70a37d39 100644 --- a/src/wayland/server/shell_interface.h +++ b/src/wayland/server/shell_interface.h @@ -87,7 +87,7 @@ Q_SIGNALS: private: friend class ShellInterface; - explicit ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent); + explicit ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource); class Private; Private *d_func() const; }; diff --git a/src/wayland/subcompositor_interface.cpp b/src/wayland/subcompositor_interface.cpp index 986fecacc3..669a570357 100644 --- a/src/wayland/subcompositor_interface.cpp +++ b/src/wayland/subcompositor_interface.cpp @@ -106,7 +106,7 @@ void SubCompositorInterface::Private::subsurface(wl_client *client, wl_resource } // TODO: add check that surface is not already used in an interface (e.g. Shell) // TODO: add check that parentSurface is not a child of surface - SubSurfaceInterface *s = new SubSurfaceInterface(q); + SubSurfaceInterface *s = new SubSurfaceInterface(q, resource); s->d_func()->create(display->getConnection(client), wl_resource_get_version(resource), id, surface, parentSurface); if (!s->resource()) { wl_resource_post_no_memory(resource); @@ -132,8 +132,8 @@ const struct wl_subsurface_interface SubSurfaceInterface::Private::s_interface = setDeSyncCallback }; -SubSurfaceInterface::Private::Private(SubSurfaceInterface *q, SubCompositorInterface *compositor) - : Resource::Private(q, compositor, &wl_subsurface_interface, &s_interface) +SubSurfaceInterface::Private::Private(SubSurfaceInterface *q, SubCompositorInterface *compositor, wl_resource *parentResource) + : Resource::Private(q, compositor, parentResource, &wl_subsurface_interface, &s_interface) { } @@ -250,8 +250,8 @@ void SubSurfaceInterface::Private::setMode(Mode m) emit q->modeChanged(m); } -SubSurfaceInterface::SubSurfaceInterface(SubCompositorInterface *parent) - : Resource(new Private(this, parent)) +SubSurfaceInterface::SubSurfaceInterface(SubCompositorInterface *parent, wl_resource *parentResource) + : Resource(new Private(this, parent, parentResource)) { Q_UNUSED(parent) } diff --git a/src/wayland/subcompositor_interface.h b/src/wayland/subcompositor_interface.h index 2eacd80533..d908948dc3 100644 --- a/src/wayland/subcompositor_interface.h +++ b/src/wayland/subcompositor_interface.h @@ -80,7 +80,7 @@ Q_SIGNALS: private: friend class SubCompositorInterface; friend class SurfaceInterface; - explicit SubSurfaceInterface(SubCompositorInterface *parent); + explicit SubSurfaceInterface(SubCompositorInterface *parent, wl_resource *parentResource); class Private; Private *d_func() const; diff --git a/src/wayland/subsurface_interface_p.h b/src/wayland/subsurface_interface_p.h index 6e07ce7988..c935ca5f37 100644 --- a/src/wayland/subsurface_interface_p.h +++ b/src/wayland/subsurface_interface_p.h @@ -35,7 +35,7 @@ namespace Server class SubSurfaceInterface::Private : public Resource::Private { public: - Private(SubSurfaceInterface *q, SubCompositorInterface *compositor); + Private(SubSurfaceInterface *q, SubCompositorInterface *compositor, wl_resource *parentResource); ~Private(); using Resource::Private::create; diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index f2c05a987c..11419b26c7 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -35,8 +35,8 @@ namespace KWayland namespace Server { -SurfaceInterface::Private::Private(SurfaceInterface *q, CompositorInterface *c) - : Resource::Private(q, c, &wl_surface_interface, &s_interface) +SurfaceInterface::Private::Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource) + : Resource::Private(q, c, parentResource, &wl_surface_interface, &s_interface) { } @@ -136,8 +136,8 @@ const struct wl_surface_interface SurfaceInterface::Private::s_interface = { bufferScaleCallback }; -SurfaceInterface::SurfaceInterface(CompositorInterface *parent) - : Resource(new Private(this, parent)) +SurfaceInterface::SurfaceInterface(CompositorInterface *parent, wl_resource *parentResource) + : Resource(new Private(this, parent, parentResource)) { } diff --git a/src/wayland/surface_interface.h b/src/wayland/surface_interface.h index cd2364c12a..39aebdb345 100644 --- a/src/wayland/surface_interface.h +++ b/src/wayland/surface_interface.h @@ -80,7 +80,7 @@ Q_SIGNALS: private: friend class CompositorInterface; friend class SubSurfaceInterface; - explicit SurfaceInterface(CompositorInterface *parent); + explicit SurfaceInterface(CompositorInterface *parent, wl_resource *parentResource); class Private; Private *d_func() const; diff --git a/src/wayland/surface_interface_p.h b/src/wayland/surface_interface_p.h index b7e9cb1a84..23b4473a33 100644 --- a/src/wayland/surface_interface_p.h +++ b/src/wayland/surface_interface_p.h @@ -48,7 +48,7 @@ public: // stacking order: bottom (first) -> top (last) QList> children; }; - Private(SurfaceInterface *q, CompositorInterface *c); + Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource); ~Private(); void destroy();