diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp --- a/autotests/integration/shell_client_test.cpp +++ b/autotests/integration/shell_client_test.cpp @@ -86,6 +86,10 @@ // this test verifies that mapping a previously mapped window works correctly QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); QVERIFY(clientAddedSpy.isValid()); + QSignalSpy effectsWindowShownSpy(effects, &EffectsHandler::windowShown); + QVERIFY(effectsWindowShownSpy.isValid()); + QSignalSpy effectsWindowHiddenSpy(effects, &EffectsHandler::windowHidden); + QVERIFY(effectsWindowHiddenSpy.isValid()); QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createShellSurface(surface.data())); @@ -101,6 +105,7 @@ QCOMPARE(client->isHiddenInternal(), false); QCOMPARE(client->readyForPainting(), true); QCOMPARE(workspace()->activeClient(), client); + QVERIFY(effectsWindowShownSpy.isEmpty()); // now unmap QSignalSpy hiddenSpy(client, &ShellClient::windowHidden); @@ -114,27 +119,38 @@ QCOMPARE(client->isHiddenInternal(), true); QVERIFY(windowClosedSpy.isEmpty()); QVERIFY(!workspace()->activeClient()); + QCOMPARE(effectsWindowHiddenSpy.count(), 1); + QCOMPARE(effectsWindowHiddenSpy.first().first().value(), client->effectWindow()); QSignalSpy windowShownSpy(client, &ShellClient::windowShown); QVERIFY(windowShownSpy.isValid()); Test::render(surface.data(), QSize(100, 50), Qt::blue); QCOMPARE(clientAddedSpy.count(), 1); QVERIFY(windowShownSpy.wait()); QCOMPARE(windowShownSpy.count(), 1); QCOMPARE(clientAddedSpy.count(), 1); + QCOMPARE(client->readyForPainting(), true); + QCOMPARE(client->isHiddenInternal(), false); QCOMPARE(workspace()->activeClient(), client); + QCOMPARE(effectsWindowShownSpy.count(), 1); + QCOMPARE(effectsWindowShownSpy.first().first().value(), client->effectWindow()); // let's unmap again surface->attachBuffer(Buffer::Ptr()); surface->commit(Surface::CommitFlag::None); QVERIFY(hiddenSpy.wait()); QCOMPARE(hiddenSpy.count(), 2); + QCOMPARE(client->readyForPainting(), true); + QCOMPARE(client->isHiddenInternal(), true); QVERIFY(windowClosedSpy.isEmpty()); + QCOMPARE(effectsWindowHiddenSpy.count(), 2); + QCOMPARE(effectsWindowHiddenSpy.last().first().value(), client->effectWindow()); shellSurface.reset(); surface.reset(); QVERIFY(windowClosedSpy.wait()); QCOMPARE(windowClosedSpy.count(), 1); + QCOMPARE(effectsWindowHiddenSpy.count(), 2); } void TestShellClient::testDesktopPresenceChanged() diff --git a/effects.cpp b/effects.cpp --- a/effects.cpp +++ b/effects.cpp @@ -386,6 +386,16 @@ connect(c, &AbstractClient::modalChanged, this, &EffectsHandlerImpl::slotClientModalityChanged); connect(c, &AbstractClient::geometryShapeChanged, this, &EffectsHandlerImpl::slotGeometryShapeChanged); connect(c, &AbstractClient::damaged, this, &EffectsHandlerImpl::slotWindowDamaged); + connect(c, &AbstractClient::windowShown, this, + [this](Toplevel *c) { + emit windowShown(c->effectWindow()); + } + ); + connect(c, &AbstractClient::windowHidden, this, + [this](Toplevel *c) { + emit windowHidden(c->effectWindow()); + } + ); } void EffectsHandlerImpl::setupClientConnections(Client* c) diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1430,6 +1430,29 @@ **/ void virtualScreenGeometryChanged(); + /** + * The window @p w gets shown again. The window was previously + * initially shown with @link{windowAdded} and hidden with @link{windowHidden}. + * + * @see windowHidden + * @see windowAdded + * @since 5.8 + **/ + void windowShown(KWin::EffectWindow *w); + + /** + * The window @p w got hidden but not yet closed. + * This can happen when a window is still being used and is supposed to be shown again + * with @link{windowShown}. On X11 an example is autohiding panels. On Wayland every + * window first goes through the window hidden state and might get shown again, or might + * get closed the normal way. + * + * @see windowShown + * @see windowClosed + * @since 5.8 + **/ + void windowHidden(KWin::EffectWindow *w); + protected: QVector< EffectPair > loaded_effects; //QHash< QString, EffectFactory* > effect_factories;