From 85c5439b5d0d482dc0f5f389249a4ecaed635c0d Mon Sep 17 00:00:00 2001 From: Arthur Arlt Date: Tue, 19 Jul 2011 12:21:35 +0200 Subject: [PATCH] Remove tiling dependency from Client The direct method calls from class Client were removed and replaced by connecting to the appropriate signals emitted by class Client. The affected methods in class Tiling are notifyTilingWindowMinimizeToggle() and updateAllTiles() which are now private Q_SLOTS. Including tiling.h in class Client is no longer needed and was removed. --- client.cpp | 8 -------- tiling/tiling.cpp | 6 +++++- tiling/tiling.h | 8 ++++---- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/client.cpp b/client.cpp index fe5016c3db..46c8effed8 100644 --- a/client.cpp +++ b/client.cpp @@ -47,7 +47,6 @@ along with this program. If not, see . #include "notifications.h" #include "rules.h" #include "shadow.h" -#include "tiling/tiling.h" #include "deleted.h" #include "paintredirector.h" #ifdef KWIN_BUILD_TABBOX @@ -951,9 +950,6 @@ void Client::minimize(bool avoid_animation) // TODO: merge signal with s_minimized emit clientMinimized(this, !avoid_animation); - // when tiling, request a rearrangement - workspace()->tiling()->notifyTilingWindowMinimizeToggled(this); - // Update states of all other windows in this group if (clientGroup()) clientGroup()->updateStates(this); @@ -979,12 +975,8 @@ void Client::unminimize(bool avoid_animation) updateAllowedActions(); workspace()->updateMinimizedOfTransients(this); updateWindowRules(); - workspace()->tiling()->updateAllTiles(); emit clientUnminimized(this, !avoid_animation); - // when tiling, request a rearrangement - workspace()->tiling()->notifyTilingWindowMinimizeToggled(this); - // Update states of all other windows in this group if (clientGroup()) clientGroup()->updateStates(this); diff --git a/tiling/tiling.cpp b/tiling/tiling.cpp index 4e8714429e..904ecea520 100644 --- a/tiling/tiling.cpp +++ b/tiling/tiling.cpp @@ -145,6 +145,10 @@ void Tiling::createTile(Client* c) } tilingLayouts[c->desktop()]->addTile(t); tilingLayouts[c->desktop()]->commit(); + // if tiling is activated, connect to Client's signals and react with rearrangement when (un)minimizing + connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(notifyTilingWindowMinimizeToggled(KWin::Client*))); + connect(c, SIGNAL(clientUnminimized(KWin::Client*,bool)), this, SLOT(notifyTilingWindowMinimizeToggled(KWin::Client*))); + connect(c, SIGNAL(s_unminimized()), this, SLOT(updateAllTiles())); } void Tiling::removeTile(Client *c) @@ -299,7 +303,7 @@ void Tiling::notifyTilingWindowActivated(Client *c) } } -void Tiling::notifyTilingWindowMinimizeToggled(Client *c) +void Tiling::notifyTilingWindowMinimizeToggled(KWin::Client* c) { if (tilingLayouts.value(c->desktop())) { tilingLayouts[ c->desktop()]->clientMinimizeToggled(c); diff --git a/tiling/tiling.h b/tiling/tiling.h index a3cee78dc4..52543c8120 100644 --- a/tiling/tiling.h +++ b/tiling/tiling.h @@ -41,9 +41,6 @@ public: bool tilingEnabled() const; void setTilingEnabled(bool tiling); bool tileable(Client *c); - // updates geometry of tiles on all desktops, - // this rearranges the tiles. - void updateAllTiles(); const QVector< TilingLayout* >& getTilingLayouts() const; void initShortcuts(KActionCollection* keys); @@ -57,7 +54,6 @@ public: void notifyTilingWindowMoveDone(Client *c, const QRect &moveResizeGeom, const QRect &orig, bool canceled); void notifyTilingWindowDesktopChanged(Client *c, int old_desktop); void notifyTilingWindowActivated(Client *c); - void notifyTilingWindowMinimizeToggled(Client *c); void notifyTilingWindowMaximized(Client *c, KDecorationDefines::WindowOperation op); KDecorationDefines::Position supportedTilingResizeMode(Client *c, KDecorationDefines::Position currentMode); @@ -105,6 +101,10 @@ private: QVector tilingLayouts; private Q_SLOTS: void slotResizeTilingLayouts(); + void notifyTilingWindowMinimizeToggled(KWin::Client *c); + // updates geometry of tiles on all desktops, + // this rearranges the tiles. + void updateAllTiles(); }; }