Refactored out the FocusChainSwitching logic for the tabbox client model
This commit is contained in:
parent
7e1617c280
commit
93f322d262
2 changed files with 27 additions and 18 deletions
|
@ -154,6 +154,29 @@ void ClientModel::createClientList(bool partialReset)
|
|||
createClientList(tabBox->currentDesktop(), partialReset);
|
||||
}
|
||||
|
||||
void ClientModel::createFocusChainClientList(int desktop,
|
||||
const QSharedPointer<TabBoxClient> &start, TabBoxClientList &stickyClients)
|
||||
{
|
||||
auto c = start;
|
||||
if (!tabBox->isInFocusChain(c.data())) {
|
||||
QSharedPointer<TabBoxClient> firstClient = tabBox->firstClientFocusChain().toStrongRef();
|
||||
if (firstClient) {
|
||||
c = firstClient;
|
||||
}
|
||||
}
|
||||
auto stop = c;
|
||||
do {
|
||||
QSharedPointer<TabBoxClient> add = tabBox->clientToAddToList(c.data(), desktop);
|
||||
if (!add.isNull()) {
|
||||
m_clientList += add;
|
||||
if (add.data()->isFirstInTabBox()) {
|
||||
stickyClients << add;
|
||||
}
|
||||
}
|
||||
c = tabBox->nextClientFocusChain(c.data());
|
||||
} while (c && c != stop);
|
||||
}
|
||||
|
||||
void ClientModel::createClientList(int desktop, bool partialReset)
|
||||
{
|
||||
auto start = tabBox->activeClient().toStrongRef();
|
||||
|
@ -171,24 +194,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
|||
|
||||
switch (tabBox->config().clientSwitchingMode()) {
|
||||
case TabBoxConfig::FocusChainSwitching: {
|
||||
auto c = start;
|
||||
if (!tabBox->isInFocusChain(c.data())) {
|
||||
QSharedPointer<TabBoxClient> firstClient = tabBox->firstClientFocusChain().toStrongRef();
|
||||
if (firstClient) {
|
||||
c = firstClient;
|
||||
}
|
||||
}
|
||||
auto stop = c;
|
||||
do {
|
||||
QSharedPointer<TabBoxClient> add = tabBox->clientToAddToList(c.data(), desktop);
|
||||
if (!add.isNull()) {
|
||||
m_clientList += add;
|
||||
if (add.data()->isFirstInTabBox()) {
|
||||
stickyClients << add;
|
||||
}
|
||||
}
|
||||
c = tabBox->nextClientFocusChain(c.data());
|
||||
} while (c && c != stop);
|
||||
createFocusChainClientList(desktop, start, stickyClients);
|
||||
break;
|
||||
}
|
||||
case TabBoxConfig::StackingOrderSwitching: {
|
||||
|
|
|
@ -94,6 +94,9 @@ public Q_SLOTS:
|
|||
void activate(int index);
|
||||
|
||||
private:
|
||||
void createFocusChainClientList(int desktop, const QSharedPointer<TabBoxClient> &start,
|
||||
TabBoxClientList &stickyClients);
|
||||
|
||||
TabBoxClientList m_clientList;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue