X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fscreen.cc;h=39b11d25d3b064d1fb7270eef991a4be4dc4a017;hb=fa95bcda02f92ef38a9b8abfdb6730988060a4ba;hp=281a093e3aa10745bee6978eb301b5a6b6302670;hpb=33cce0d97e6ec4ccf11775a450cb65f5938c88b7;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index 281a093e..39b11d25 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -65,7 +65,7 @@ screen::screen(epist *epist, int number) _managed = false; while (! (_epist->doShutdown() || _managed || count <= 0)) { if (! (_managed = findSupportingWM())) - usleep(1000); + sleep(1); --count; } if (_managed) @@ -489,11 +489,10 @@ void screen::cycleWindow(const bool forward, const bool allscreens, classname = (*_active)->appClass(); WindowList::const_iterator target = _active, - first = _active, begin = _clients.begin(), end = _clients.end(); - do { + while (1) { if (forward) { if (target == end) { target = begin; @@ -509,18 +508,22 @@ void screen::cycleWindow(const bool forward, const bool allscreens, } // must be no window to focus - if (target == first) + if (target == _active) return; - } while ((*target)->iconic() || - (! allscreens && (*target)->getScreen() != this) || - (! alldesktops && - (*target)->desktop() != _active_desktop && - (*target)->desktop() != 0xffffffff) || - (sameclass && ! classname.empty() && - (*target)->appClass() != classname)); - - if (target != _clients.end()) - (*target)->focus(); + + // determine if this window is invalid for cycling to + const XWindow *t = *target; + if (t->iconic()) continue; + if (! allscreens && t->getScreen() != this) continue; + if (! alldesktops && ! (t->desktop() == _active_desktop || + t->desktop() == 0xffffffff)) continue; + if (sameclass && ! classname.empty() && + t->appClass() != classname) continue; + if (! t->canFocus()) continue; + + // found a good window! + t->focus(); + } }