From a2c1326e4dac067472076b2c38360095c7356486 Mon Sep 17 00:00:00 2001 From: GleammerRay <101527589+GleammerRay@users.noreply.github.com> Date: Thu, 2 May 2024 11:28:20 +0100 Subject: [PATCH] Connecting effects handlers in slotWindowAdded --- src/YetAnotherMagicLampEffect.cc | 17 +++++++++++++---- src/YetAnotherMagicLampEffect.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/YetAnotherMagicLampEffect.cc b/src/YetAnotherMagicLampEffect.cc index 53d4b99..3ae2781 100644 --- a/src/YetAnotherMagicLampEffect.cc +++ b/src/YetAnotherMagicLampEffect.cc @@ -41,15 +41,18 @@ YetAnotherMagicLampEffect::YetAnotherMagicLampEffect() { reconfigure(ReconfigureAll); - connect(KWin::effects, &KWin::EffectsHandler::windowMinimized, - this, &YetAnotherMagicLampEffect::slotWindowMinimized); - connect(KWin::effects, &KWin::EffectsHandler::windowUnminimized, - this, &YetAnotherMagicLampEffect::slotWindowUnminimized); + connect(KWin::effects, &KWin::EffectsHandler::windowAdded, + this, &YetAnotherMagicLampEffect::slotWindowAdded); connect(KWin::effects, &KWin::EffectsHandler::windowDeleted, this, &YetAnotherMagicLampEffect::slotWindowDeleted); connect(KWin::effects, &KWin::EffectsHandler::activeFullScreenEffectChanged, this, &YetAnotherMagicLampEffect::slotActiveFullScreenEffectChanged); + const auto windows = KWin::effects->stackingOrder(); + for (KWin::EffectWindow *window : windows) { + YetAnotherMagicLampEffect::slotWindowAdded(window); + } + setVertexSnappingMode(KWin::RenderGeometry::VertexSnappingMode::None); } @@ -203,6 +206,12 @@ bool YetAnotherMagicLampEffect::supported() return false; } +void YetAnotherMagicLampEffect::slotWindowAdded(KWin::EffectWindow *w) +{ + connect(w, &KWin::EffectWindow::minimizedChanged, this, &MagicLampEffect::slotWindowMinimized); + connect(w, &KWin::EffectWindow::clientUnminimized, this, &YetAnotherMagicLampEffect::slotWindowUnminimized); +} + void YetAnotherMagicLampEffect::slotWindowMinimized(KWin::EffectWindow* w) { if (KWin::effects->activeFullScreenEffect()) { diff --git a/src/YetAnotherMagicLampEffect.h b/src/YetAnotherMagicLampEffect.h index 056341f..bd3fcfb 100644 --- a/src/YetAnotherMagicLampEffect.h +++ b/src/YetAnotherMagicLampEffect.h @@ -53,6 +53,7 @@ class YetAnotherMagicLampEffect : public KWin::OffscreenEffect { void apply(KWin::EffectWindow* window, int mask, KWin::WindowPaintData& data, KWin::WindowQuadList& quads) override; private Q_SLOTS: + void slotWindowAdded(KWin::EffectWindow* w); void slotWindowMinimized(KWin::EffectWindow* w); void slotWindowUnminimized(KWin::EffectWindow* w); void slotWindowDeleted(KWin::EffectWindow* w);