+
+void screen::cycleWindow(const bool forward) const {
+ if (_clients.empty()) return;
+
+ WindowList::const_iterator target = _active;
+
+ if (target == _clients.end())
+ target = _clients.begin();
+
+ do {
+ if (forward) {
+ ++target;
+ if (target == _clients.end())
+ target = _clients.begin();
+ } else {
+ if (target == _clients.begin())
+ target = _clients.end();
+ --target;
+ }
+ } while (target == _clients.end() || (*target)->iconic());
+
+ if (target != _clients.end()) {
+ // we dont send an ACTIVE_WINDOW client message because that would also
+ // unshade the window if it was shaded
+ XSetInputFocus(_epist->getXDisplay(), (*target)->window(), RevertToNone,
+ CurrentTime);
+ XRaiseWindow(_epist->getXDisplay(), (*target)->window());
+ }
+}
+
+