diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-12-22 08:49:59 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-12-22 08:49:59 +0000 |
| commit | 3cf5a8b6dd5b09a8550c9ecfc19f8e0e884778cc (patch) | |
| tree | 4a053082cbb6f8ad826c49a378017dbfb2c976d2 /src/openbox.cc | |
| parent | 065c6efa774ac144665f340f6c3578ab74e05c7b (diff) | |
remove python from our c++ objects. going to try out swig
Diffstat (limited to 'src/openbox.cc')
| -rw-r--r-- | src/openbox.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/openbox.cc b/src/openbox.cc index 6c7bfdb8..01e23281 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -9,6 +9,7 @@ #include "client.hh" #include "screen.hh" #include "actions.hh" +#include "python.hh" #include "otk/property.hh" #include "otk/display.hh" #include "otk/assassin.hh" @@ -42,6 +43,8 @@ extern "C" { # include <sys/select.h> #endif // HAVE_SYS_SELECT_H +#include <python2.2/Python.h> + #include "gettext.h" #define _(str) gettext(str) } @@ -90,9 +93,6 @@ Openbox::Openbox(int argc, char **argv) _doshutdown = false; _rcfilepath = otk::expandTilde("~/.openbox/rc3"); - _clients = (PyDictObject*) PyDict_New(); - assert(_clients); - parseCommandLine(argc, argv); // TEMPORARY: using the xrdb rc3 @@ -275,25 +275,28 @@ void Openbox::eventLoop() void Openbox::addClient(Window window, OBClient *client) { - // maintain the python list here too - PyDict_SetItem((PyObject*)_clients, PyLong_FromLong(window), - (PyObject*)client); + _clients[window] = client; } void Openbox::removeClient(Window window) { - PyDict_DelItem((PyObject*)_clients, PyLong_FromLong(window)); + _clients.erase(window); } OBClient *Openbox::findClient(Window window) { - PyClientObject *client = PyDist_GetItem((PyObject*)_clients, - PyLong_FromLong(window)); - if (client) - return client->client; - return 0; + /* + NOTE: we dont use _clients[] to find the value because that will insert + a new null into the hash, which really sucks when we want to clean up the + hash at shutdown! + */ + ClientMap::iterator it = _clients.find(window); + if (it != _clients.end()) + return it->second; + else + return (OBClient*) 0; } } |
