diff --git a/dbusinterface.cpp b/dbusinterface.cpp index 6d64a9fc6a..0aa6eb0d1d 100644 --- a/dbusinterface.cpp +++ b/dbusinterface.cpp @@ -72,11 +72,20 @@ void DBusInterface::name() \ Workspace::self()->name();\ } -WRAP(cascadeDesktop) WRAP(killWindow) WRAP(nextDesktop) WRAP(previousDesktop) WRAP(reconfigure) + +#undef WRAP + +#define WRAP(name) \ +void DBusInterface::name() \ +{\ + Placement::self()->name();\ +} + +WRAP(cascadeDesktop) WRAP(unclutterDesktop) #undef WRAP diff --git a/geometry.cpp b/geometry.cpp index 76fa5e3e1e..fb02564b97 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -763,43 +763,6 @@ void Workspace::setClientIsMoving(Client *c) --block_focus; } -/*! - Cascades all clients on the current desktop - */ -void Workspace::cascadeDesktop() -{ -// TODO XINERAMA this probably is not right for xinerama - Q_ASSERT(block_stacking_updates == 0); - initPositioning->reinitCascading(currentDesktop()); - QRect area = clientArea(PlacementArea, QPoint(0, 0), currentDesktop()); - foreach (Toplevel *toplevel, stackingOrder()) { - Client *client = qobject_cast(toplevel); - if (!client || - (!client->isOnDesktop(currentDesktop())) || - (client->isMinimized()) || - (client->isOnAllDesktops()) || - (!client->isMovable())) - continue; - initPositioning->placeCascaded(client, area); - } -} - -/*! - Unclutters the current desktop by smart-placing all clients - again. - */ -void Workspace::unclutterDesktop() -{ - for (int i = clients.size() - 1; i >= 0; i--) { - if ((!clients.at(i)->isOnDesktop(currentDesktop())) || - (clients.at(i)->isMinimized()) || - (clients.at(i)->isOnAllDesktops()) || - (!clients.at(i)->isMovable())) - continue; - initPositioning->placeSmart(clients.at(i), QRect()); - } -} - // When kwin crashes, windows will not be gravitated back to their original position // and will remain offset by the size of the decoration. So when restarting, fix this // (the property with the size of the frame remains on the window after the crash). diff --git a/placement.cpp b/placement.cpp index e889980e60..cc25e8607f 100644 --- a/placement.cpp +++ b/placement.cpp @@ -543,6 +543,40 @@ void Placement::placeMaximizing(Client* c, QRect& area, Policy nextPlacement) } } +void Placement::cascadeDesktop() +{ +// TODO XINERAMA this probably is not right for xinerama + Workspace *ws = Workspace::self(); + const int desktop = ws->currentDesktop(); + reinitCascading(desktop); + // TODO: make area const once placeFoo methods are fixed to take a const QRect& + QRect area = ws->clientArea(PlacementArea, QPoint(0, 0), desktop); + foreach (Toplevel *toplevel, ws->stackingOrder()) { + Client *client = qobject_cast(toplevel); + if (!client || + (!client->isOnCurrentDesktop()) || + (client->isMinimized()) || + (client->isOnAllDesktops()) || + (!client->isMovable())) + continue; + placeCascaded(client, area); + } +} + +void Placement::unclutterDesktop() +{ + const ClientList &clients = Workspace::self()->clientList(); + for (int i = clients.size() - 1; i >= 0; i--) { + Client *client = clients.at(i); + if ((!client->isOnCurrentDesktop()) || + (client->isMinimized()) || + (client->isOnAllDesktops()) || + (!client->isMovable())) + continue; + placeSmart(client, QRect()); + } +} + QRect Placement::checkArea(const Client* c, const QRect& area) { if (area.isNull()) diff --git a/placement.h b/placement.h index 93b42f4037..cc9c33e9e9 100644 --- a/placement.h +++ b/placement.h @@ -71,6 +71,15 @@ public: void reinitCascading(int desktop); + /** + * Cascades all clients on the current desktop + **/ + void cascadeDesktop(); + /** + * Unclutters the current desktop by smart-placing all clients again. + **/ + void unclutterDesktop(); + static Policy policyFromString(const QString& policy, bool no_special); static const char* policyToString(Policy policy); diff --git a/workspace.h b/workspace.h index 708e23333d..c0f4c541e0 100644 --- a/workspace.h +++ b/workspace.h @@ -448,8 +448,6 @@ public: bool decorationSupportsBlurBehind() const; // D-Bus interface - void cascadeDesktop(); - void unclutterDesktop(); void doNotManage(const QString&); /** * @deprecated