From a38faa432980b2ecddbf0f0d2ed2ce4c190f43ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 15 Jan 2012 11:26:38 +0100 Subject: [PATCH] Add visibleInClientGroup property --- client.cpp | 8 ++++++++ client.h | 6 ++++++ effects.cpp | 10 ---------- effects.h | 2 -- libkwineffects/kwineffects.cpp | 1 + libkwineffects/kwineffects.h | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/client.cpp b/client.cpp index 0c9428c767..03359920d8 100644 --- a/client.cpp +++ b/client.cpp @@ -1903,6 +1903,14 @@ void Client::setClientGroup(ClientGroup* group) emit clientGroupChanged(); } +bool Client::isVisibleInClientGroup() const +{ + if (!client_group) { + return true; + } + return (client_group->visible() == this); +} + void Client::dontMoveResize() { buttonDown = false; diff --git a/client.h b/client.h index 65f3ebc301..159e8f3722 100644 --- a/client.h +++ b/client.h @@ -222,6 +222,11 @@ class Client * The "Window Tabs" Group this Client belongs to. **/ Q_PROPERTY(KWin::ClientGroup* clientGroup READ clientGroup NOTIFY clientGroupChanged) + /** + * Whether this Client is the currently visible Client in its Client Group (Window Tabs). + * For change connect to the visibleChanged signal on the Client's Group. + **/ + Q_PROPERTY(bool visibleInClientGroup READ isVisibleInClientGroup) /** * Minimum size as specified in WM_NORMAL_HINTS **/ @@ -510,6 +515,7 @@ public: * client, this function stops it. */ void dontMoveResize(); + bool isVisibleInClientGroup() const; /** * Whether or not the window has a strut that expands through the invisible area of diff --git a/effects.cpp b/effects.cpp index fa2652fab7..a8cb3d1597 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1450,16 +1450,6 @@ WindowQuadList EffectWindowImpl::buildQuads(bool force) const return sceneWindow()->buildQuads(force); } -bool EffectWindowImpl::visibleInClientGroup() const -{ - if (Client* c = dynamic_cast< Client* >(toplevel)) { - if (!c->clientGroup()) - return true; - return c == c->clientGroup()->visible(); - } - return false; -} - void EffectWindowImpl::setData(int role, const QVariant &data) { if (!data.isNull()) diff --git a/effects.h b/effects.h index f15cd16f26..ed8db99713 100644 --- a/effects.h +++ b/effects.h @@ -253,8 +253,6 @@ public: virtual WindowQuadList buildQuads(bool force = false) const; - virtual bool visibleInClientGroup() const; - const Toplevel* window() const; Toplevel* window(); diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index d21d74c612..2f95b89516 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -380,6 +380,7 @@ WINDOW_HELPER_DEFAULT(bool, isSpecialWindow, "specialWindow", true) WINDOW_HELPER_DEFAULT(bool, acceptsFocus, "wantsInput", true) // We don't actually know... WINDOW_HELPER_DEFAULT(QPixmap, icon, "icon", QPixmap()) WINDOW_HELPER_DEFAULT(bool, isSkipSwitcher, "skipSwitcher", false) +WINDOW_HELPER_DEFAULT(bool, visibleInClientGroup, "visibleInClientGroup", false) #undef WINDOW_HELPER_DEFAULT diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 73af346354..63f1a6edb2 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1273,7 +1273,7 @@ public: void unminimize(); void closeWindow() const; - virtual bool visibleInClientGroup() const = 0; + bool visibleInClientGroup() const; /** * Can be used to by effects to store arbitrary data in the EffectWindow.