summaryrefslogtreecommitdiff
path: root/util/epist/screen.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-07-20 09:02:45 +0000
committerDana Jansens <danakj@orodu.net>2002-07-20 09:02:45 +0000
commitc9be3ee06121bc4d0dec3586918607f18dabdb89 (patch)
tree11f376f2f3c12106b34fca52715df04d2a6274f4 /util/epist/screen.cc
parent8e601e4a64b37f333fc3a5f844e4d72d6f289415 (diff)
added window cycling
Diffstat (limited to 'util/epist/screen.cc')
-rw-r--r--util/epist/screen.cc42
1 files changed, 41 insertions, 1 deletions
diff --git a/util/epist/screen.cc b/util/epist/screen.cc
index 475a96e2..0d97b614 100644
--- a/util/epist/screen.cc
+++ b/util/epist/screen.cc
@@ -157,6 +157,14 @@ void screen::handleKeypress(const XEvent &e) {
cycleWorkspace(false);
return;
+ case Action::nextWindow:
+ cycleWindow(true);
+ return;
+
+ case Action::prevWindow:
+ cycleWindow(false);
+ return;
+
case Action::changeWorkspace:
changeWorkspace(it->number());
return;
@@ -167,7 +175,7 @@ void screen::handleKeypress(const XEvent &e) {
XWindow *window = *_active;
switch (it->type()) {
- case Action::shade:
+ case Action::toggleshade:
window->shade(! window->shaded());
return;
}
@@ -274,6 +282,37 @@ void screen::updateActiveWindow() {
}
*/
+
+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());
+ }
+}
+
+
void screen::cycleWorkspace(const bool forward) const {
unsigned long currentDesktop = 0;
unsigned long numDesktops = 0;
@@ -297,6 +336,7 @@ void screen::cycleWorkspace(const bool forward) const {
}
}
+
void screen::changeWorkspace(const int num) const {
_xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
}