diff --git a/effects/fallapart/fallapart.cpp b/effects/fallapart/fallapart.cpp index 3eb913d15a..5d460172cf 100644 --- a/effects/fallapart/fallapart.cpp +++ b/effects/fallapart/fallapart.cpp @@ -148,11 +148,7 @@ void FallApartEffect::slotWindowClosed(EffectWindow* c) { if (!isRealWindow(c)) return; - if (c->isMinimized()) - return; - if (!c->isOnCurrentDesktop()) - return; - if (!c->isOnCurrentActivity()) + if (!c->isVisible()) return; const void* e = c->data(WindowClosedGrabRole).value(); if (e && e != this) diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index fa1015a496..7d522d11e1 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -818,6 +818,13 @@ bool EffectWindow::hasDecoration() const return contentsRect() != QRect(0, 0, width(), height()); } +bool EffectWindow::isVisible() const +{ + return !isMinimized() + && isOnCurrentDesktop() + && isOnCurrentActivity(); +} + //**************************************** // EffectWindowGroup diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index f1e2add39d..2b8ede9e46 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1360,6 +1360,16 @@ class KWIN_EXPORT EffectWindow : public QObject * @since 4.10 **/ Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha) + /** + * Whether the window is currently visible to the user, that is: + * + * @since 4.11 + **/ + Q_PROPERTY(bool visible READ isVisible) public: /** Flags explaining why painting should be disabled */ enum { @@ -1577,6 +1587,11 @@ public: bool isCurrentTab() const; + /** + * @since 4.11 + **/ + bool isVisible() const; + /** * Can be used to by effects to store arbitrary data in the EffectWindow. */