summaryrefslogtreecommitdiff
path: root/util/epist/screen.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-07-24 17:49:57 +0000
committerDana Jansens <danakj@orodu.net>2002-07-24 17:49:57 +0000
commitfa34ea5250511e37180ea2ddd85919516f25248d (patch)
tree3a12d927687ac0454b0e851e746a67815f8267bb /util/epist/screen.cc
parent49c04eaf57fc20efe95c431b78b2c08d6403dee2 (diff)
don't try pass focus off to windows that dont take it
Diffstat (limited to 'util/epist/screen.cc')
-rw-r--r--util/epist/screen.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/util/epist/screen.cc b/util/epist/screen.cc
index 281a093e..80a579cc 100644
--- a/util/epist/screen.cc
+++ b/util/epist/screen.cc
@@ -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();
+ }
}