]> Dogcows Code - chaz/openbox/blobdiff - util/epist/epist.cc
handle events on the right screen
[chaz/openbox] / util / epist / epist.cc
index 7f8746342101387909dd4b98ad8a55705b795464..bfa7989ce89462588ef83cfa02fc6412480c1cd2 100644 (file)
@@ -58,7 +58,7 @@ using std::string;
 
 epist::epist(char **argv, char *dpy_name, char *rc_file)
   : BaseDisplay(argv[0], dpy_name) {
-
+    
   _argv = argv;
 
   if (rc_file)
@@ -202,6 +202,11 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
                            XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("4")),
                            Mod1Mask | ControlMask | ShiftMask, 3));
+  _actions.push_back(Action(Action::execute,
+                           XKeysymToKeycode(getXDisplay(),
+                                             XStringToKeysym("Escape")),
+                           Mod1Mask | ControlMask,
+                           "sleep 1 && xset dpms force off"));
   _actions.push_back(Action(Action::execute,
                            XKeysymToKeycode(getXDisplay(),
                                              XStringToKeysym("space")),
@@ -222,8 +227,7 @@ void epist::activateGrabs() {
     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);
+      (*scrit)->grabKey(ait->keycode(), ait->modifierMask());
     }
   }
 }
@@ -249,16 +253,9 @@ bool epist::handleSignal(int sig) {
 
 
 void epist::process_event(XEvent *e) {
-  Window root;
-
-  if (e->xany.type == KeyPress)
-    root = e->xkey.root;
-  else
-    root = e->xany.window;
-  
   ScreenList::const_iterator it, end = _screens.end();
   for (it = _screens.begin(); it != end; ++it) {
-    if ((*it)->rootWindow() == root) {
+    if ((*it)->rootWindow() == e->xany.window) {
       (*it)->processEvent(*e);
       return;
     }
This page took 0.024469 seconds and 4 git commands to generate.