ignore non current tabbed and on different activities clients
BUG: 313379 REVIEW: 108932 FIXED-IN: 4.11
This commit is contained in:
parent
694d1a83b3
commit
769955dfb8
1 changed files with 49 additions and 42 deletions
|
@ -148,6 +148,24 @@ void Placement::placeAtRandom(Client* c, const QRect& area, Policy /*next*/)
|
||||||
c->move(tx, ty);
|
c->move(tx, ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: one day, there'll be C++11 ...
|
||||||
|
static inline bool isIrrelevant(Client *client, Client *regarding, int desktop)
|
||||||
|
{
|
||||||
|
if (!client)
|
||||||
|
return true;
|
||||||
|
if (client == regarding)
|
||||||
|
return true;
|
||||||
|
if (!client->isCurrentTab())
|
||||||
|
return true;
|
||||||
|
if (!client->isShown(false))
|
||||||
|
return true;
|
||||||
|
if (!client->isOnDesktop(desktop))
|
||||||
|
return true;
|
||||||
|
if (!client->isOnCurrentActivity())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Place the client \a c according to a really smart placement algorithm :-)
|
Place the client \a c according to a really smart placement algorithm :-)
|
||||||
*/
|
*/
|
||||||
|
@ -198,12 +216,9 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
|
||||||
ToplevelList::ConstIterator l;
|
ToplevelList::ConstIterator l;
|
||||||
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) {
|
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) {
|
||||||
Client *client = qobject_cast<Client*>(*l);
|
Client *client = qobject_cast<Client*>(*l);
|
||||||
if (!client) {
|
if (isIrrelevant(client, c, desktop)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (client->isOnDesktop(desktop) &&
|
|
||||||
client->isShown(false) && client != c) {
|
|
||||||
|
|
||||||
xl = client->x(); yt = client->y();
|
xl = client->x(); yt = client->y();
|
||||||
xr = xl + client->width(); yb = yt + client->height();
|
xr = xl + client->width(); yb = yt + client->height();
|
||||||
|
|
||||||
|
@ -221,7 +236,6 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//CT first time we get no overlap we stop.
|
//CT first time we get no overlap we stop.
|
||||||
if (overlap == none) {
|
if (overlap == none) {
|
||||||
|
@ -251,13 +265,10 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
|
||||||
ToplevelList::ConstIterator l;
|
ToplevelList::ConstIterator l;
|
||||||
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) {
|
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) {
|
||||||
Client *client = qobject_cast<Client*>(*l);
|
Client *client = qobject_cast<Client*>(*l);
|
||||||
if (!client) {
|
if (isIrrelevant(client, c, desktop)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->isOnDesktop(desktop) &&
|
|
||||||
client->isShown(false) && client != c) {
|
|
||||||
|
|
||||||
xl = client->x(); yt = client->y();
|
xl = client->x(); yt = client->y();
|
||||||
xr = xl + client->width(); yb = yt + client->height();
|
xr = xl + client->width(); yb = yt + client->height();
|
||||||
|
|
||||||
|
@ -271,7 +282,6 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
|
||||||
if ((basket > x) && (possible > basket)) possible = basket;
|
if ((basket > x) && (possible > basket)) possible = basket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
x = possible;
|
x = possible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,11 +296,9 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
|
||||||
ToplevelList::ConstIterator l;
|
ToplevelList::ConstIterator l;
|
||||||
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) {
|
for (l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l) {
|
||||||
Client *client = qobject_cast<Client*>(*l);
|
Client *client = qobject_cast<Client*>(*l);
|
||||||
if (!client) {
|
if (isIrrelevant(client, c, desktop)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (client->isOnDesktop(desktop) &&
|
|
||||||
client != c && c->isShown(false)) {
|
|
||||||
|
|
||||||
xl = client->x(); yt = client->y();
|
xl = client->x(); yt = client->y();
|
||||||
xr = xl + client->width(); yb = yt + client->height();
|
xr = xl + client->width(); yb = yt + client->height();
|
||||||
|
@ -302,7 +310,6 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/)
|
||||||
basket = yt - ch;
|
basket = yt - ch;
|
||||||
if ((basket > y) && (possible > basket)) possible = basket;
|
if ((basket > y) && (possible > basket)) possible = basket;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
y = possible;
|
y = possible;
|
||||||
}
|
}
|
||||||
} while ((overlap != none) && (overlap != h_wrong) && (y < maxRect.bottom()));
|
} while ((overlap != none) && (overlap != h_wrong) && (y < maxRect.bottom()));
|
||||||
|
|
Loading…
Reference in a new issue