]> Dogcows Code - chaz/openbox/blobdiff - util/epist/epist.cc
dont pass bound keys through to the application
[chaz/openbox] / util / epist / epist.cc
index 474d8fe8cdbcd9030e5f45d2d13fd137a1da1f76..4397cc7be1df678e0650be2f49accb3ebcce9e08 100644 (file)
@@ -1,5 +1,5 @@
 // -*- mode: C++; indent-tabs-mode: nil; -*-
-// epist.cc for Epistory - a key handler for NETWM/EWMH window managers.
+// epist.cc for Epistophy - a key handler for NETWM/EWMH window managers.
 // Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
 //
 // Permission is hereby granted, free of charge, to any person obtaining a
@@ -38,9 +38,9 @@ extern "C" {
 #  include <signal.h>
 #endif // HAVE_SIGNAL_H
 
-/*#ifdef    HAVE_LIBGEN_H
+#ifdef    HAVE_LIBGEN_H
 #  include <libgen.h>
-#endif // HAVE_LIBGEN_H*/
+#endif // HAVE_LIBGEN_H
 }
 
 #include <iostream>
@@ -51,7 +51,6 @@ using std::endl;
 using std::string;
 
 #include "epist.hh"
-#include "process.hh"
 #include "screen.hh"
 #include "window.hh"
 #include "../../src/XAtom.hh"
@@ -76,6 +75,20 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
     cout << "No compatible window manager found on any screens. Aborting.\n";
     ::exit(1);
   }
+
+  _actions.push_back(Action(Action::nextWorkspace,
+                            XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("Tab")),
+                            Mod1Mask));
+  _actions.push_back(Action(Action::prevWorkspace,
+                           XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("Tab")),
+                           ControlMask));
+  _actions.push_back(Action(Action::shade,
+                            XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("F5")),
+                            Mod1Mask));
+  activateGrabs();
 }
 
 
@@ -83,6 +96,20 @@ epist::~epist() {
   delete _xatom;
 }
 
+void epist::activateGrabs() {
+
+  ScreenList::const_iterator scrit, scrend = _screens.end();
+  
+  for (scrit = _screens.begin(); scrit != scrend; ++scrit) {
+    ActionList::const_iterator ait, end = _actions.end();
+
+    for(ait = _actions.begin(); ait != end; ++ait) {
+      XGrabKey(getXDisplay(), ait->keycode(), ait->modifierMask(),
+               (*scrit)->rootWindow(), False, GrabModeAsync, GrabModeAsync);
+    }
+  }
+}
+
 
 bool epist::handleSignal(int sig) {
   switch (sig) {
@@ -111,6 +138,7 @@ void epist::process_event(XEvent *e) {
   else
     root = e->xany.window;
   
+  cout << "event\n";
   ScreenList::const_iterator it, end = _screens.end();
   for (it = _screens.begin(); it != end; ++it) {
     if ((*it)->rootWindow() == root) {
This page took 0.021566 seconds and 4 git commands to generate.