]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
line up the vars
[chaz/openbox] / util / epist / screen.cc
index afe5b8d1e6b53e00f952dbceb45f7ca149ad1919..475a96e20f95581b766e4aec3f44ece9e3580ccf 100644 (file)
@@ -143,28 +143,36 @@ void screen::processEvent(const XEvent &e) {
 }
 
 void screen::handleKeypress(const XEvent &e) {
-  list<Action>::const_iterator it = _epist->actions().begin();
-  list<Action>::const_iterator end = _epist->actions().end();
+  ActionList::const_iterator it = _epist->actions().begin();
+  ActionList::const_iterator end = _epist->actions().end();
   for (; it != end; ++it) {
     if (e.xkey.keycode == it->keycode() &&
-        e.xkey.state == it->modifierMask() )
-      {
+        e.xkey.state == it->modifierMask()) {
+      switch (it->type()) {
+      case Action::nextWorkspace:
+        cycleWorkspace(true);
+        return;
+
+      case Action::prevWorkspace:
+        cycleWorkspace(false);
+        return;
+
+      case Action::changeWorkspace:
+        changeWorkspace(it->number());
+        return;
+      }
+
+      // these actions require an active window
+      if (_active != _clients.end()) {
+        XWindow *window = *_active;
+
         switch (it->type()) {
-        case Action::nextWorkspace:
-          cycleWorkspace(true);
-          break;
-        case Action::prevWorkspace:
-          cycleWorkspace(false);
-          break;
-        case Action::changeWorkspace:
-          changeWorkspace(it->number());
-          break;
         case Action::shade:
-          toggleShaded((*_active)->window());
-          break;
+          window->shade(! window->shaded());
+          return;
         }
-        break;
       }
+    }
   }
 }
 
@@ -216,7 +224,8 @@ void screen::updateClientList() {
     if (it == end) {  // didn't already exist
       if (doAddWindow(rootclients[i])) {
         cout << "Added window: 0x" << hex << rootclients[i] << dec << endl;
-        _clients.insert(insert_point, new XWindow(_epist, rootclients[i]));
+        _clients.insert(insert_point, new XWindow(_epist, this,
+                                                  rootclients[i]));
       }
     }
   }
@@ -291,8 +300,3 @@ void screen::cycleWorkspace(const bool forward) const {
 void screen::changeWorkspace(const int num) const {
   _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
 }
-
-void screen::toggleShaded(const Window win) const {
-  _xatom->sendClientMessage(_root, XAtom::net_wm_state, win, 2,
-                            XAtom::net_wm_state_shaded);
-}
This page took 0.022626 seconds and 4 git commands to generate.