diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-11 11:16:36 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-11 11:16:36 +0000 |
| commit | e8f5cf2940667a60698d28fe0cae208792357676 (patch) | |
| tree | 2dc2879b9c6e1e6c303ac0595d3eb6cfcbc113b5 /src | |
| parent | bc88d310fea71823fb2c61d071ff499579bffaba (diff) | |
valgrind fixes, and fixes for writing shit all over the environment. yay~!!!!!!!
Diffstat (limited to 'src')
| -rw-r--r-- | src/actions.cc | 20 | ||||
| -rw-r--r-- | src/bindings.cc | 4 | ||||
| -rw-r--r-- | src/client.cc | 2 | ||||
| -rw-r--r-- | src/openbox.cc | 20 | ||||
| -rw-r--r-- | src/python.cc | 27 |
5 files changed, 27 insertions, 46 deletions
diff --git a/src/actions.cc b/src/actions.cc index 15a3e6c2..96290bdd 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -37,8 +37,10 @@ OBActions::~OBActions() void OBActions::insertPress(const XButtonEvent &e) { ButtonPressAction *a = _posqueue[BUTTONS - 1]; - for (int i=BUTTONS-1; i>0;) - _posqueue[i] = _posqueue[--i]; + // rm'd the last one, shift them all down one + for (int i = BUTTONS-1; i > 0; --i) { + _posqueue[i] = _posqueue[i-1]; + } _posqueue[0] = a; a->button = e.button; a->pos.setPoint(e.x_root, e.y_root); @@ -49,17 +51,19 @@ void OBActions::insertPress(const XButtonEvent &e) void OBActions::removePress(const XButtonEvent &e) { + int i; ButtonPressAction *a = 0; - for (int i=0; i<BUTTONS; ++i) { - if (_posqueue[i]->button == e.button) + for (i=0; i<BUTTONS-1; ++i) + if (_posqueue[i]->button == e.button) { a = _posqueue[i]; - if (a) // found one and removed it + break; + } + if (a) { // found one, remove it and shift the rest up one + for (; i < BUTTONS-1; ++i) _posqueue[i] = _posqueue[i+1]; - } - if (a) { // found one _posqueue[BUTTONS-1] = a; - a->button = 0; } + _posqueue[BUTTONS-1]->button = 0; } void OBActions::buttonPressHandler(const XButtonEvent &e) diff --git a/src/bindings.cc b/src/bindings.cc index 7c13ca64..90bac388 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -158,7 +158,7 @@ OBBindings::~OBBindings() { grabKeys(false); removeAllKeys(); - removeAllButtons(); +// removeAllButtons(); XXX removeAllEvents(); } @@ -456,7 +456,7 @@ bool OBBindings::addButton(const std::string &but, MouseContext context, void OBBindings::removeAllButtons() { - for (int i = i; i < NUM_MOUSE_CONTEXT; ++i) { + for (int i = 0; i < NUM_MOUSE_CONTEXT; ++i) { ButtonBindingList::iterator it, end = _buttons[i].end(); for (it = _buttons[i].begin(); it != end; ++it) { for (int a = 0; a < NUM_MOUSE_ACTION; ++a) { diff --git a/src/client.cc b/src/client.cc index a427a21e..c69d576a 100644 --- a/src/client.cc +++ b/src/client.cc @@ -43,6 +43,8 @@ OBClient::OBClient(int screen, Window window) _focused = false; // not a transient by default of course _transient_for = 0; + // pick a layer to start from + _layer = Layer_Normal; getArea(); getDesktop(); diff --git a/src/openbox.cc b/src/openbox.cc index 42cc1fef..600c9d8d 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -13,7 +13,7 @@ #include "otk/property.hh" #include "otk/display.hh" #include "otk/assassin.hh" -#include "otk/util.hh" // TEMPORARY +#include "otk/util.hh" extern "C" { #include <X11/cursorfont.h> @@ -202,7 +202,7 @@ Openbox::~Openbox() if (!_restart_prog.empty()) { const std::string &dstr = otk::OBDisplay::screenInfo(first_screen)->displayString(); - putenv(const_cast<char *>(dstr.c_str())); + otk::putenv(const_cast<char *>(dstr.c_str())); execlp(_restart_prog.c_str(), _restart_prog.c_str(), NULL); perror(_restart_prog.c_str()); } @@ -381,23 +381,9 @@ void Openbox::setFocusedClient(OBClient *c) 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<char *>(dstr.c_str())); - assert(ret != -1); - ret = execl("/bin/sh", "/bin/sh", "-c", bin.c_str(), NULL); - exit(ret); - } -#endif // __EMX__ + otk::bexec(bin, otk::OBDisplay::screenInfo(screen)->displayString()); } } diff --git a/src/python.cc b/src/python.cc index 2c71b018..891d1120 100644 --- a/src/python.cc +++ b/src/python.cc @@ -19,28 +19,17 @@ static PyObject *obdict = NULL; void python_init(char *argv0) { - std::string path; - // start the python engine - //Py_SetProgramName(argv0); - //Py_Initialize(); + Py_SetProgramName(argv0); + Py_Initialize(); // initialize the C python module - //init_openbox(); + init_openbox(); // include the openbox directories for python scripts in the sys path -// PyRun_SimpleString("import sys"); -printf("SCRIPTDIR=%s\n", SCRIPTDIR); -printf("1 getenv(DISPLAY)=%s\n", getenv("DISPLAY")); - path = "sys.path"; -printf("2 getenv(DISPLAY)=%s\n", getenv("DISPLAY")); - path = "sys.path.append('"; -printf("3 getenv(DISPLAY)=%s\n", getenv("DISPLAY")); - path += SCRIPTDIR; - path += "')"; - PyRun_SimpleString(const_cast<char*>(path.c_str())); - path = "sys.path.append('"; - path += otk::expandTilde("~/.openbox/python"); - path += "')"; - PyRun_SimpleString(const_cast<char*>(path.c_str())); + PyRun_SimpleString("import sys"); + PyRun_SimpleString("sys.path.append('" SCRIPTDIR "')"); + PyRun_SimpleString(const_cast<char*>(("sys.path.append('" + + otk::expandTilde("~/.openbox/python") + + "')").c_str())); // import the otk and openbox modules into the main namespace PyRun_SimpleString("from openbox import *;"); // set up convenience global variables |
