Add destructor request to org_kde_kwin_shadow and org_kde_kwin_shadow_manager
Summary: This improves the cleanup of a shadow from client side. The server now notices when the client destroyed the shadow. Reviewers: #plasma_on_wayland Subscribers: plasma-devel Differential Revision: https://phabricator.kde.org/D1789
This commit is contained in:
parent
37f5256688
commit
acb0e85bb6
2 changed files with 12 additions and 15 deletions
|
@ -292,25 +292,13 @@ void ShadowTest::testSurfaceDestroy()
|
|||
QVERIFY(surfaceDestroyedSpy.isValid());
|
||||
QSignalSpy shadowDestroyedSpy(serverShadow, &QObject::destroyed);
|
||||
QVERIFY(shadowDestroyedSpy.isValid());
|
||||
QSignalSpy clientDisconnectedSpy(serverSurface->client(), &ClientConnection::disconnected);
|
||||
QVERIFY(clientDisconnectedSpy.isValid());
|
||||
surface.reset();
|
||||
QVERIFY(surfaceDestroyedSpy.wait());
|
||||
QVERIFY(shadowDestroyedSpy.isEmpty());
|
||||
// destroy the shadow
|
||||
shadow.reset();
|
||||
// shadow protocol doesn't have a destroy callback yet, so also disconnect
|
||||
m_connection->deleteLater();
|
||||
m_connection = nullptr;
|
||||
QVERIFY(clientDisconnectedSpy.wait());
|
||||
if (shadowDestroyedSpy.isEmpty()) {
|
||||
QVERIFY(shadowDestroyedSpy.wait());
|
||||
}
|
||||
QVERIFY(shadowDestroyedSpy.wait());
|
||||
QCOMPARE(shadowDestroyedSpy.count(), 1);
|
||||
m_shm->destroy();
|
||||
m_compositor->destroy();
|
||||
m_shadow->destroy();
|
||||
m_queue->destroy();
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(ShadowTest)
|
||||
|
|
|
@ -43,6 +43,7 @@ private:
|
|||
|
||||
static void createCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface);
|
||||
static void unsetCallback(wl_client *client, wl_resource *resource, wl_resource *surface);
|
||||
static void destroyCallback(wl_client *client, wl_resource *resource);
|
||||
static void unbind(wl_resource *resource);
|
||||
static Private *cast(wl_resource *r) {
|
||||
return reinterpret_cast<Private*>(wl_resource_get_user_data(r));
|
||||
|
@ -53,12 +54,13 @@ private:
|
|||
static const quint32 s_version;
|
||||
};
|
||||
|
||||
const quint32 ShadowManagerInterface::Private::s_version = 1;
|
||||
const quint32 ShadowManagerInterface::Private::s_version = 2;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
const struct org_kde_kwin_shadow_manager_interface ShadowManagerInterface::Private::s_interface = {
|
||||
createCallback,
|
||||
unsetCallback
|
||||
unsetCallback,
|
||||
destroyCallback
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -86,6 +88,12 @@ void ShadowManagerInterface::Private::unbind(wl_resource *resource)
|
|||
// TODO: implement?
|
||||
}
|
||||
|
||||
void ShadowManagerInterface::Private::destroyCallback(wl_client *client, wl_resource *resource)
|
||||
{
|
||||
Q_UNUSED(client)
|
||||
wl_resource_destroy(resource);
|
||||
}
|
||||
|
||||
void ShadowManagerInterface::Private::createCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface)
|
||||
{
|
||||
cast(resource)->createShadow(client, resource, id, surface);
|
||||
|
@ -198,6 +206,7 @@ const struct org_kde_kwin_shadow_interface ShadowInterface::Private::s_interface
|
|||
offsetTopCallback,
|
||||
offsetRightCallback,
|
||||
offsetBottomCallback,
|
||||
resourceDestroyedCallback
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue