Commit 93f322d2 authored by Rachel Mant's avatar Rachel Mant Committed by Vlad Zahorodnii
Browse files

Refactored out the FocusChainSwitching logic for the tabbox client model

parent 7e1617c2
......@@ -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;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment