Remove Workspace pointer from Placement

This commit is contained in:
Martin Gräßlin 2013-05-08 13:55:20 +02:00
parent d305185247
commit fc4f431bfb
2 changed files with 6 additions and 10 deletions

View file

@ -43,8 +43,6 @@ KWIN_SINGLETON_FACTORY(Placement)
Placement::Placement(QObject*) Placement::Placement(QObject*)
{ {
m_WorkspacePtr = Workspace::self();
reinitCascading(0); reinitCascading(0);
} }
@ -207,7 +205,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
cxl = x; cxr = x + cw; cxl = x; cxr = x + cw;
cyt = y; cyb = y + ch; cyt = y; cyb = y + ch;
ToplevelList::ConstIterator l; ToplevelList::ConstIterator l;
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) { for (l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
Client *client = qobject_cast<Client*>(*l); Client *client = qobject_cast<Client*>(*l);
if (isIrrelevant(client, c, desktop)) { if (isIrrelevant(client, c, desktop)) {
continue; continue;
@ -256,7 +254,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
// compare to the position of each client on the same desk // compare to the position of each client on the same desk
ToplevelList::ConstIterator l; ToplevelList::ConstIterator l;
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) { for (l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
Client *client = qobject_cast<Client*>(*l); Client *client = qobject_cast<Client*>(*l);
if (isIrrelevant(client, c, desktop)) { if (isIrrelevant(client, c, desktop)) {
continue; continue;
@ -287,7 +285,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
//test the position of each window on the desk //test the position of each window on the desk
ToplevelList::ConstIterator l; ToplevelList::ConstIterator l;
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) { for (l = workspace()->stackingOrder().constBegin(); l != workspace()->stackingOrder().constEnd() ; ++l) {
Client *client = qobject_cast<Client*>(*l); Client *client = qobject_cast<Client*>(*l);
if (isIrrelevant(client, c, desktop)) { if (isIrrelevant(client, c, desktop)) {
continue; continue;
@ -350,7 +348,7 @@ void Placement::placeCascaded(Client* c, QRect& area, Policy nextPlacement)
int xp, yp; int xp, yp;
//CT how do I get from the 'Client' class the size that NW squarish "handle" //CT how do I get from the 'Client' class the size that NW squarish "handle"
const QPoint delta = m_WorkspacePtr->cascadeOffset(c); const QPoint delta = workspace()->cascadeOffset(c);
const int dn = c->desktop() == 0 || c->isOnAllDesktops() ? (VirtualDesktopManager::self()->current() - 1) : (c->desktop() - 1); const int dn = c->desktop() == 0 || c->isOnAllDesktops() ? (VirtualDesktopManager::self()->current() - 1) : (c->desktop() - 1);
@ -531,7 +529,7 @@ void Placement::placeMaximizing(Client* c, QRect& area, Policy nextPlacement)
if (nextPlacement == Unknown) if (nextPlacement == Unknown)
nextPlacement = Smart; nextPlacement = Smart;
if (c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height()) { if (c->isMaximizable() && c->maxSize().width() >= area.width() && c->maxSize().height() >= area.height()) {
if (m_WorkspacePtr->clientArea(MaximizeArea, c) == area) if (workspace()->clientArea(MaximizeArea, c) == area)
c->maximize(Client::MaximizeFull); c->maximize(Client::MaximizeFull);
else { // if the geometry doesn't match default maximize area (xinerama case?), else { // if the geometry doesn't match default maximize area (xinerama case?),
// it's probably better to use the given area // it's probably better to use the given area
@ -580,7 +578,7 @@ void Placement::unclutterDesktop()
QRect Placement::checkArea(const Client* c, const QRect& area) QRect Placement::checkArea(const Client* c, const QRect& area)
{ {
if (area.isNull()) if (area.isNull())
return m_WorkspacePtr->clientArea(PlacementArea, c->geometry().center(), c->desktop()); return workspace()->clientArea(PlacementArea, c->geometry().center(), c->desktop());
return area; return area;
} }

View file

@ -34,7 +34,6 @@ class QObject;
namespace KWin namespace KWin
{ {
class Workspace;
class Client; class Client;
class Placement class Placement
@ -102,7 +101,6 @@ private:
QList<DesktopCascadingInfo> cci; QList<DesktopCascadingInfo> cci;
Workspace* m_WorkspacePtr;
KWIN_SINGLETON(Placement) KWIN_SINGLETON(Placement)
}; };