summaryrefslogtreecommitdiff
path: root/src/openbox.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-20 15:38:49 +0000
committerDana Jansens <danakj@orodu.net>2002-12-20 15:38:49 +0000
commit68194ce957db36ead19a39fdc7636a220befafe9 (patch)
treec405d332e6189babdb2ffc055a075cb718176f17 /src/openbox.cc
parent06de24ec6666578759eff2b348e50f5e8e20f3bd (diff)
update to cleaned up otk api
Diffstat (limited to 'src/openbox.cc')
-rw-r--r--src/openbox.cc31
1 files changed, 10 insertions, 21 deletions
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;
}
}