]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
add iconifying
[chaz/openbox] / util / epist / screen.cc
index 475a96e20f95581b766e4aec3f44ece9e3580ccf..d8d8edcaa5de748451d4cfeee39417b41bce42b0 100644 (file)
@@ -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,23 @@ void screen::handleKeypress(const XEvent &e) {
         XWindow *window = *_active;
 
         switch (it->type()) {
-        case Action::shade:
+        case Action::iconify:
+          window->iconify();
+          return;
+
+        case Action::close:
+          window->close();
+          return;
+
+        case Action::raise:
+          window->raise();
+          return;
+
+        case Action::lower:
+          window->lower();
+          return;
+
+        case Action::toggleshade:
           window->shade(! window->shaded());
           return;
         }
@@ -274,6 +298,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 +352,7 @@ void screen::cycleWorkspace(const bool forward) const {
   }
 }
 
+
 void screen::changeWorkspace(const int num) const {
   _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
 }
This page took 0.021337 seconds and 4 git commands to generate.