Fix one list pollution in tabbing code

REVIEW: 103612
BUG: 290387
(cherry picked from commit 67b3dc9e619b60552ddf1c6506453037cd7830cf)
This commit is contained in:
Thomas Lübking 2012-01-02 18:12:04 +01:00
parent e1d15d9c21
commit 2a54c47ed1

View file

@ -270,35 +270,39 @@ void ClientGroup::setVisible(Client* c)
void ClientGroup::updateStates(Client* main, Client* only) void ClientGroup::updateStates(Client* main, Client* only)
{ {
for (ClientList::const_iterator i = clients_.constBegin(); i != clients_.constEnd(); ++i) ClientList toBeRemoved;
if ((*i) != main && (!only || (*i) == only)) { for (ClientList::const_iterator i = clients_.constBegin(), end = clients_.constEnd(); i != end; ++i) {
if ((*i)->isMinimized() != main->isMinimized()) { Client *c = (*i);
if (c != main && (!only || c == only)) {
if (c->isMinimized() != main->isMinimized()) {
if (main->isMinimized()) if (main->isMinimized())
(*i)->minimize(true); c->minimize(true);
else else
(*i)->unminimize(true); c->unminimize(true);
} }
if ((*i)->isShade() != main->isShade()) if (c->isShade() != main->isShade())
(*i)->setShade(main->isShade() ? ShadeNormal : ShadeNone); c->setShade(main->isShade() ? ShadeNormal : ShadeNone);
if ((*i)->geometry() != main->geometry()) if (c->geometry() != main->geometry())
(*i)->setGeometry(main->geometry()); c->setGeometry(main->geometry());
if ((*i)->desktop() != main->desktop()) if (c->desktop() != main->desktop())
(*i)->setDesktop(main->desktop()); c->setDesktop(main->desktop());
if ((*i)->isOnAllDesktops() != main->isOnAllDesktops()) if (c->isOnAllDesktops() != main->isOnAllDesktops())
(*i)->setOnAllDesktops(main->isOnAllDesktops()); c->setOnAllDesktops(main->isOnAllDesktops());
if ((*i)->activities() != main->activities()) if (c->activities() != main->activities())
(*i)->setOnActivities(main->activities()); c->setOnActivities(main->activities());
if ((*i)->keepAbove() != main->keepAbove()) if (c->keepAbove() != main->keepAbove())
(*i)->setKeepAbove(main->keepAbove()); c->setKeepAbove(main->keepAbove());
if ((*i)->keepBelow() != main->keepBelow()) if (c->keepBelow() != main->keepBelow())
(*i)->setKeepBelow(main->keepBelow()); c->setKeepBelow(main->keepBelow());
// If it's not possible to have the same states then ungroup them, TODO: Check all states // If it's not possible to have the same states then ungroup them, TODO: Check all states
if ((*i)->geometry() != main->geometry()) if (c->geometry() != main->geometry() || c->desktop() != main->desktop())
remove(*i); toBeRemoved << c;
if ((*i)->desktop() != main->desktop())
remove(*i);
} }
}
for (ClientList::const_iterator i = toBeRemoved.constBegin(), end = toBeRemoved.constEnd(); i != end; ++i)
remove(*i);
} }
void ClientGroup::updateItems() void ClientGroup::updateItems()