Skip to content

Commit

Permalink
Connecting effects handlers in slotWindowAdded
Browse files Browse the repository at this point in the history
  • Loading branch information
GleammerRay committed May 2, 2024
1 parent 11ac984 commit a2c1326
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/YetAnotherMagicLampEffect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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()) {
Expand Down
1 change: 1 addition & 0 deletions src/YetAnotherMagicLampEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a2c1326

Please sign in to comment.