const bool sameclass, const string &cn) const {
assert(_managed);
- if (_clients.empty()) return;
-
WindowList::const_iterator target = _active;
string classname = cn;
if (target == _clients.end())
target = _clients.begin();
+
+ WindowList::const_iterator begin = target;
do {
if (forward) {
target = _clients.end();
--target;
}
+
+ // no window to focus
+ if (target == begin)
+ return;
} while (target == _clients.end() ||
(*target)->iconic() ||
(! alldesktops && (*target)->desktop() != _active_desktop) ||