correctly handle virtual desktop on packing

copy approach from smart placement

REVIEW: 122417
This commit is contained in:
Thomas Lübking 2015-02-03 22:59:07 +01:00
parent d5f126f0c8
commit 956941bc95

View file

@ -879,8 +879,9 @@ int Workspace::packPositionLeft(const Client* cl, int oldx, bool left_edge) cons
} }
if (oldx <= newx) if (oldx <= newx)
return oldx; return oldx;
const int desktop = cl->desktop() == 0 || cl->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : cl->desktop();
for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) { for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) {
if (isIrrelevant(*it, cl, cl->desktop())) if (isIrrelevant(*it, cl, desktop))
continue; continue;
int x = left_edge ? (*it)->geometry().right() + 1 : (*it)->geometry().left() - 1; int x = left_edge ? (*it)->geometry().right() + 1 : (*it)->geometry().left() - 1;
if (x > newx && x < oldx if (x > newx && x < oldx
@ -906,8 +907,9 @@ int Workspace::packPositionRight(const Client* cl, int oldx, bool right_edge) co
} }
if (oldx >= newx) if (oldx >= newx)
return oldx; return oldx;
const int desktop = cl->desktop() == 0 || cl->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : cl->desktop();
for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) { for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) {
if (isIrrelevant(*it, cl, cl->desktop())) if (isIrrelevant(*it, cl, desktop))
continue; continue;
int x = right_edge ? (*it)->geometry().left() - 1 : (*it)->geometry().right() + 1; int x = right_edge ? (*it)->geometry().left() - 1 : (*it)->geometry().right() + 1;
if (x < newx && x > oldx if (x < newx && x > oldx
@ -933,8 +935,9 @@ int Workspace::packPositionUp(const Client* cl, int oldy, bool top_edge) const
} }
if (oldy <= newy) if (oldy <= newy)
return oldy; return oldy;
const int desktop = cl->desktop() == 0 || cl->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : cl->desktop();
for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) { for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) {
if (isIrrelevant(*it, cl, cl->desktop())) if (isIrrelevant(*it, cl, desktop))
continue; continue;
int y = top_edge ? (*it)->geometry().bottom() + 1 : (*it)->geometry().top() - 1; int y = top_edge ? (*it)->geometry().bottom() + 1 : (*it)->geometry().top() - 1;
if (y > newy && y < oldy if (y > newy && y < oldy
@ -960,8 +963,9 @@ int Workspace::packPositionDown(const Client* cl, int oldy, bool bottom_edge) co
} }
if (oldy >= newy) if (oldy >= newy)
return oldy; return oldy;
const int desktop = cl->desktop() == 0 || cl->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : cl->desktop();
for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) { for (ClientList::ConstIterator it = clients.constBegin(), end = clients.constEnd(); it != end; ++it) {
if (isIrrelevant(*it, cl, cl->desktop())) if (isIrrelevant(*it, cl, desktop))
continue; continue;
int y = bottom_edge ? (*it)->geometry().top() - 1 : (*it)->geometry().bottom() + 1; int y = bottom_edge ? (*it)->geometry().top() - 1 : (*it)->geometry().bottom() + 1;
if (y < newy && y > oldy if (y < newy && y > oldy