+void Openbox::addClient(Window window, Client *client)
+{
+ _clients[window] = client;
+}
+
+
+void Openbox::removeClient(Window window)
+{
+ _clients.erase(window);
+}
+
+
+Client *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 (Client*) 0;
+}
+
+
+void Openbox::setFocusedClient(Client *c)
+{
+ _focused_client = c;
+ if (c) {
+ _focused_screen = _screens[c->screen()];
+ } else {
+ assert(_focused_screen);
+ XSetInputFocus(**otk::display, _focused_screen->focuswindow(),
+ RevertToNone, CurrentTime);
+ }
+ // set the NET_ACTIVE_WINDOW hint for all screens
+ ScreenList::iterator it, end = _screens.end();
+ for (it = _screens.begin(); it != end; ++it) {
+ int num = (*it)->number();
+ Window root = otk::display->screenInfo(num)->rootWindow();
+ otk::Property::set(root, otk::Property::atoms.net_active_window,
+ otk::Property::atoms.window,
+ (c && _focused_screen == *it) ? c->window() : None);
+ }
+
+ // call the python Focus callbacks
+ EventData data(_focused_screen->number(), c, EventAction::Focus, 0);
+ _bindings->fireEvent(&data);
+}
+