X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fopenbox.cc;h=6c7bfdb8b5ce4c57757cb8e021b7733bce5697e5;hb=68194ce957db36ead19a39fdc7636a220befafe9;hp=bb0743c08ab1f19cdd2e40aa6c64e32b693ceb66;hpb=b12b1cb7848d590be57281fa6ee68b9f05a57c30;p=chaz%2Fopenbox diff --git a/src/openbox.cc b/src/openbox.cc index bb0743c0..6c7bfdb8 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -9,7 +9,6 @@ #include "client.hh" #include "screen.hh" #include "actions.hh" -#include "python_client.hh" #include "otk/property.hh" #include "otk/display.hh" #include "otk/assassin.hh" @@ -91,8 +90,8 @@ Openbox::Openbox(int argc, char **argv) _doshutdown = false; _rcfilepath = otk::expandTilde("~/.openbox/rc3"); - _pyclients = (PyDictObject*) PyDict_New(); - assert(_pyclients); + _clients = (PyDictObject*) PyDict_New(); + assert(_clients); parseCommandLine(argc, argv); @@ -276,35 +275,25 @@ void Openbox::eventLoop() void Openbox::addClient(Window window, OBClient *client) { - _clients[window] = client; - // maintain the python list here too - PyClientObject* pyclient = PyObject_New(PyClientObject, &PyClient_Type); - pyclient->window = window; - pyclient->client = client; - PyDict_SetItem((PyObject*)_pyclients, PyLong_FromLong(window), - (PyObject*)pyclient); + PyDict_SetItem((PyObject*)_clients, PyLong_FromLong(window), + (PyObject*)client); } void Openbox::removeClient(Window window) { - _clients.erase(window); + PyDict_DelItem((PyObject*)_clients, PyLong_FromLong(window)); } OBClient *Openbox::findClient(Window window) { - /* - 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; + PyClientObject *client = PyDist_GetItem((PyObject*)_clients, + PyLong_FromLong(window)); + if (client) + return client->client; + return 0; } }