diff --git a/client.cpp b/client.cpp index 775043aab7..0c9428c767 100644 --- a/client.cpp +++ b/client.cpp @@ -2405,6 +2405,11 @@ void Client::updateFirstInTabBox() XFree(data); } +bool Client::isClient() const +{ + return true; +} + } // namespace #include "client.moc" diff --git a/client.h b/client.h index f8be3cb16e..65f3ebc301 100644 --- a/client.h +++ b/client.h @@ -579,6 +579,7 @@ public: //sets whether the client should be treated as a SessionInteract window void setSessionInteract(bool needed); + virtual bool isClient() const; public slots: void closeWindow(); diff --git a/deleted.cpp b/deleted.cpp index e166bf1039..762ea26928 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -161,6 +161,11 @@ QRect Deleted::transparentRect() const return transparent_rect; } +bool Deleted::isDeleted() const +{ + return true; +} + } // namespace #include "deleted.moc" diff --git a/deleted.h b/deleted.h index 81012973e6..e52b342e66 100644 --- a/deleted.h +++ b/deleted.h @@ -40,6 +40,7 @@ public: virtual QPoint clientPos() const; virtual QSize clientSize() const; virtual QRect transparentRect() const; + virtual bool isDeleted() const; const QPixmap *topDecoPixmap() const { return &decorationPixmapTop; } diff --git a/effects.cpp b/effects.cpp index 633e2b07d5..5ff27763a5 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1378,11 +1378,6 @@ const EffectWindowGroup* EffectWindowImpl::group() const return NULL; // TODO } -bool EffectWindowImpl::isDeleted() const -{ - return (dynamic_cast(toplevel) != 0); -} - void EffectWindowImpl::refWindow() { if (Deleted* d = dynamic_cast< Deleted* >(toplevel)) @@ -1434,11 +1429,6 @@ void EffectWindowImpl::deleteProperty(long int atom) const deleteWindowProperty(window()->window(), atom); } -bool EffectWindowImpl::isManaged() const -{ - return dynamic_cast< const Client* >(toplevel) != NULL; -} - EffectWindow* EffectWindowImpl::findModal() { if (Client* c = dynamic_cast< Client* >(toplevel)) { diff --git a/effects.h b/effects.h index 0d63c245a6..bac6e408e8 100644 --- a/effects.h +++ b/effects.h @@ -240,7 +240,6 @@ public: virtual void refWindow(); virtual void unrefWindow(); - virtual bool isDeleted() const; virtual const EffectWindowGroup* group() const; @@ -250,7 +249,6 @@ public: virtual QByteArray readProperty(long atom, long type, int format) const; virtual void deleteProperty(long atom) const; - virtual bool isManaged() const; // managed or override-redirect virtual EffectWindow* findModal(); virtual EffectWindowList mainWindows() const; diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index ca692edbb2..412202a9bd 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -323,6 +323,8 @@ WINDOW_HELPER(bool, isTooltip, "tooltip") WINDOW_HELPER(bool, isNotification, "notification") WINDOW_HELPER(bool, isComboBox, "comboBox") WINDOW_HELPER(bool, isDNDIcon, "dndIcon") +WINDOW_HELPER(bool, isManaged, "managed") +WINDOW_HELPER(bool, isDeleted, "deleted") WINDOW_HELPER(QString, windowRole, "windowRole") QString EffectWindow::windowClass() const diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 45e759e84b..b350494996 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1099,7 +1099,7 @@ public: virtual void refWindow() = 0; virtual void unrefWindow() = 0; - virtual bool isDeleted() const = 0; + bool isDeleted() const; bool isMinimized() const; double opacity() const; @@ -1244,7 +1244,7 @@ public: * Returns whether the window is managed by KWin (it has control over its placement and other * aspects, as opposed to override-redirect windows that are entirely handled by the application). */ - virtual bool isManaged() const = 0; // whether it's managed or override-redirect + bool isManaged() const; // whether it's managed or override-redirect /** * Returns whether or not the window can accept keyboard focus. */ diff --git a/toplevel.cpp b/toplevel.cpp index 7cbbd970a6..8535f12662 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -446,6 +446,16 @@ void Toplevel::getWmOpaqueRegion() opaque_region = new_opaque_region; } +bool Toplevel::isClient() const +{ + return false; +} + +bool Toplevel::isDeleted() const +{ + return false; +} + } // namespace #include "toplevel.moc" diff --git a/toplevel.h b/toplevel.h index 8e6ea87c9c..183dee49c5 100644 --- a/toplevel.h +++ b/toplevel.h @@ -144,6 +144,15 @@ class Toplevel */ Q_PROPERTY(int windowType READ windowType) Q_PROPERTY(QStringList activities READ activities) + /** + * Whether this Toplevel is managed by KWin (it has control over its placement and other + * aspects, as opposed to override-redirect windows that are entirely handled by the application). + **/ + Q_PROPERTY(bool managed READ isClient CONSTANT) + /** + * Whether this Toplevel represents an already deleted window and only kept for the compositor for animations. + **/ + Q_PROPERTY(bool deleted READ isDeleted CONSTANT) public: Toplevel(Workspace *ws); Window frameId() const; @@ -165,6 +174,8 @@ public: virtual QRect decorationRect() const; // rect including the decoration shadows virtual QRect transparentRect() const = 0; virtual QRegion decorationPendingRegion() const; // decoration region that needs to be repainted + virtual bool isClient() const; + virtual bool isDeleted() const; // prefer isXXX() instead // 0 for supported types means default for managed/unmanaged types