make the returned action list a const reference
authorDana Jansens <danakj@orodu.net>
Sat, 20 Jul 2002 08:36:06 +0000 (08:36 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 20 Jul 2002 08:36:06 +0000 (08:36 +0000)
util/epist/epist.hh
util/epist/screen.cc

index a3c4fdc..ceaebdf 100644 (file)
@@ -67,7 +67,7 @@ public:
   void removeWindow(XWindow *window);
   XWindow *findWindow(Window window) const;
 
-  const ActionList actions(void) { return _actions; }
+  const ActionList &actions(void) { return _actions; }
 };
 
 #endif // __epist_hh
index 0d7f90d..475a96e 100644 (file)
@@ -151,22 +151,27 @@ void screen::handleKeypress(const XEvent &e) {
       switch (it->type()) {
       case Action::nextWorkspace:
         cycleWorkspace(true);
-        break;
+        return;
 
       case Action::prevWorkspace:
         cycleWorkspace(false);
-        break;
+        return;
 
       case Action::changeWorkspace:
         changeWorkspace(it->number());
-        break;
-
-      case Action::shade:
-        (*_active)->shade(! (*_active)->shaded());
-        break;
+        return;
       }
 
-      break;
+      // these actions require an active window
+      if (_active != _clients.end()) {
+        XWindow *window = *_active;
+
+        switch (it->type()) {
+        case Action::shade:
+          window->shade(! window->shaded());
+          return;
+        }
+      }
     }
   }
 }