+void screen::handleKeypress(const XEvent &e) {
+ 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()) {
+ switch (it->type()) {
+ case Action::nextWorkspace:
+ cycleWorkspace(true);
+ return;
+
+ case Action::prevWorkspace:
+ cycleWorkspace(false);
+ return;
+
+ case Action::nextWindow:
+ cycleWindow(true);
+ return;
+
+ case Action::prevWindow:
+ cycleWindow(false);
+ return;
+
+ case Action::nextWindowOnAllWorkspaces:
+ cycleWindow(true, true);
+ return;
+
+ case Action::prevWindowOnAllWorkspaces:
+ cycleWindow(false, true);
+ return;
+
+ case Action::nextWindowOfClass:
+ cycleWindow(true, false, true);
+ return;
+
+ case Action::prevWindowOfClass:
+ cycleWindow(false, false, true);
+ return;
+
+ case Action::nextWindowOfClassOnAllWorkspaces:
+ cycleWindow(true, true, true);
+ return;
+
+ case Action::prevWindowOfClassOnAllWorkspaces:
+ cycleWindow(false, true, true);
+ return;
+
+ case Action::changeWorkspace:
+ changeWorkspace(it->number());
+ return;
+
+ case Action::execute:
+ execCommand(it->string());
+ return;
+
+ default:
+ break;
+ }
+
+ // these actions require an active window
+ if (_active != _clients.end()) {
+ XWindow *window = *_active;
+
+ switch (it->type()) {
+ 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::sendToWorkspace:
+ window->sendTo(it->number());
+ return;
+
+ case Action::toggleomnipresent:
+ if (window->desktop() == 0xffffffff)
+ window->sendTo(_active_desktop);
+ else
+ window->sendTo(0xffffffff);
+ return;
+
+ case Action::toggleshade:
+ window->shade(! window->shaded());
+ return;
+
+ default:
+ assert(false); // unhandled action type!
+ break;
+ }
+ }
+ }
+ }
+}