diff --git a/autotests/client/test_shadow.cpp b/autotests/client/test_shadow.cpp --- a/autotests/client/test_shadow.cpp +++ b/autotests/client/test_shadow.cpp @@ -292,25 +292,13 @@ 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) diff --git a/src/client/protocols/shadow.xml b/src/client/protocols/shadow.xml --- a/src/client/protocols/shadow.xml +++ b/src/client/protocols/shadow.xml @@ -16,16 +16,21 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . ]]> - + + + + Destroy the org_kde_kwin_shadow_manager object. + + - + @@ -64,5 +69,13 @@ + + + Destroy the org_kde_kwin_shadow object. If the org_kde_kwin_shadow is + still set on a wl_surface the shadow will be immediatelly removed. + Prefer to first call the request unset on the org_kde_kwin_shadow_manager and + commit the wl_surface to apply the change. + + diff --git a/src/client/registry.cpp b/src/client/registry.cpp --- a/src/client/registry.cpp +++ b/src/client/registry.cpp @@ -183,7 +183,7 @@ &Registry::outputDeviceRemoved }}, {Registry::Interface::Shadow, { - 1, + 2, QByteArrayLiteral("org_kde_kwin_shadow_manager"), &org_kde_kwin_shadow_manager_interface, &Registry::shadowAnnounced, diff --git a/src/server/shadow_interface.cpp b/src/server/shadow_interface.cpp --- a/src/server/shadow_interface.cpp +++ b/src/server/shadow_interface.cpp @@ -43,6 +43,7 @@ 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(wl_resource_get_user_data(r)); @@ -53,12 +54,13 @@ 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 @@ // 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 @@ offsetTopCallback, offsetRightCallback, offsetBottomCallback, + resourceDestroyedCallback }; #endif