X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fepist.cc;h=74a11d1a4d92bef98a46ab251d4274965bf74a70;hb=6ca5c5891a58c616b32b733c99fe373aa58bc360;hp=a0b1666a2dfd70cb13a2c402eda6727095bae652;hpb=3a6e590d5018a70edbff3e17128788b47376891e;p=chaz%2Fopenbox diff --git a/util/epist/epist.cc b/util/epist/epist.cc index a0b1666a..74a11d1a 100644 --- a/util/epist/epist.cc +++ b/util/epist/epist.cc @@ -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 // @@ -41,6 +41,16 @@ extern "C" { #ifdef HAVE_LIBGEN_H # include #endif // HAVE_LIBGEN_H + +#ifdef HAVE_UNISTD_H +# include +# include +#endif // HAVE_UNISTD_H + +#ifdef HAVE_SYS_STAT_H +# include +# include +#endif // HAVE_SYS_STAT_H } #include @@ -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(); }