all repos — openbox @ 9e77a88d269bfafb78e56a646bfacebdd6ff4c5a

openbox fork - make it a bit more like ryudo

move the Openbox::instance pointer to simply "openbox".
Dana Jansens danakj@orodu.net
commit

9e77a88d269bfafb78e56a646bfacebdd6ff4c5a

parent

4dba699857918d0feda52c71c58eccd08839ec8b

M src/actions.ccsrc/actions.cc

@@ -45,7 +45,7 @@ _posqueue[0] = a;

a->button = e.button; a->pos.setPoint(e.x_root, e.y_root); - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) a->clientarea = c->area(); }

@@ -73,21 +73,21 @@ insertPress(e);

// run the PRESS python hook WidgetBase *w = dynamic_cast<WidgetBase*> - (Openbox::instance->findHandler(e.window)); + (openbox->findHandler(e.window)); assert(w); // everything should be a widget // kill off the Button1Mask etc, only want the modifiers unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); int screen; - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) screen = c->screen(); else screen = otk::Display::findScreen(e.root)->screen(); MouseData data(screen, c, e.time, state, e.button, w->mcontext(), MousePress); - Openbox::instance->bindings()->fireButton(&data); + openbox->bindings()->fireButton(&data); if (_button) return; // won't count toward CLICK events

@@ -112,7 +112,7 @@ otk::EventHandler::buttonReleaseHandler(e);

removePress(e); WidgetBase *w = dynamic_cast<WidgetBase*> - (Openbox::instance->findHandler(e.window)); + (openbox->findHandler(e.window)); assert(w); // everything should be a widget // not for the button we're watching?

@@ -134,14 +134,14 @@ // kill off the Button1Mask etc, only want the modifiers

unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); int screen; - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) screen = c->screen(); else screen = otk::Display::findScreen(e.root)->screen(); MouseData data(screen, c, e.time, state, e.button, w->mcontext(), MouseClick); - Openbox::instance->bindings()->fireButton(&data); + openbox->bindings()->fireButton(&data); // XXX: dont load this every time!!@*

@@ -154,7 +154,7 @@ _release.win == e.window && _release.button == e.button) {

// run the DOUBLECLICK python hook data.action = MouseDoubleClick; - Openbox::instance->bindings()->fireButton(&data); + openbox->bindings()->fireButton(&data); // reset so you cant triple click for 2 doubleclicks _release.win = 0;

@@ -175,13 +175,13 @@ otk::EventHandler::enterHandler(e);

// run the ENTER python hook int screen; - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) screen = c->screen(); else screen = otk::Display::findScreen(e.root)->screen(); EventData data(screen, c, EventEnterWindow, e.state); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); }

@@ -191,13 +191,13 @@ otk::EventHandler::leaveHandler(e);

// run the LEAVE python hook int screen; - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) screen = c->screen(); else screen = otk::Display::findScreen(e.root)->screen(); EventData data(screen, c, EventLeaveWindow, e.state); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); }

@@ -208,7 +208,7 @@

// kill off the Button1Mask etc, only want the modifiers unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); - Openbox::instance->bindings()-> + openbox->bindings()-> fireKey(otk::Display::findScreen(e.root)->screen(), state, e.keycode, e.time); }

@@ -235,7 +235,7 @@ }

} WidgetBase *w = dynamic_cast<WidgetBase*> - (Openbox::instance->findHandler(e.window)); + (openbox->findHandler(e.window)); assert(w); // everything should be a widget // run the MOTION python hook

@@ -244,14 +244,14 @@ unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |

Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); unsigned int button = _posqueue[0]->button; int screen; - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) screen = c->screen(); else screen = otk::Display::findScreen(e.root)->screen(); MouseData data(screen, c, e.time, state, button, w->mcontext(), MouseMotion, x_root, y_root, _posqueue[0]->pos, _posqueue[0]->clientarea); - Openbox::instance->bindings()->fireButton(&data); + openbox->bindings()->fireButton(&data); } void Actions::mapRequestHandler(const XMapRequestEvent &e)

@@ -283,13 +283,13 @@

switch (((XkbAnyEvent*)&e)->xkb_type) { case XkbBellNotify: w = ((XkbBellNotifyEvent*)&e)->window; - Client *c = Openbox::instance->findClient(w); + Client *c = openbox->findClient(w); if (c) screen = c->screen(); else - screen = Openbox::instance->focusedScreen()->number(); + screen = openbox->focusedScreen()->number(); EventData data(screen, c, EventBell, 0); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); break; } }
M src/bindings.ccsrc/bindings.cc

@@ -145,7 +145,7 @@

Bindings::Bindings() : _curpos(&_keytree), _resetkey(0,0), - _timer(Openbox::instance->timerManager(), + _timer(openbox->timerManager(), (otk::TimeoutHandler)resetChains, this) { _timer.setTimeout(5000); // chains reset after 5 seconds

@@ -341,7 +341,7 @@

void Bindings::grabKeys(bool grab) { - for (int i = 0; i < Openbox::instance->screenCount(); ++i) { + for (int i = 0; i < openbox->screenCount(); ++i) { Window root = otk::Display::screenInfo(i)->rootWindow(); KeyBindingTree *p = _curpos->first_child;

@@ -387,7 +387,7 @@ _curpos = p;

grabKeys(true); otk::Display::ungrab(); } else { - Client *c = Openbox::instance->focusedClient(); + Client *c = openbox->focusedClient(); KeyData data(screen, c, time, modifiers, key); CallbackList::iterator it, end = p->callbacks.end(); for (it = p->callbacks.begin(); it != end; ++it)

@@ -440,8 +440,8 @@ bind->binding.key = b.key;

bind->binding.modifiers = b.modifiers; _buttons[context].push_back(bind); // grab the button on all clients - for (int sn = 0; sn < Openbox::instance->screenCount(); ++sn) { - Screen *s = Openbox::instance->screen(sn); + for (int sn = 0; sn < openbox->screenCount(); ++sn) { + Screen *s = openbox->screen(sn); Client::List::iterator c_it, c_end = s->clients.end(); for (c_it = s->clients.begin(); c_it != c_end; ++c_it) { grabButton(true, bind->binding, context, *c_it);

@@ -466,8 +466,8 @@ (*it)->callbacks[a].pop_front();

} } // ungrab the button on all clients - for (int sn = 0; sn < Openbox::instance->screenCount(); ++sn) { - Screen *s = Openbox::instance->screen(sn); + for (int sn = 0; sn < openbox->screenCount(); ++sn) { + Screen *s = openbox->screen(sn); Client::List::iterator c_it, c_end = s->clients.end(); for (c_it = s->clients.begin(); c_it != c_end; ++c_it) { grabButton(false, (*it)->binding, (MouseContext)i, *c_it);
M src/client.ccsrc/client.cc

@@ -72,7 +72,7 @@

Client::~Client() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); // clean up childrens' references while (!_transients.empty()) {

@@ -84,7 +84,7 @@ // clean up parents reference to this

if (_transient_for) _transient_for->_transients.remove(this); // remove from old parent - if (Openbox::instance->state() != Openbox::State_Exiting) { + if (openbox->state() != Openbox::State_Exiting) { // these values should not be persisted across a window unmapping/mapping property->erase(_window, otk::Property::net_wm_desktop); property->erase(_window, otk::Property::net_wm_state);

@@ -94,16 +94,16 @@

void Client::getDesktop() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); // defaults to the current desktop - _desktop = Openbox::instance->screen(_screen)->desktop(); + _desktop = openbox->screen(_screen)->desktop(); if (!property->get(_window, otk::Property::net_wm_desktop, otk::Property::Atom_Cardinal, (long unsigned*)&_desktop)) { // make sure the hint exists - Openbox::instance->property()->set(_window, + openbox->property()->set(_window, otk::Property::net_wm_desktop, otk::Property::Atom_Cardinal, (unsigned)_desktop);

@@ -113,7 +113,7 @@

void Client::getType() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); _type = (WindowType) -1;

@@ -245,7 +245,7 @@

void Client::getMwmHints() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); unsigned long num = MwmHints::elements; unsigned long *hints;

@@ -283,7 +283,7 @@

void Client::getState() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); _modal = _shaded = _max_horz = _max_vert = _fullscreen = _above = _below = _skip_taskbar = _skip_pager = false;

@@ -368,7 +368,7 @@ /*

if we don't have a frame, then we aren't mapped yet (and this would SIGSEGV :) */ - Openbox::instance->screen(_screen)->restack(true, this); // raise + openbox->screen(_screen)->restack(true, this); // raise } } }

@@ -376,7 +376,7 @@

void Client::updateProtocols() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); Atom *proto; int num_return = 0;

@@ -480,7 +480,7 @@

void Client::updateTitle() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); _title = "";

@@ -502,7 +502,7 @@

void Client::updateIconTitle() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); _icon_title = "";

@@ -521,7 +521,7 @@

void Client::updateClass() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); // set the defaults _app_name = _app_class = _role = "";

@@ -548,7 +548,7 @@ void Client::updateStrut()

{ unsigned long num = 4; unsigned long *data; - if (!Openbox::instance->property()->get(_window, + if (!openbox->property()->get(_window, otk::Property::net_wm_strut, otk::Property::Atom_Cardinal, &num, &data))

@@ -560,7 +560,7 @@ _strut.right = data[1];

_strut.top = data[2]; _strut.bottom = data[3]; - Openbox::instance->screen(_screen)->updateStrut(); + openbox->screen(_screen)->updateStrut(); } delete [] data;

@@ -574,7 +574,7 @@ Client *c = 0;

if (XGetTransientForHint(otk::Display::display, _window, &t) && t != _window) { // cant be transient to itself! - c = Openbox::instance->findClient(t); + c = openbox->findClient(t); assert(c != this); // if this happens then we need to check for it if (!c /*XXX: && _group*/) {

@@ -606,7 +606,7 @@ void Client::propertyHandler(const XPropertyEvent &e)

{ otk::EventHandler::propertyHandler(e); - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); // compress changes to a single property into a single change XEvent ce;

@@ -671,13 +671,13 @@ if (!(target >= 0 || target == (signed)0xffffffff)) return;

_desktop = target; - Openbox::instance->property()->set(_window, + openbox->property()->set(_window, otk::Property::net_wm_desktop, otk::Property::Atom_Cardinal, (unsigned)_desktop); // 'move' the window to the new desktop - if (_desktop == Openbox::instance->screen(_screen)->desktop() || + if (_desktop == openbox->screen(_screen)->desktop() || _desktop == (signed)0xffffffff) frame->show(); else

@@ -687,7 +687,7 @@

void Client::setState(StateAction action, long data1, long data2) { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); bool shadestate = _shaded; if (!(action == State_Add || action == State_Remove ||

@@ -865,7 +865,7 @@ otk::EventHandler::clientMessageHandler(e);

if (e.format != 32) return; - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); if (e.message_type == property->atom(otk::Property::wm_change_state)) { // compress changes into a single change

@@ -926,7 +926,7 @@ if (_shaded)

shade(false); // XXX: deiconify focus(); - Openbox::instance->screen(_screen)->restack(true, this); // raise + openbox->screen(_screen)->restack(true, this); // raise } }

@@ -1037,7 +1037,7 @@

void Client::close() { XEvent ce; - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); if (!(_functions & Func_Close)) return;

@@ -1063,7 +1063,7 @@

void Client::changeState() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); unsigned long state[2]; state[0] = _wmstate;

@@ -1128,7 +1128,7 @@ RevertToNone, CurrentTime);

if (_focus_notify) { XEvent ce; - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); ce.xclient.type = ClientMessage; ce.xclient.message_type = property->atom(otk::Property::wm_protocols);

@@ -1136,7 +1136,7 @@ ce.xclient.display = otk::Display::display;

ce.xclient.window = _window; ce.xclient.format = 32; ce.xclient.data.l[0] = property->atom(otk::Property::wm_take_focus); - ce.xclient.data.l[1] = Openbox::instance->lastTime(); + ce.xclient.data.l[1] = openbox->lastTime(); ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l;

@@ -1151,8 +1151,8 @@ void Client::unfocus() const

{ if (!_focused) return; - assert(Openbox::instance->focusedClient() == this); - Openbox::instance->setFocusedClient(0); + assert(openbox->focusedClient() == this); + openbox->setFocusedClient(0); }

@@ -1167,7 +1167,7 @@

frame->focus(); _focused = true; - Openbox::instance->setFocusedClient(this); + openbox->setFocusedClient(this); }

@@ -1182,8 +1182,8 @@

frame->unfocus(); _focused = false; - if (Openbox::instance->focusedClient() == this) - Openbox::instance->setFocusedClient(0); + if (openbox->focusedClient() == this) + openbox->setFocusedClient(0); }

@@ -1239,13 +1239,13 @@ if (e.value_mask & CWStackMode) {

switch (e.detail) { case Below: case BottomIf: - Openbox::instance->screen(_screen)->restack(false, this); // lower + openbox->screen(_screen)->restack(false, this); // lower break; case Above: case TopIf: default: - Openbox::instance->screen(_screen)->restack(true, this); // raise + openbox->screen(_screen)->restack(true, this); // raise break; } }

@@ -1269,7 +1269,7 @@

otk::EventHandler::unmapHandler(e); // this deletes us etc - Openbox::instance->screen(_screen)->unmanageWindow(this); + openbox->screen(_screen)->unmanageWindow(this); }

@@ -1282,7 +1282,7 @@

otk::EventHandler::destroyHandler(e); // this deletes us etc - Openbox::instance->screen(_screen)->unmanageWindow(this); + openbox->screen(_screen)->unmanageWindow(this); }

@@ -1311,7 +1311,7 @@ ev.xreparent = e;

XPutBackEvent(otk::Display::display, &ev); // this deletes us etc - Openbox::instance->screen(_screen)->unmanageWindow(this); + openbox->screen(_screen)->unmanageWindow(this); } }
M src/frame.ccsrc/frame.cc

@@ -24,7 +24,7 @@

const long Frame::event_mask; Frame::Frame(Client *client, otk::Style *style) - : otk::Widget(Openbox::instance, style, Horizontal, 0, 1, true), + : otk::Widget(openbox, style, Horizontal, 0, 1, true), WidgetBase(WidgetBase::Type_Frame), _client(client), _screen(otk::Display::screenInfo(client->screen())),

@@ -45,8 +45,8 @@ assert(style);

XSelectInput(otk::Display::display, _window, Frame::event_mask); - _grip_left.setCursor(Openbox::instance->cursors().ll_angle); - _grip_right.setCursor(Openbox::instance->cursors().lr_angle); + _grip_left.setCursor(openbox->cursors().ll_angle); + _grip_right.setCursor(openbox->cursors().lr_angle); _label.setText(_client->title());

@@ -412,7 +412,7 @@ it. There are 2 unmap events generated that we see, one with the 'event'

member set the root window, and one set to the client, but both get handled and need to be ignored. */ - if (Openbox::instance->state() == Openbox::State_Starting) + if (openbox->state() == Openbox::State_Starting) _client->ignore_unmaps += 2; // select the event mask on the client's parent (to receive config req's)
M src/openbox.ccsrc/openbox.cc

@@ -51,7 +51,7 @@ #include <algorithm>

namespace ob { -Openbox *Openbox::instance = (Openbox *) 0; +Openbox *openbox = (Openbox *) 0; void Openbox::signalHandler(int signal)

@@ -59,7 +59,7 @@ {

switch (signal) { case SIGUSR1: printf("Caught SIGUSR1 signal. Restarting.\n"); - instance->restart(); + openbox->restart(); break; case SIGHUP:

@@ -67,7 +67,7 @@ case SIGINT:

case SIGTERM: case SIGPIPE: printf("Caught signal %d. Exiting.\n", signal); - instance->shutdown(); + openbox->shutdown(); break; case SIGFPE:

@@ -86,7 +86,7 @@ struct sigaction action;

_state = State_Starting; // initializing everything - Openbox::instance = this; + openbox = this; _displayreq = (char*) 0; _argv = argv;

@@ -378,7 +378,7 @@ }

// call the python Focus callbacks EventData data(_focused_screen->number(), c, EventFocus, 0); - Openbox::instance->bindings()->fireEvent(&data); + _bindings->fireEvent(&data); } void Openbox::execute(int screen, const std::string &bin)
M src/openbox.hhsrc/openbox.hh

@@ -38,6 +38,14 @@ Cursor ul_angle; //!< For resizing the top left corner of a window

Cursor ur_angle; //!< For resizing the right corner of a window }; +class Openbox; + +//! The single instance of the Openbox class for the application +/*! + Since this variable is globally available in the application, the Openbox + class does not need to be passed around to any of the other classes. +*/ +extern Openbox *openbox; //! The main class for the Openbox window manager /*!

@@ -52,13 +60,6 @@ */

class Openbox : public otk::EventDispatcher, public otk::EventHandler { public: - //! The single instance of the Openbox class for the application - /*! - Since this variable is globally available in the application, the Openbox - class does not need to be passed around to any of the other classes. - */ - static Openbox *instance; - //! The posible running states of the window manager enum RunState { State_Starting, //!< The window manager is starting up (being created)
M src/openbox.isrc/openbox.i

@@ -20,9 +20,9 @@ %include "stl.i"

//%include std_list.i //%template(ClientList) std::list<Client*>; -%ignore ob::Openbox::instance; +%ignore ob::openbox; %inline %{ - ob::Openbox *Openbox_instance() { return ob::Openbox::instance; } + ob::Openbox *Openbox_instance() { return ob::openbox; } %}; %{

@@ -96,7 +96,7 @@ #include <iterator>

%} %extend ob::Screen { Client *client(int i) { - if (i >= (int)self->clients.size()) + if (i < 0 || i >= (int)self->clients.size()) return NULL; ob::Client::List::iterator it = self->clients.begin(); std::advance(it,i);
M src/openbox_wrap.ccsrc/openbox_wrap.cc

@@ -813,7 +813,7 @@ #include <algorithm>

#include <stdexcept> - ob::Openbox *Openbox_instance() { return ob::Openbox::instance; } + ob::Openbox *Openbox_instance() { return ob::openbox; } namespace ob {

@@ -889,7 +889,7 @@

#include "ustring.hh" ob::Client *ob_Screen_client(ob::Screen *self,int i){ - if (i >= (int)self->clients.size()) + if (i < 0 || i >= (int)self->clients.size()) return NULL; ob::Client::List::iterator it = self->clients.begin(); std::advance(it,i);
M src/python.ccsrc/python.cc

@@ -100,7 +100,7 @@ PyErr_SetString(PyExc_TypeError, "Invalid callback function.");

return NULL; } - if (!ob::Openbox::instance->bindings()->addButton(button, context, + if (!ob::openbox->bindings()->addButton(button, context, action, func)) { PyErr_SetString(PyExc_RuntimeError,"Unable to add binding."); return NULL;

@@ -115,7 +115,7 @@ PyErr_SetString(PyExc_TypeError, "Invalid callback function.");

return NULL; } - if (!ob::Openbox::instance->bindings()->addEvent(action, func)) { + if (!ob::openbox->bindings()->addEvent(action, func)) { PyErr_SetString(PyExc_RuntimeError,"Unable to add binding."); return NULL; }

@@ -145,7 +145,7 @@ vectkeylist.push_back(PyString_AsString(str));

} (void)context; // XXX use this sometime! - if (!ob::Openbox::instance->bindings()->addKey(vectkeylist, func)) { + if (!ob::openbox->bindings()->addKey(vectkeylist, func)) { PyErr_SetString(PyExc_RuntimeError,"Unable to add binding."); return NULL; }

@@ -174,7 +174,7 @@ }

vectkeylist.push_back(PyString_AsString(str)); } - if (!ob::Openbox::instance->bindings()->removeKey(vectkeylist, func)) { + if (!ob::openbox->bindings()->removeKey(vectkeylist, func)) { PyErr_SetString(PyExc_RuntimeError, "Could not remove callback."); return NULL; }

@@ -183,12 +183,12 @@ }

void kunbind_all() { - ob::Openbox::instance->bindings()->removeAllKeys(); + ob::openbox->bindings()->removeAllKeys(); } void set_reset_key(const std::string &key) { - ob::Openbox::instance->bindings()->setResetKey(key); + ob::openbox->bindings()->setResetKey(key); } PyObject *send_client_msg(Window target, int type, Window about,

@@ -205,7 +205,7 @@ XEvent e;

e.xclient.type = ClientMessage; e.xclient.format = 32; e.xclient.message_type = - Openbox::instance->property()->atom((otk::Property::Atoms)type); + openbox->property()->atom((otk::Property::Atoms)type); e.xclient.window = about; e.xclient.data.l[0] = data; e.xclient.data.l[1] = data1;
M src/screen.ccsrc/screen.cc

@@ -65,17 +65,17 @@

printf(_("Managing screen %d: visual 0x%lx, depth %d\n"), _number, XVisualIDFromVisual(_info->visual()), _info->depth()); - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::openbox_pid, otk::Property::Atom_Cardinal, (unsigned long) getpid()); // set the mouse cursor for the root window (the default cursor) XDefineCursor(otk::Display::display, _info->rootWindow(), - Openbox::instance->cursors().session); + openbox->cursors().session); // initialize the shit that is used for all drawing on the screen - _image_control = new otk::ImageControl(Openbox::instance->timerManager(), + _image_control = new otk::ImageControl(openbox->timerManager(), _info, true); _image_control->installRootColormap(); _root_cmap_installed = True;

@@ -101,7 +101,7 @@

// Set the netwm properties for geometry unsigned long geometry[] = { _info->width(), _info->height() }; - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_desktop_geometry, otk::Property::Atom_Cardinal, geometry, 2);

@@ -109,7 +109,7 @@

// Set the net_desktop_names property std::vector<otk::ustring> names; python_get_stringlist("desktop_names", &names); - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_desktop_names, otk::Property::utf8, names);

@@ -137,11 +137,11 @@ changeClientList(); // initialize the client lists, which will be empty

calcArea(); // initialize the available working area // register this class as the event handler for the root window - Openbox::instance->registerHandler(_info->rootWindow(), this); + openbox->registerHandler(_info->rootWindow(), this); // call the python Startup callbacks EventData data(_number, 0, EventShutdown, 0); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); }

@@ -157,7 +157,7 @@ unmanageWindow(clients.front());

// call the python Shutdown callbacks EventData data(_number, 0, EventShutdown, 0); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); XDestroyWindow(otk::Display::display, _focuswindow); XDestroyWindow(otk::Display::display, _supportwindow);

@@ -284,17 +284,17 @@ _info->rootWindow(),

0, 0, 1, 1, 0, 0, 0); // set supporting window - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_supporting_wm_check, otk::Property::Atom_Window, _supportwindow); //set properties on the supporting window - Openbox::instance->property()->set(_supportwindow, + openbox->property()->set(_supportwindow, otk::Property::net_wm_name, otk::Property::utf8, "Openbox"); - Openbox::instance->property()->set(_supportwindow, + openbox->property()->set(_supportwindow, otk::Property::net_supporting_wm_check, otk::Property::Atom_Window, _supportwindow);

@@ -363,9 +363,9 @@

// convert to the atom values for (int i = 0; i < num_supported; ++i) supported[i] = - Openbox::instance->property()->atom((otk::Property::Atoms)supported[i]); + openbox->property()->atom((otk::Property::Atoms)supported[i]); - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_supported, otk::Property::Atom_Atom, supported, num_supported);

@@ -390,7 +390,7 @@ *win_it = (*it)->window();

} else windows = (Window*) 0; - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_client_list, otk::Property::Atom_Window, windows, size);

@@ -423,7 +423,7 @@ *win_it = (*it)->window();

} else windows = (Window*) 0; - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_client_list_stacking, otk::Property::Atom_Window, windows, size);

@@ -442,7 +442,7 @@ dims[(i * 4) + 1] = _area.y();

dims[(i * 4) + 2] = _area.width(); dims[(i * 4) + 3] = _area.height(); } - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_workarea, otk::Property::Atom_Cardinal, dims, 4 * _num_desktops);

@@ -480,9 +480,9 @@

// create the Client class, which gets all of the hints on the window client = new Client(_number, window); // register for events - Openbox::instance->registerHandler(window, client); + openbox->registerHandler(window, client); // add to the wm's map - Openbox::instance->addClient(window, client); + openbox->addClient(window, client); // we dont want a border on the client client->toggleClientBorder(false);

@@ -491,29 +491,29 @@ // specify that if we exit, the window should not be destroyed and should be

// reparented back to root automatically XChangeSaveSet(otk::Display::display, window, SetModeInsert); - if (!(Openbox::instance->state() == Openbox::State_Starting || + if (!(openbox->state() == Openbox::State_Starting || client->positionRequested())) { // position the window intelligenty .. hopefully :) // call the python PLACEWINDOW binding EventData data(_number, client, EventPlaceWindow, 0); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); } // create the decoration frame for the client window client->frame = new Frame(client, &_style); // add to the wm's map - Openbox::instance->addClient(client->frame->window(), client); - Openbox::instance->addClient(client->frame->plate(), client); - Openbox::instance->addClient(client->frame->titlebar(), client); - Openbox::instance->addClient(client->frame->label(), client); - Openbox::instance->addClient(client->frame->button_max(), client); - Openbox::instance->addClient(client->frame->button_iconify(), client); - Openbox::instance->addClient(client->frame->button_stick(), client); - Openbox::instance->addClient(client->frame->button_close(), client); - Openbox::instance->addClient(client->frame->handle(), client); - Openbox::instance->addClient(client->frame->grip_left(), client); - Openbox::instance->addClient(client->frame->grip_right(), client); + openbox->addClient(client->frame->window(), client); + openbox->addClient(client->frame->plate(), client); + openbox->addClient(client->frame->titlebar(), client); + openbox->addClient(client->frame->label(), client); + openbox->addClient(client->frame->button_max(), client); + openbox->addClient(client->frame->button_iconify(), client); + openbox->addClient(client->frame->button_stick(), client); + openbox->addClient(client->frame->button_close(), client); + openbox->addClient(client->frame->handle(), client); + openbox->addClient(client->frame->grip_left(), client); + openbox->addClient(client->frame->grip_right(), client); // reparent the client to the frame client->frame->grabClient();

@@ -536,11 +536,11 @@ restack(true, client);

// update the root properties changeClientList(); - Openbox::instance->bindings()->grabButtons(true, client); + openbox->bindings()->grabButtons(true, client); // call the python NEWWINDOW binding EventData data(_number, client, EventNewWindow, 0); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); #ifdef DEBUG printf("Managed window 0x%lx\n", window);

@@ -554,25 +554,25 @@ Frame *frame = client->frame;

// call the python CLOSEWINDOW binding EventData data(_number, client, EventCloseWindow, 0); - Openbox::instance->bindings()->fireEvent(&data); + openbox->bindings()->fireEvent(&data); - Openbox::instance->bindings()->grabButtons(false, client); + openbox->bindings()->grabButtons(false, client); // remove from the wm's map - Openbox::instance->removeClient(client->window()); - Openbox::instance->removeClient(frame->window()); - Openbox::instance->removeClient(frame->plate()); - Openbox::instance->removeClient(frame->titlebar()); - Openbox::instance->removeClient(frame->label()); - Openbox::instance->removeClient(frame->button_max()); - Openbox::instance->removeClient(frame->button_iconify()); - Openbox::instance->removeClient(frame->button_stick()); - Openbox::instance->removeClient(frame->button_close()); - Openbox::instance->removeClient(frame->handle()); - Openbox::instance->removeClient(frame->grip_left()); - Openbox::instance->removeClient(frame->grip_right()); + openbox->removeClient(client->window()); + openbox->removeClient(frame->window()); + openbox->removeClient(frame->plate()); + openbox->removeClient(frame->titlebar()); + openbox->removeClient(frame->label()); + openbox->removeClient(frame->button_max()); + openbox->removeClient(frame->button_iconify()); + openbox->removeClient(frame->button_stick()); + openbox->removeClient(frame->button_close()); + openbox->removeClient(frame->handle()); + openbox->removeClient(frame->grip_left()); + openbox->removeClient(frame->grip_right()); // unregister for handling events - Openbox::instance->clearHandler(client->window()); + openbox->clearHandler(client->window()); // remove the window from our save set XChangeSaveSet(otk::Display::display, client->window(), SetModeDelete);

@@ -646,7 +646,7 @@

long old = _desktop; _desktop = desktop; - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_current_desktop, otk::Property::Atom_Cardinal, _desktop);

@@ -663,8 +663,8 @@ }

} // force the callbacks to fire - if (!Openbox::instance->focusedClient()) - Openbox::instance->setFocusedClient(0); + if (!openbox->focusedClient()) + openbox->setFocusedClient(0); } void Screen::changeNumDesktops(long num)

@@ -676,7 +676,7 @@

// XXX: move windows on desktops that will no longer exist! _num_desktops = num; - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_number_of_desktops, otk::Property::Atom_Cardinal, _num_desktops);

@@ -684,7 +684,7 @@

// set the viewport hint unsigned long *viewport = new unsigned long[_num_desktops * 2]; memset(viewport, 0, sizeof(unsigned long) * _num_desktops * 2); - Openbox::instance->property()->set(_info->rootWindow(), + openbox->property()->set(_info->rootWindow(), otk::Property::net_desktop_viewport, otk::Property::Atom_Cardinal, viewport, _num_desktops * 2);

@@ -697,7 +697,7 @@

void Screen::updateDesktopNames() { - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); unsigned long num = (unsigned) -1;

@@ -716,7 +716,7 @@ assert(i >= 0);

if (i >= _num_desktops) return; - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); otk::Property::StringVect newnames = _desktop_names; newnames[i] = name;

@@ -729,7 +729,7 @@ void Screen::propertyHandler(const XPropertyEvent &e)

{ otk::EventHandler::propertyHandler(e); - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); // compress changes to a single property into a single change XEvent ce;

@@ -753,7 +753,7 @@ otk::EventHandler::clientMessageHandler(e);

if (e.format != 32) return; - const otk::Property *property = Openbox::instance->property(); + const otk::Property *property = openbox->property(); if (e.message_type == property->atom(otk::Property::net_current_desktop)) { changeDesktop(e.data.l[0]);

@@ -778,14 +778,14 @@ MapRequest events come here even after the window exists instead of going

right to the client window, because of how they are sent and their struct layout. */ - Client *c = Openbox::instance->findClient(e.window); + Client *c = openbox->findClient(e.window); if (c) { // send a net_active_window message XEvent ce; ce.xclient.type = ClientMessage; ce.xclient.message_type = - Openbox::instance->property()->atom(otk::Property::net_active_window); + openbox->property()->atom(otk::Property::net_active_window); ce.xclient.display = otk::Display::display; ce.xclient.window = c->window(); ce.xclient.format = 32;