Start building up of ClientModel with the first Client to include

So far the first Client to be shown in the list (that is the
currently active window) was inserted as the last client into
the list by prepending it to the list.

This meant that if another Client actually blocks the inclusion
of the currently selected Client (e.g. only one window per app)
the currently active Client never got included in this list.

This change ensures that the recently used model switching has
the starting Client as the first Client in the list and also
simplifies the code.

Stacking order switching mode is not adjusted as it seems rather
broken, like the comment already says.

BUG: 304950
FIXED-IN: 4.9.1
REVIEW: 106139
This commit is contained in:
Martin Gräßlin 2012-08-23 08:39:07 +02:00
parent a4fed7188c
commit 2f18fe002f
2 changed files with 7 additions and 11 deletions

View file

@ -187,7 +187,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
switch(tabBox->config().clientSwitchingMode()) {
case TabBoxConfig::FocusChainSwitching: {
TabBoxClient* c = tabBox->nextClientFocusChain(start).data();
TabBoxClient* c = start;
if (!c) {
QSharedPointer<TabBoxClient> firstClient = tabBox->firstClientFocusChain().toStrongRef();
if (firstClient) {
@ -195,23 +195,16 @@ void ClientModel::createClientList(int desktop, bool partialReset)
}
}
TabBoxClient* stop = c;
while (c) {
do {
QWeakPointer<TabBoxClient> add = tabBox->clientToAddToList(c, desktop);
if (!add.isNull()) {
if (start == add.data()) {
m_clientList.removeAll(add);
m_clientList.prepend(add);
} else
m_clientList += add;
if (add.data()->isFirstInTabBox()) {
stickyClients << add;
}
}
c = tabBox->nextClientFocusChain(c).data();
if (c == stop)
break;
}
} while (c && c != stop);
break;
}
case TabBoxConfig::StackingOrderSwitching: {

View file

@ -225,6 +225,9 @@ bool TabBoxHandlerImpl::checkMultiScreen(TabBoxClient* client) const
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop) const
{
if (!client) {
return QWeakPointer<TabBoxClient>();
}
Client* ret = NULL;
Client* current = (static_cast< TabBoxClientImpl* >(client))->client();