Add a parentResource to Resource
This commit is contained in:
parent
9e3aa9a7e3
commit
68ce470231
27 changed files with 69 additions and 55 deletions
|
@ -189,6 +189,7 @@ void TestDataDevice::testCreate()
|
||||||
QVERIFY(!deviceInterface->origin());
|
QVERIFY(!deviceInterface->origin());
|
||||||
QVERIFY(!deviceInterface->icon());
|
QVERIFY(!deviceInterface->icon());
|
||||||
QVERIFY(!deviceInterface->selection());
|
QVERIFY(!deviceInterface->selection());
|
||||||
|
QVERIFY(deviceInterface->parentResource());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestDataDevice::testDrag()
|
void TestDataDevice::testDrag()
|
||||||
|
|
|
@ -143,6 +143,7 @@ void TestDataSource::testOffer()
|
||||||
QPointer<DataSourceInterface> serverDataSource = dataSourceCreatedSpy.first().first().value<DataSourceInterface*>();
|
QPointer<DataSourceInterface> serverDataSource = dataSourceCreatedSpy.first().first().value<DataSourceInterface*>();
|
||||||
QVERIFY(!serverDataSource.isNull());
|
QVERIFY(!serverDataSource.isNull());
|
||||||
QCOMPARE(serverDataSource->mimeTypes().count(), 0);
|
QCOMPARE(serverDataSource->mimeTypes().count(), 0);
|
||||||
|
QVERIFY(serverDataSource->parentResource());
|
||||||
|
|
||||||
QSignalSpy offeredSpy(serverDataSource.data(), SIGNAL(mimeTypeOffered(const QString&)));
|
QSignalSpy offeredSpy(serverDataSource.data(), SIGNAL(mimeTypeOffered(const QString&)));
|
||||||
QVERIFY(offeredSpy.isValid());
|
QVERIFY(offeredSpy.isValid());
|
||||||
|
|
|
@ -167,6 +167,7 @@ void TestRegion::testCreateWithRegion()
|
||||||
auto serverRegion = regionCreatedSpy.first().first().value<KWayland::Server::RegionInterface*>();
|
auto serverRegion = regionCreatedSpy.first().first().value<KWayland::Server::RegionInterface*>();
|
||||||
QVERIFY(serverRegion);
|
QVERIFY(serverRegion);
|
||||||
QCOMPARE(serverRegion->region(), QRegion(0, 0, 10, 20));
|
QCOMPARE(serverRegion->region(), QRegion(0, 0, 10, 20));
|
||||||
|
QVERIFY(serverRegion->parentResource());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRegion::testCreateUniquePtr()
|
void TestRegion::testCreateUniquePtr()
|
||||||
|
|
|
@ -223,6 +223,7 @@ void TestWaylandShell::testFullscreen()
|
||||||
QVERIFY(serverSurfaceSpy.wait());
|
QVERIFY(serverSurfaceSpy.wait());
|
||||||
ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value<ShellSurfaceInterface*>();
|
ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value<ShellSurfaceInterface*>();
|
||||||
QVERIFY(serverSurface);
|
QVERIFY(serverSurface);
|
||||||
|
QVERIFY(serverSurface->parentResource());
|
||||||
|
|
||||||
QSignalSpy fullscreenSpy(serverSurface, SIGNAL(fullscreenChanged(bool)));
|
QSignalSpy fullscreenSpy(serverSurface, SIGNAL(fullscreenChanged(bool)));
|
||||||
QVERIFY(fullscreenSpy.isValid());
|
QVERIFY(fullscreenSpy.isValid());
|
||||||
|
|
|
@ -188,6 +188,7 @@ void TestSubSurface::testCreate()
|
||||||
QVERIFY(subSurfaceCreatedSpy.wait());
|
QVERIFY(subSurfaceCreatedSpy.wait());
|
||||||
SubSurfaceInterface *serverSubSurface = subSurfaceCreatedSpy.first().first().value<KWayland::Server::SubSurfaceInterface*>();
|
SubSurfaceInterface *serverSubSurface = subSurfaceCreatedSpy.first().first().value<KWayland::Server::SubSurfaceInterface*>();
|
||||||
QVERIFY(serverSubSurface);
|
QVERIFY(serverSubSurface);
|
||||||
|
QVERIFY(serverSubSurface->parentSurface());
|
||||||
QCOMPARE(serverSubSurface->parentSurface().data(), serverParentSurface);
|
QCOMPARE(serverSubSurface->parentSurface().data(), serverParentSurface);
|
||||||
QCOMPARE(serverSubSurface->surface().data(), serverSurface);
|
QCOMPARE(serverSubSurface->surface().data(), serverSurface);
|
||||||
QCOMPARE(serverSurface->subSurface().data(), serverSubSurface);
|
QCOMPARE(serverSurface->subSurface().data(), serverSubSurface);
|
||||||
|
|
|
@ -193,6 +193,7 @@ void TestWaylandSurface::testDamage()
|
||||||
KWayland::Server::SurfaceInterface *serverSurface = serverSurfaceCreated.first().first().value<KWayland::Server::SurfaceInterface*>();
|
KWayland::Server::SurfaceInterface *serverSurface = serverSurfaceCreated.first().first().value<KWayland::Server::SurfaceInterface*>();
|
||||||
QVERIFY(serverSurface);
|
QVERIFY(serverSurface);
|
||||||
QCOMPARE(serverSurface->damage(), QRegion());
|
QCOMPARE(serverSurface->damage(), QRegion());
|
||||||
|
QVERIFY(serverSurface->parentResource());
|
||||||
|
|
||||||
QSignalSpy damageSpy(serverSurface, SIGNAL(damaged(QRegion)));
|
QSignalSpy damageSpy(serverSurface, SIGNAL(damaged(QRegion)));
|
||||||
QVERIFY(damageSpy.isValid());
|
QVERIFY(damageSpy.isValid());
|
||||||
|
|
|
@ -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)
|
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);
|
surface->create(display->getConnection(client), wl_resource_get_version(resource), id);
|
||||||
if (!surface->resource()) {
|
if (!surface->resource()) {
|
||||||
wl_resource_post_no_memory(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)
|
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);
|
region->create(display->getConnection(client), wl_resource_get_version(resource), id);
|
||||||
if (!region->resource()) {
|
if (!region->resource()) {
|
||||||
wl_resource_post_no_memory(resource);
|
wl_resource_post_no_memory(resource);
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Server
|
||||||
class DataDeviceInterface::Private : public Resource::Private
|
class DataDeviceInterface::Private : public Resource::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager);
|
Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager, wl_resource *parentResource);
|
||||||
~Private();
|
~Private();
|
||||||
|
|
||||||
DataOfferInterface *createDataOffer(DataSourceInterface *source);
|
DataOfferInterface *createDataOffer(DataSourceInterface *source);
|
||||||
|
@ -65,8 +65,8 @@ const struct wl_data_device_interface DataDeviceInterface::Private::s_interface
|
||||||
setSelectionCallback
|
setSelectionCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
DataDeviceInterface::Private::Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager)
|
DataDeviceInterface::Private::Private(SeatInterface *seat, DataDeviceInterface *q, DataDeviceManagerInterface *manager, wl_resource *parentResource)
|
||||||
: Resource::Private(q, manager, &wl_data_device_interface, &s_interface)
|
: Resource::Private(q, manager, parentResource, &wl_data_device_interface, &s_interface)
|
||||||
, seat(seat)
|
, seat(seat)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ void DataDeviceInterface::Private::setSelection(DataSourceInterface *dataSource)
|
||||||
DataOfferInterface *DataDeviceInterface::Private::createDataOffer(DataSourceInterface *source)
|
DataOfferInterface *DataDeviceInterface::Private::createDataOffer(DataSourceInterface *source)
|
||||||
{
|
{
|
||||||
Q_Q(DataDeviceInterface);
|
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));
|
auto c = q->global()->display()->getConnection(wl_resource_get_client(resource));
|
||||||
offer->create(c, wl_resource_get_version(resource), 0);
|
offer->create(c, wl_resource_get_version(resource), 0);
|
||||||
if (!offer->resource()) {
|
if (!offer->resource()) {
|
||||||
|
@ -129,8 +129,8 @@ DataOfferInterface *DataDeviceInterface::Private::createDataOffer(DataSourceInte
|
||||||
return offer;
|
return offer;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataDeviceInterface::DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent)
|
DataDeviceInterface::DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent, wl_resource *parentResource)
|
||||||
: Resource(new Private(seat, this, parent))
|
: Resource(new Private(seat, this, parent, parentResource))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class DataDeviceManagerInterface;
|
friend class DataDeviceManagerInterface;
|
||||||
explicit DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent);
|
explicit DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent, wl_resource *parentResource);
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
|
|
|
@ -87,7 +87,7 @@ void DataDeviceManagerInterface::Private::createDataSourceCallback(wl_client *cl
|
||||||
|
|
||||||
void DataDeviceManagerInterface::Private::createDataSource(wl_client *client, wl_resource *resource, uint32_t id)
|
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);
|
dataSource->create(display->getConnection(client), wl_resource_get_version(resource), id);
|
||||||
if (!dataSource->resource()) {
|
if (!dataSource->resource()) {
|
||||||
wl_resource_post_no_memory(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)
|
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);
|
dataDevice->create(display->getConnection(client), wl_resource_get_version(resource), id);
|
||||||
if (!dataDevice->resource()) {
|
if (!dataDevice->resource()) {
|
||||||
wl_resource_post_no_memory(resource);
|
wl_resource_post_no_memory(resource);
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Server
|
||||||
class DataOfferInterface::Private : public Resource::Private
|
class DataOfferInterface::Private : public Resource::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q);
|
Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q, wl_resource *parentResource);
|
||||||
~Private();
|
~Private();
|
||||||
DataSourceInterface *source;
|
DataSourceInterface *source;
|
||||||
DataDeviceInterface *dataDevice;
|
DataDeviceInterface *dataDevice;
|
||||||
|
@ -57,8 +57,8 @@ const struct wl_data_offer_interface DataOfferInterface::Private::s_interface =
|
||||||
destroyCallback
|
destroyCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
DataOfferInterface::Private::Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q)
|
DataOfferInterface::Private::Private(DataSourceInterface *source, DataDeviceInterface *parentInterface, DataOfferInterface *q, wl_resource *parentResource)
|
||||||
: Resource::Private(q, nullptr, &wl_data_offer_interface, &s_interface)
|
: Resource::Private(q, nullptr, parentResource, &wl_data_offer_interface, &s_interface)
|
||||||
, source(source)
|
, source(source)
|
||||||
, dataDevice(parentInterface)
|
, dataDevice(parentInterface)
|
||||||
{
|
{
|
||||||
|
@ -92,8 +92,8 @@ void DataOfferInterface::Private::receive(const QString &mimeType, qint32 fd)
|
||||||
source->requestData(mimeType, fd);
|
source->requestData(mimeType, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataOfferInterface::DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface)
|
DataOfferInterface::DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface, wl_resource *parentResource)
|
||||||
: Resource(new Private(source, parentInterface, this), parentInterface)
|
: Resource(new Private(source, parentInterface, this, parentResource), parentInterface)
|
||||||
{
|
{
|
||||||
connect(source, &DataSourceInterface::mimeTypeOffered, this,
|
connect(source, &DataSourceInterface::mimeTypeOffered, this,
|
||||||
[this](const QString &mimeType) {
|
[this](const QString &mimeType) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class DataDeviceInterface;
|
friend class DataDeviceInterface;
|
||||||
explicit DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface);
|
explicit DataOfferInterface(DataSourceInterface *source, DataDeviceInterface *parentInterface, wl_resource *parentResource);
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Server
|
||||||
class DataSourceInterface::Private : public Resource::Private
|
class DataSourceInterface::Private : public Resource::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(DataSourceInterface *q, DataDeviceManagerInterface *parent);
|
Private(DataSourceInterface *q, DataDeviceManagerInterface *parent, wl_resource *parentResource);
|
||||||
~Private();
|
~Private();
|
||||||
|
|
||||||
QStringList mimeTypes;
|
QStringList mimeTypes;
|
||||||
|
@ -55,8 +55,8 @@ const struct wl_data_source_interface DataSourceInterface::Private::s_interface
|
||||||
destroyCallack
|
destroyCallack
|
||||||
};
|
};
|
||||||
|
|
||||||
DataSourceInterface::Private::Private(DataSourceInterface *q, DataDeviceManagerInterface *parent)
|
DataSourceInterface::Private::Private(DataSourceInterface *q, DataDeviceManagerInterface *parent, wl_resource *parentResource)
|
||||||
: Resource::Private(q, parent, &wl_data_source_interface, &s_interface)
|
: 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);
|
emit q->mimeTypeOffered(mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent)
|
DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource)
|
||||||
: Resource(new Private(this, parent))
|
: Resource(new Private(this, parent, parentResource))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class DataDeviceManagerInterface;
|
friend class DataDeviceManagerInterface;
|
||||||
explicit DataSourceInterface(DataDeviceManagerInterface *parent);
|
explicit DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource);
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Server
|
||||||
class RegionInterface::Private : public Resource::Private
|
class RegionInterface::Private : public Resource::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(CompositorInterface *compositor, RegionInterface *q);
|
Private(CompositorInterface *compositor, RegionInterface *q, wl_resource *parentResource);
|
||||||
~Private();
|
~Private();
|
||||||
QRegion qtRegion;
|
QRegion qtRegion;
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ const struct wl_region_interface RegionInterface::Private::s_interface = {
|
||||||
subtractCallback
|
subtractCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
RegionInterface::Private::Private(CompositorInterface *compositor, RegionInterface *q)
|
RegionInterface::Private::Private(CompositorInterface *compositor, RegionInterface *q, wl_resource *parentResource)
|
||||||
: Resource::Private(q, compositor, &wl_region_interface, &s_interface)
|
: 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<Private>(r)->q_func()->deleteLater();
|
cast<Private>(r)->q_func()->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionInterface::RegionInterface(CompositorInterface *parent)
|
RegionInterface::RegionInterface(CompositorInterface *parent, wl_resource *parentResource)
|
||||||
: Resource(new Private(parent, this), parent)
|
: Resource(new Private(parent, this, parentResource), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CompositorInterface;
|
friend class CompositorInterface;
|
||||||
explicit RegionInterface(CompositorInterface *parent);
|
explicit RegionInterface(CompositorInterface *parent, wl_resource *parentResource);
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
|
|
|
@ -30,8 +30,9 @@ namespace Server
|
||||||
|
|
||||||
QList<Resource::Private*> Resource::Private::s_allResources;
|
QList<Resource::Private*> Resource::Private::s_allResources;
|
||||||
|
|
||||||
Resource::Private::Private(Resource *q, Global *g, const wl_interface *interface, const void *implementation)
|
Resource::Private::Private(Resource *q, Global *g, wl_resource *parentResource, const wl_interface *interface, const void *implementation)
|
||||||
: global(g)
|
: parentResource(parentResource)
|
||||||
|
, global(g)
|
||||||
, q(q)
|
, q(q)
|
||||||
, m_interface(interface)
|
, m_interface(interface)
|
||||||
, m_interfaceImplementation(implementation)
|
, m_interfaceImplementation(implementation)
|
||||||
|
@ -94,5 +95,10 @@ wl_resource *Resource::resource()
|
||||||
return d->resource;
|
return d->resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_resource *Resource::parentResource() const
|
||||||
|
{
|
||||||
|
return d->parentResource;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
wl_resource *resource();
|
wl_resource *resource();
|
||||||
ClientConnection *client();
|
ClientConnection *client();
|
||||||
Global *global();
|
Global *global();
|
||||||
|
wl_resource *parentResource() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class Private;
|
class Private;
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
virtual ~Private();
|
virtual ~Private();
|
||||||
void create(ClientConnection *client, quint32 version, quint32 id);
|
void create(ClientConnection *client, quint32 version, quint32 id);
|
||||||
|
|
||||||
|
wl_resource *parentResource = nullptr;
|
||||||
wl_resource *resource = nullptr;
|
wl_resource *resource = nullptr;
|
||||||
ClientConnection *client = nullptr;
|
ClientConnection *client = nullptr;
|
||||||
Global *global;
|
Global *global;
|
||||||
|
@ -55,7 +56,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
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 <typename Derived>
|
template <typename Derived>
|
||||||
static Derived *cast(wl_resource *r) {
|
static Derived *cast(wl_resource *r) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
private:
|
private:
|
||||||
static void createSurfaceCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface);
|
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 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;
|
ShellInterface *q;
|
||||||
static const struct wl_shell_interface s_interface;
|
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
|
class ShellSurfaceInterface::Private : public Resource::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface);
|
Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface, wl_resource *parentResource);
|
||||||
void setFullscreen(bool fullscreen);
|
void setFullscreen(bool fullscreen);
|
||||||
void setToplevel(bool toplevel);
|
void setToplevel(bool toplevel);
|
||||||
void ping();
|
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)
|
void ShellInterface::Private::createSurfaceCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface)
|
||||||
{
|
{
|
||||||
auto s = reinterpret_cast<ShellInterface::Private*>(wl_resource_get_user_data(resource));
|
auto s = reinterpret_cast<ShellInterface::Private*>(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(),
|
auto it = std::find_if(surfaces.constBegin(), surfaces.constEnd(),
|
||||||
[surface](ShellSurfaceInterface *s) {
|
[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");
|
wl_resource_post_error(surface->resource(), WL_DISPLAY_ERROR_INVALID_OBJECT, "ShellSurface already created");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ShellSurfaceInterface *shellSurface = new ShellSurfaceInterface(q, surface);
|
ShellSurfaceInterface *shellSurface = new ShellSurfaceInterface(q, surface, parentResource);
|
||||||
surfaces << shellSurface;
|
surfaces << shellSurface;
|
||||||
QObject::connect(shellSurface, &ShellSurfaceInterface::destroyed, q,
|
QObject::connect(shellSurface, &ShellSurfaceInterface::destroyed, q,
|
||||||
[this, shellSurface] {
|
[this, shellSurface] {
|
||||||
|
@ -154,8 +154,8 @@ void ShellInterface::Private::createSurface(wl_client *client, uint32_t version,
|
||||||
/*********************************
|
/*********************************
|
||||||
* ShellSurfaceInterface
|
* ShellSurfaceInterface
|
||||||
*********************************/
|
*********************************/
|
||||||
ShellSurfaceInterface::Private::Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface)
|
ShellSurfaceInterface::Private::Private(ShellSurfaceInterface *q, ShellInterface *shell, SurfaceInterface *surface, wl_resource *parentResource)
|
||||||
: Resource::Private(q, shell, &wl_shell_surface_interface, &s_interface)
|
: Resource::Private(q, shell, parentResource, &wl_shell_surface_interface, &s_interface)
|
||||||
, surface(surface)
|
, surface(surface)
|
||||||
, pingTimer(new QTimer)
|
, pingTimer(new QTimer)
|
||||||
{
|
{
|
||||||
|
@ -176,8 +176,8 @@ const struct wl_shell_surface_interface ShellSurfaceInterface::Private::s_interf
|
||||||
setClassCallback
|
setClassCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellSurfaceInterface::ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent)
|
ShellSurfaceInterface::ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource)
|
||||||
: Resource(new Private(this, shell, parent), parent)
|
: Resource(new Private(this, shell, parent, parentResource), parent)
|
||||||
{
|
{
|
||||||
Q_D();
|
Q_D();
|
||||||
connect(d->pingTimer.data(), &QTimer::timeout, this, &ShellSurfaceInterface::pingTimeout);
|
connect(d->pingTimer.data(), &QTimer::timeout, this, &ShellSurfaceInterface::pingTimeout);
|
||||||
|
|
|
@ -87,7 +87,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ShellInterface;
|
friend class ShellInterface;
|
||||||
explicit ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent);
|
explicit ShellSurfaceInterface(ShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource);
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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 surface is not already used in an interface (e.g. Shell)
|
||||||
// TODO: add check that parentSurface is not a child of surface
|
// 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);
|
s->d_func()->create(display->getConnection(client), wl_resource_get_version(resource), id, surface, parentSurface);
|
||||||
if (!s->resource()) {
|
if (!s->resource()) {
|
||||||
wl_resource_post_no_memory(resource);
|
wl_resource_post_no_memory(resource);
|
||||||
|
@ -132,8 +132,8 @@ const struct wl_subsurface_interface SubSurfaceInterface::Private::s_interface =
|
||||||
setDeSyncCallback
|
setDeSyncCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
SubSurfaceInterface::Private::Private(SubSurfaceInterface *q, SubCompositorInterface *compositor)
|
SubSurfaceInterface::Private::Private(SubSurfaceInterface *q, SubCompositorInterface *compositor, wl_resource *parentResource)
|
||||||
: Resource::Private(q, compositor, &wl_subsurface_interface, &s_interface)
|
: Resource::Private(q, compositor, parentResource, &wl_subsurface_interface, &s_interface)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,8 +250,8 @@ void SubSurfaceInterface::Private::setMode(Mode m)
|
||||||
emit q->modeChanged(m);
|
emit q->modeChanged(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SubSurfaceInterface::SubSurfaceInterface(SubCompositorInterface *parent)
|
SubSurfaceInterface::SubSurfaceInterface(SubCompositorInterface *parent, wl_resource *parentResource)
|
||||||
: Resource(new Private(this, parent))
|
: Resource(new Private(this, parent, parentResource))
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ Q_SIGNALS:
|
||||||
private:
|
private:
|
||||||
friend class SubCompositorInterface;
|
friend class SubCompositorInterface;
|
||||||
friend class SurfaceInterface;
|
friend class SurfaceInterface;
|
||||||
explicit SubSurfaceInterface(SubCompositorInterface *parent);
|
explicit SubSurfaceInterface(SubCompositorInterface *parent, wl_resource *parentResource);
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Server
|
||||||
class SubSurfaceInterface::Private : public Resource::Private
|
class SubSurfaceInterface::Private : public Resource::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(SubSurfaceInterface *q, SubCompositorInterface *compositor);
|
Private(SubSurfaceInterface *q, SubCompositorInterface *compositor, wl_resource *parentResource);
|
||||||
~Private();
|
~Private();
|
||||||
|
|
||||||
using Resource::Private::create;
|
using Resource::Private::create;
|
||||||
|
|
|
@ -35,8 +35,8 @@ namespace KWayland
|
||||||
namespace Server
|
namespace Server
|
||||||
{
|
{
|
||||||
|
|
||||||
SurfaceInterface::Private::Private(SurfaceInterface *q, CompositorInterface *c)
|
SurfaceInterface::Private::Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource)
|
||||||
: Resource::Private(q, c, &wl_surface_interface, &s_interface)
|
: Resource::Private(q, c, parentResource, &wl_surface_interface, &s_interface)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ const struct wl_surface_interface SurfaceInterface::Private::s_interface = {
|
||||||
bufferScaleCallback
|
bufferScaleCallback
|
||||||
};
|
};
|
||||||
|
|
||||||
SurfaceInterface::SurfaceInterface(CompositorInterface *parent)
|
SurfaceInterface::SurfaceInterface(CompositorInterface *parent, wl_resource *parentResource)
|
||||||
: Resource(new Private(this, parent))
|
: Resource(new Private(this, parent, parentResource))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ Q_SIGNALS:
|
||||||
private:
|
private:
|
||||||
friend class CompositorInterface;
|
friend class CompositorInterface;
|
||||||
friend class SubSurfaceInterface;
|
friend class SubSurfaceInterface;
|
||||||
explicit SurfaceInterface(CompositorInterface *parent);
|
explicit SurfaceInterface(CompositorInterface *parent, wl_resource *parentResource);
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
Private *d_func() const;
|
Private *d_func() const;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
// stacking order: bottom (first) -> top (last)
|
// stacking order: bottom (first) -> top (last)
|
||||||
QList<QPointer<SubSurfaceInterface>> children;
|
QList<QPointer<SubSurfaceInterface>> children;
|
||||||
};
|
};
|
||||||
Private(SurfaceInterface *q, CompositorInterface *c);
|
Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource);
|
||||||
~Private();
|
~Private();
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
Loading…
Reference in a new issue