step into the focus chain at the beginning

if the index is 0, we close the circle, but if the
index is -1 (invalid) we're "somewhere" and step
into the focus chain - reasonably at the beginning

BUG: 340594
REVIEW: 121024
This commit is contained in:
Thomas Lübking 2014-11-06 22:58:53 +01:00
parent b26ef9302a
commit 7747a38189

View file

@ -202,7 +202,10 @@ Client *FocusChain::nextMostRecentlyUsed(Client *reference) const
return NULL;
}
const int index = m_mostRecentlyUsed.indexOf(reference);
if (index == -1 || index == 0) {
if (index == -1) {
return m_mostRecentlyUsed.first();
}
if (index == 0) {
return m_mostRecentlyUsed.last();
}
return m_mostRecentlyUsed.at(index - 1);