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,23 +154,9 @@ void ClientModel::createClientList(bool partialReset)
|
|||
createClientList(tabBox->currentDesktop(), partialReset);
|
||||
}
|
||||
|
||||
void ClientModel::createClientList(int desktop, bool partialReset)
|
||||
void ClientModel::createFocusChainClientList(int desktop,
|
||||
const QSharedPointer<TabBoxClient> &start, TabBoxClientList &stickyClients)
|
||||
{
|
||||
auto start = tabBox->activeClient().toStrongRef();
|
||||
// TODO: new clients are not added at correct position
|
||||
if (partialReset && !m_clientList.isEmpty()) {
|
||||
QSharedPointer<TabBoxClient> firstClient = m_clientList.constFirst();
|
||||
if (firstClient) {
|
||||
start = firstClient;
|
||||
}
|
||||
}
|
||||
|
||||
beginResetModel();
|
||||
m_clientList.clear();
|
||||
QList<QWeakPointer<TabBoxClient>> stickyClients;
|
||||
|
||||
switch (tabBox->config().clientSwitchingMode()) {
|
||||
case TabBoxConfig::FocusChainSwitching: {
|
||||
auto c = start;
|
||||
if (!tabBox->isInFocusChain(c.data())) {
|
||||
QSharedPointer<TabBoxClient> firstClient = tabBox->firstClientFocusChain().toStrongRef();
|
||||
|
@ -189,6 +175,26 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
|||
}
|
||||
c = tabBox->nextClientFocusChain(c.data());
|
||||
} while (c && c != stop);
|
||||
}
|
||||
|
||||
void ClientModel::createClientList(int desktop, bool partialReset)
|
||||
{
|
||||
auto start = tabBox->activeClient().toStrongRef();
|
||||
// TODO: new clients are not added at correct position
|
||||
if (partialReset && !m_clientList.isEmpty()) {
|
||||
QSharedPointer<TabBoxClient> firstClient = m_clientList.constFirst();
|
||||
if (firstClient) {
|
||||
start = firstClient;
|
||||
}
|
||||
}
|
||||
|
||||
beginResetModel();
|
||||
m_clientList.clear();
|
||||
QList<QWeakPointer<TabBoxClient>> stickyClients;
|
||||
|
||||
switch (tabBox->config().clientSwitchingMode()) {
|
||||
case TabBoxConfig::FocusChainSwitching: {
|
||||
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