X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fopenbox.cc;h=4d2f102479c266d781d580d2d24f9fb657e440cd;hb=660ad41ca0b1c48525bba071a27def141ad1cbfe;hp=01316d795c276762d6c6c23b1e698eb2196db16a;hpb=745e840547b5443ecfb9b6f0a4f14b0d035d59c2;p=chaz%2Fopenbox diff --git a/src/openbox.cc b/src/openbox.cc index 01316d79..4d2f1024 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -128,9 +128,15 @@ Openbox::Openbox(int argc, char **argv) _cursors.ul_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ul_angle); _cursors.ur_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ur_angle); - // start up python and load config values + // initialize scripting python_init(argv[0]); + + // load config values python_exec(SCRIPTDIR"/config.py"); // load openbox config values + // run all of the python scripts + python_exec(SCRIPTDIR"/builtins.py"); // builtin callbacks + // run the user's script + python_exec(_scriptfilepath.c_str()); // initialize all the screens OBScreen *screen; @@ -146,12 +152,6 @@ Openbox::Openbox(int argc, char **argv) ::exit(1); } - // run all of the python scripts, including the user's - python_exec(SCRIPTDIR"/globals.py"); // create/set global vars - python_exec(SCRIPTDIR"/clientmotion.py"); // moving and resizing clients - python_exec(SCRIPTDIR"/clicks.py"); // titlebar/root clicks and dblclicks - python_exec(_scriptfilepath.c_str()); - ScreenList::iterator it, end = _screens.end(); for (it = _screens.begin(); it != end; ++it) { (*it)->manageExisting(); @@ -172,13 +172,14 @@ Openbox::~Openbox() { _state = State_Exiting; // time to kill everything - delete _bindings; - delete _actions; - std::for_each(_screens.begin(), _screens.end(), otk::PointerAssassin()); + delete _bindings; + delete _actions; delete _property; + python_destroy(); + // close the X display otk::OBDisplay::destroy(); } @@ -325,9 +326,25 @@ void Openbox::setFocusedClient(OBClient *c) } } - -bool Openbox::getConfigString(const char *name, std::string *value) { - return python_get_string(name, value); +void Openbox::execute(int screen, const std::string &bin) +{ +#ifdef __EMX__ + // XXX: whats this for? windows? + spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", bin.c_str(), NULL); +#else // __EMX__ + if (screen >= ScreenCount(otk::OBDisplay::display)) + screen = 0; + const std::string &dstr = + otk::OBDisplay::screenInfo(screen)->displayString(); + + if (! fork()) { + setsid(); + int ret = putenv(const_cast(dstr.c_str())); + assert(ret != -1); + ret = execl("/bin/sh", "/bin/sh", "-c", bin.c_str(), NULL); + exit(ret); + } +#endif // __EMX__ } }