]> Dogcows Code - chaz/openbox/blobdiff - util/epist/epist.cc
make epist compile with the new code base
[chaz/openbox] / util / epist / epist.cc
index f83059435edc458c8cd7edaf4c675cf7c3e71064..74a11d1a4d92bef98a46ab251d4274965bf74a70 100644 (file)
@@ -1,4 +1,4 @@
-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 // epist.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
 // Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
 //
@@ -41,6 +41,16 @@ extern "C" {
 #ifdef    HAVE_LIBGEN_H
 #  include <libgen.h>
 #endif // HAVE_LIBGEN_H
+
+#ifdef    HAVE_UNISTD_H
+#  include <sys/types.h>
+#  include <unistd.h>
+#endif // HAVE_UNISTD_H
+
+#ifdef    HAVE_SYS_STAT_H
+#  include <sys/types.h>
+#  include <sys/stat.h>
+#endif // HAVE_SYS_STAT_H
 }
 
 #include <iostream>
@@ -55,7 +65,7 @@ using std::string;
 #include "screen.hh"
 #include "window.hh"
 #include "parser.hh"
-#include "../../src/XAtom.hh"
+#include "../../src/xatom.hh"
 
 
 epist::epist(char **argv, char *dpy_name, char *rc_file)
@@ -66,11 +76,22 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
   if (rc_file)
     _rc_file = rc_file;
   else
-    _rc_file = expandTilde("~/.epistrc");
+    _rc_file = expandTilde("~/.openbox/epistrc");
 
-  _xatom = new XAtom(getXDisplay());
+  struct stat buf;
+  if (0 != stat(_rc_file.c_str(), &buf) ||
+      !S_ISREG(buf.st_mode))
+    _rc_file = DEFAULTRC;
 
+  _xatom = new XAtom(getXDisplay());
   _active = _clients.end();
+
+  _config = new Config;
+  _ktree = new keytree(getXDisplay(), this);
+
+  // set up the key tree
+  parser p(_ktree, _config);
+  p.parse(_rc_file);
   
   for (unsigned int i = 0; i < getNumberOfScreens(); ++i) {
     screen *s = new screen(this, i);
@@ -84,12 +105,6 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
     ::exit(1);
   }
 
-  _ktree = new keytree(getXDisplay());
-
-  // set up the key tree
-  parser p(_ktree);
-  p.parse(_rc_file);
-
   activateGrabs();
 }
 
@@ -109,12 +124,16 @@ void epist::activateGrabs() {
 
 bool epist::handleSignal(int sig) {
   switch (sig) {
-  case SIGHUP:
+  case SIGHUP: {
     cout << "epist: Restarting on request.\n";
+    
     execvp(_argv[0], _argv);
+
     string base(basename(_argv[0]));
     execvp(base.c_str(), _argv);
+    
     return false;  // this should be unreachable
+  }
 
   case SIGTERM:
   case SIGINT:
This page took 0.022248 seconds and 4 git commands to generate.