X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fscreen.cc;h=e91685a89a68e2899da294ddcdf12ba00fd68c7d;hb=cd6c4ebcb27b796b214296aefd78a41235dd8640;hp=2c1da1ae53054e2c26c4b68ad7aa03ff47dfd8dc;hpb=ae86775d0495dc906d1bdf1b9ed4fbfbbd378615;p=chaz%2Fopenbox diff --git a/util/epist/screen.cc b/util/epist/screen.cc index 2c1da1ae..e91685a8 100644 --- a/util/epist/screen.cc +++ b/util/epist/screen.cc @@ -60,15 +60,12 @@ screen::screen(epist *epist, int number) _info = _epist->getScreenInfo(_number); _root = _info->getRootWindow(); - cout << "root window on screen " << _number << ": 0x" << hex << _root << - dec << endl; - // find a window manager supporting NETWM, waiting for it to load if we must int count = 20; // try for 20 seconds _managed = false; while (! (_epist->doShutdown() || _managed || count <= 0)) { if (! (_managed = findSupportingWM())) - usleep(1000); + sleep(1); --count; } if (_managed) @@ -492,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; @@ -512,18 +508,23 @@ 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(); + return; + } }