From 2f18fe002f7c3c0f77ce51acbb0344ebc955c80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 23 Aug 2012 08:39:07 +0200 Subject: [PATCH] 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 --- tabbox/clientmodel.cpp | 15 ++++----------- tabbox/tabbox.cpp | 3 +++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tabbox/clientmodel.cpp b/tabbox/clientmodel.cpp index adeeca608d..9591babaa8 100644 --- a/tabbox/clientmodel.cpp +++ b/tabbox/clientmodel.cpp @@ -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 firstClient = tabBox->firstClientFocusChain().toStrongRef(); if (firstClient) { @@ -195,23 +195,16 @@ void ClientModel::createClientList(int desktop, bool partialReset) } } TabBoxClient* stop = c; - while (c) { + do { QWeakPointer add = tabBox->clientToAddToList(c, desktop); if (!add.isNull()) { - if (start == add.data()) { - m_clientList.removeAll(add); - m_clientList.prepend(add); - } else - m_clientList += add; + 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: { diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index fda99da3f6..d96d0bdace 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -225,6 +225,9 @@ bool TabBoxHandlerImpl::checkMultiScreen(TabBoxClient* client) const QWeakPointer TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop) const { + if (!client) { + return QWeakPointer(); + } Client* ret = NULL; Client* current = (static_cast< TabBoxClientImpl* >(client))->client();