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);
|
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)
|
void ClientModel::createClientList(int desktop, bool partialReset)
|
||||||
{
|
{
|
||||||
auto start = tabBox->activeClient().toStrongRef();
|
auto start = tabBox->activeClient().toStrongRef();
|
||||||
|
@ -171,24 +194,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
||||||
|
|
||||||
switch (tabBox->config().clientSwitchingMode()) {
|
switch (tabBox->config().clientSwitchingMode()) {
|
||||||
case TabBoxConfig::FocusChainSwitching: {
|
case TabBoxConfig::FocusChainSwitching: {
|
||||||
auto c = start;
|
createFocusChainClientList(desktop, start, stickyClients);
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TabBoxConfig::StackingOrderSwitching: {
|
case TabBoxConfig::StackingOrderSwitching: {
|
||||||
|
|
|
@ -94,6 +94,9 @@ public Q_SLOTS:
|
||||||
void activate(int index);
|
void activate(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void createFocusChainClientList(int desktop, const QSharedPointer<TabBoxClient> &start,
|
||||||
|
TabBoxClientList &stickyClients);
|
||||||
|
|
||||||
TabBoxClientList m_clientList;
|
TabBoxClientList m_clientList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue