move the Openbox::instance pointer to simply "openbox".

This commit is contained in:
Dana Jansens 2003-01-13 08:13:58 +00:00
parent 4dba699857
commit 9e77a88d26
10 changed files with 150 additions and 149 deletions

View file

@ -45,7 +45,7 @@ void Actions::insertPress(const XButtonEvent &e)
a->button = e.button; a->button = e.button;
a->pos.setPoint(e.x_root, e.y_root); 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(); if (c) a->clientarea = c->area();
} }
@ -73,21 +73,21 @@ void Actions::buttonPressHandler(const XButtonEvent &e)
// run the PRESS python hook // run the PRESS python hook
WidgetBase *w = dynamic_cast<WidgetBase*> WidgetBase *w = dynamic_cast<WidgetBase*>
(Openbox::instance->findHandler(e.window)); (openbox->findHandler(e.window));
assert(w); // everything should be a widget assert(w); // everything should be a widget
// kill off the Button1Mask etc, only want the modifiers // kill off the Button1Mask etc, only want the modifiers
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
int screen; int screen;
Client *c = Openbox::instance->findClient(e.window); Client *c = openbox->findClient(e.window);
if (c) if (c)
screen = c->screen(); screen = c->screen();
else else
screen = otk::Display::findScreen(e.root)->screen(); screen = otk::Display::findScreen(e.root)->screen();
MouseData data(screen, c, e.time, state, e.button, w->mcontext(), MouseData data(screen, c, e.time, state, e.button, w->mcontext(),
MousePress); MousePress);
Openbox::instance->bindings()->fireButton(&data); openbox->bindings()->fireButton(&data);
if (_button) return; // won't count toward CLICK events if (_button) return; // won't count toward CLICK events
@ -112,7 +112,7 @@ void Actions::buttonReleaseHandler(const XButtonEvent &e)
removePress(e); removePress(e);
WidgetBase *w = dynamic_cast<WidgetBase*> WidgetBase *w = dynamic_cast<WidgetBase*>
(Openbox::instance->findHandler(e.window)); (openbox->findHandler(e.window));
assert(w); // everything should be a widget assert(w); // everything should be a widget
// not for the button we're watching? // not for the button we're watching?
@ -134,14 +134,14 @@ void Actions::buttonReleaseHandler(const XButtonEvent &e)
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
int screen; int screen;
Client *c = Openbox::instance->findClient(e.window); Client *c = openbox->findClient(e.window);
if (c) if (c)
screen = c->screen(); screen = c->screen();
else else
screen = otk::Display::findScreen(e.root)->screen(); screen = otk::Display::findScreen(e.root)->screen();
MouseData data(screen, c, e.time, state, e.button, w->mcontext(), MouseData data(screen, c, e.time, state, e.button, w->mcontext(),
MouseClick); MouseClick);
Openbox::instance->bindings()->fireButton(&data); openbox->bindings()->fireButton(&data);
// XXX: dont load this every time!!@* // XXX: dont load this every time!!@*
@ -154,7 +154,7 @@ void Actions::buttonReleaseHandler(const XButtonEvent &e)
// run the DOUBLECLICK python hook // run the DOUBLECLICK python hook
data.action = MouseDoubleClick; data.action = MouseDoubleClick;
Openbox::instance->bindings()->fireButton(&data); openbox->bindings()->fireButton(&data);
// reset so you cant triple click for 2 doubleclicks // reset so you cant triple click for 2 doubleclicks
_release.win = 0; _release.win = 0;
@ -175,13 +175,13 @@ void Actions::enterHandler(const XCrossingEvent &e)
// run the ENTER python hook // run the ENTER python hook
int screen; int screen;
Client *c = Openbox::instance->findClient(e.window); Client *c = openbox->findClient(e.window);
if (c) if (c)
screen = c->screen(); screen = c->screen();
else else
screen = otk::Display::findScreen(e.root)->screen(); screen = otk::Display::findScreen(e.root)->screen();
EventData data(screen, c, EventEnterWindow, e.state); EventData data(screen, c, EventEnterWindow, e.state);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
} }
@ -191,13 +191,13 @@ void Actions::leaveHandler(const XCrossingEvent &e)
// run the LEAVE python hook // run the LEAVE python hook
int screen; int screen;
Client *c = Openbox::instance->findClient(e.window); Client *c = openbox->findClient(e.window);
if (c) if (c)
screen = c->screen(); screen = c->screen();
else else
screen = otk::Display::findScreen(e.root)->screen(); screen = otk::Display::findScreen(e.root)->screen();
EventData data(screen, c, EventLeaveWindow, e.state); EventData data(screen, c, EventLeaveWindow, e.state);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
} }
@ -208,7 +208,7 @@ void Actions::keyPressHandler(const XKeyEvent &e)
// kill off the Button1Mask etc, only want the modifiers // kill off the Button1Mask etc, only want the modifiers
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
Openbox::instance->bindings()-> openbox->bindings()->
fireKey(otk::Display::findScreen(e.root)->screen(), fireKey(otk::Display::findScreen(e.root)->screen(),
state, e.keycode, e.time); state, e.keycode, e.time);
} }
@ -235,7 +235,7 @@ void Actions::motionHandler(const XMotionEvent &e)
} }
WidgetBase *w = dynamic_cast<WidgetBase*> WidgetBase *w = dynamic_cast<WidgetBase*>
(Openbox::instance->findHandler(e.window)); (openbox->findHandler(e.window));
assert(w); // everything should be a widget assert(w); // everything should be a widget
// run the MOTION python hook // run the MOTION python hook
@ -244,14 +244,14 @@ void Actions::motionHandler(const XMotionEvent &e)
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
unsigned int button = _posqueue[0]->button; unsigned int button = _posqueue[0]->button;
int screen; int screen;
Client *c = Openbox::instance->findClient(e.window); Client *c = openbox->findClient(e.window);
if (c) if (c)
screen = c->screen(); screen = c->screen();
else else
screen = otk::Display::findScreen(e.root)->screen(); screen = otk::Display::findScreen(e.root)->screen();
MouseData data(screen, c, e.time, state, button, w->mcontext(), MouseMotion, MouseData data(screen, c, e.time, state, button, w->mcontext(), MouseMotion,
x_root, y_root, _posqueue[0]->pos, _posqueue[0]->clientarea); 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) void Actions::mapRequestHandler(const XMapRequestEvent &e)
@ -283,13 +283,13 @@ void Actions::xkbHandler(const XkbEvent &e)
switch (((XkbAnyEvent*)&e)->xkb_type) { switch (((XkbAnyEvent*)&e)->xkb_type) {
case XkbBellNotify: case XkbBellNotify:
w = ((XkbBellNotifyEvent*)&e)->window; w = ((XkbBellNotifyEvent*)&e)->window;
Client *c = Openbox::instance->findClient(w); Client *c = openbox->findClient(w);
if (c) if (c)
screen = c->screen(); screen = c->screen();
else else
screen = Openbox::instance->focusedScreen()->number(); screen = openbox->focusedScreen()->number();
EventData data(screen, c, EventBell, 0); EventData data(screen, c, EventBell, 0);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
break; break;
} }
} }

View file

@ -145,7 +145,7 @@ KeyBindingTree *Bindings::buildtree(const StringVect &keylist,
Bindings::Bindings() Bindings::Bindings()
: _curpos(&_keytree), : _curpos(&_keytree),
_resetkey(0,0), _resetkey(0,0),
_timer(Openbox::instance->timerManager(), _timer(openbox->timerManager(),
(otk::TimeoutHandler)resetChains, this) (otk::TimeoutHandler)resetChains, this)
{ {
_timer.setTimeout(5000); // chains reset after 5 seconds _timer.setTimeout(5000); // chains reset after 5 seconds
@ -341,7 +341,7 @@ void Bindings::removeAllKeys()
void Bindings::grabKeys(bool grab) 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(); Window root = otk::Display::screenInfo(i)->rootWindow();
KeyBindingTree *p = _curpos->first_child; KeyBindingTree *p = _curpos->first_child;
@ -387,7 +387,7 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key,
grabKeys(true); grabKeys(true);
otk::Display::ungrab(); otk::Display::ungrab();
} else { } else {
Client *c = Openbox::instance->focusedClient(); Client *c = openbox->focusedClient();
KeyData data(screen, c, time, modifiers, key); KeyData data(screen, c, time, modifiers, key);
CallbackList::iterator it, end = p->callbacks.end(); CallbackList::iterator it, end = p->callbacks.end();
for (it = p->callbacks.begin(); it != end; ++it) for (it = p->callbacks.begin(); it != end; ++it)
@ -440,8 +440,8 @@ bool Bindings::addButton(const std::string &but, MouseContext context,
bind->binding.modifiers = b.modifiers; bind->binding.modifiers = b.modifiers;
_buttons[context].push_back(bind); _buttons[context].push_back(bind);
// grab the button on all clients // grab the button on all clients
for (int sn = 0; sn < Openbox::instance->screenCount(); ++sn) { for (int sn = 0; sn < openbox->screenCount(); ++sn) {
Screen *s = Openbox::instance->screen(sn); Screen *s = openbox->screen(sn);
Client::List::iterator c_it, c_end = s->clients.end(); Client::List::iterator c_it, c_end = s->clients.end();
for (c_it = s->clients.begin(); c_it != c_end; ++c_it) { for (c_it = s->clients.begin(); c_it != c_end; ++c_it) {
grabButton(true, bind->binding, context, *c_it); grabButton(true, bind->binding, context, *c_it);
@ -466,8 +466,8 @@ void Bindings::removeAllButtons()
} }
} }
// ungrab the button on all clients // ungrab the button on all clients
for (int sn = 0; sn < Openbox::instance->screenCount(); ++sn) { for (int sn = 0; sn < openbox->screenCount(); ++sn) {
Screen *s = Openbox::instance->screen(sn); Screen *s = openbox->screen(sn);
Client::List::iterator c_it, c_end = s->clients.end(); Client::List::iterator c_it, c_end = s->clients.end();
for (c_it = s->clients.begin(); c_it != c_end; ++c_it) { for (c_it = s->clients.begin(); c_it != c_end; ++c_it) {
grabButton(false, (*it)->binding, (MouseContext)i, *c_it); grabButton(false, (*it)->binding, (MouseContext)i, *c_it);

View file

@ -72,7 +72,7 @@ Client::Client(int screen, Window window)
Client::~Client() Client::~Client()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
// clean up childrens' references // clean up childrens' references
while (!_transients.empty()) { while (!_transients.empty()) {
@ -84,7 +84,7 @@ Client::~Client()
if (_transient_for) if (_transient_for)
_transient_for->_transients.remove(this); // remove from old parent _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 // 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_desktop);
property->erase(_window, otk::Property::net_wm_state); property->erase(_window, otk::Property::net_wm_state);
@ -94,16 +94,16 @@ Client::~Client()
void Client::getDesktop() void Client::getDesktop()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
// defaults to the current desktop // 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, if (!property->get(_window, otk::Property::net_wm_desktop,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
(long unsigned*)&_desktop)) { (long unsigned*)&_desktop)) {
// make sure the hint exists // make sure the hint exists
Openbox::instance->property()->set(_window, openbox->property()->set(_window,
otk::Property::net_wm_desktop, otk::Property::net_wm_desktop,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
(unsigned)_desktop); (unsigned)_desktop);
@ -113,7 +113,7 @@ void Client::getDesktop()
void Client::getType() void Client::getType()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
_type = (WindowType) -1; _type = (WindowType) -1;
@ -245,7 +245,7 @@ void Client::setupDecorAndFunctions()
void Client::getMwmHints() void Client::getMwmHints()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
unsigned long num = MwmHints::elements; unsigned long num = MwmHints::elements;
unsigned long *hints; unsigned long *hints;
@ -283,7 +283,7 @@ void Client::getArea()
void Client::getState() 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 = _modal = _shaded = _max_horz = _max_vert = _fullscreen = _above = _below =
_skip_taskbar = _skip_pager = false; _skip_taskbar = _skip_pager = false;
@ -368,7 +368,7 @@ void Client::calcLayer() {
if we don't have a frame, then we aren't mapped yet (and this would if we don't have a frame, then we aren't mapped yet (and this would
SIGSEGV :) SIGSEGV :)
*/ */
Openbox::instance->screen(_screen)->restack(true, this); // raise openbox->screen(_screen)->restack(true, this); // raise
} }
} }
} }
@ -376,7 +376,7 @@ void Client::calcLayer() {
void Client::updateProtocols() void Client::updateProtocols()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
Atom *proto; Atom *proto;
int num_return = 0; int num_return = 0;
@ -480,7 +480,7 @@ void Client::updateWMHints()
void Client::updateTitle() void Client::updateTitle()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
_title = ""; _title = "";
@ -502,7 +502,7 @@ void Client::updateTitle()
void Client::updateIconTitle() void Client::updateIconTitle()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
_icon_title = ""; _icon_title = "";
@ -521,7 +521,7 @@ void Client::updateIconTitle()
void Client::updateClass() void Client::updateClass()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
// set the defaults // set the defaults
_app_name = _app_class = _role = ""; _app_name = _app_class = _role = "";
@ -548,7 +548,7 @@ void Client::updateStrut()
{ {
unsigned long num = 4; unsigned long num = 4;
unsigned long *data; unsigned long *data;
if (!Openbox::instance->property()->get(_window, if (!openbox->property()->get(_window,
otk::Property::net_wm_strut, otk::Property::net_wm_strut,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
&num, &data)) &num, &data))
@ -560,7 +560,7 @@ void Client::updateStrut()
_strut.top = data[2]; _strut.top = data[2];
_strut.bottom = data[3]; _strut.bottom = data[3];
Openbox::instance->screen(_screen)->updateStrut(); openbox->screen(_screen)->updateStrut();
} }
delete [] data; delete [] data;
@ -574,7 +574,7 @@ void Client::updateTransientFor()
if (XGetTransientForHint(otk::Display::display, _window, &t) && if (XGetTransientForHint(otk::Display::display, _window, &t) &&
t != _window) { // cant be transient to itself! 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 assert(c != this); // if this happens then we need to check for it
if (!c /*XXX: && _group*/) { if (!c /*XXX: && _group*/) {
@ -606,7 +606,7 @@ void Client::propertyHandler(const XPropertyEvent &e)
{ {
otk::EventHandler::propertyHandler(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 // compress changes to a single property into a single change
XEvent ce; XEvent ce;
@ -671,13 +671,13 @@ void Client::setDesktop(long target)
_desktop = target; _desktop = target;
Openbox::instance->property()->set(_window, openbox->property()->set(_window,
otk::Property::net_wm_desktop, otk::Property::net_wm_desktop,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
(unsigned)_desktop); (unsigned)_desktop);
// 'move' the window to the new desktop // 'move' the window to the new desktop
if (_desktop == Openbox::instance->screen(_screen)->desktop() || if (_desktop == openbox->screen(_screen)->desktop() ||
_desktop == (signed)0xffffffff) _desktop == (signed)0xffffffff)
frame->show(); frame->show();
else else
@ -687,7 +687,7 @@ void Client::setDesktop(long target)
void Client::setState(StateAction action, long data1, long data2) 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; bool shadestate = _shaded;
if (!(action == State_Add || action == State_Remove || if (!(action == State_Add || action == State_Remove ||
@ -865,7 +865,7 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
if (e.format != 32) return; 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)) { if (e.message_type == property->atom(otk::Property::wm_change_state)) {
// compress changes into a single change // compress changes into a single change
@ -926,7 +926,7 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
shade(false); shade(false);
// XXX: deiconify // XXX: deiconify
focus(); focus();
Openbox::instance->screen(_screen)->restack(true, this); // raise openbox->screen(_screen)->restack(true, this); // raise
} }
} }
@ -1037,7 +1037,7 @@ void Client::move(int x, int y)
void Client::close() void Client::close()
{ {
XEvent ce; XEvent ce;
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
if (!(_functions & Func_Close)) return; if (!(_functions & Func_Close)) return;
@ -1063,7 +1063,7 @@ void Client::close()
void Client::changeState() void Client::changeState()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
unsigned long state[2]; unsigned long state[2];
state[0] = _wmstate; state[0] = _wmstate;
@ -1128,7 +1128,7 @@ bool Client::focus() const
if (_focus_notify) { if (_focus_notify) {
XEvent ce; XEvent ce;
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
ce.xclient.type = ClientMessage; ce.xclient.type = ClientMessage;
ce.xclient.message_type = property->atom(otk::Property::wm_protocols); ce.xclient.message_type = property->atom(otk::Property::wm_protocols);
@ -1136,7 +1136,7 @@ bool Client::focus() const
ce.xclient.window = _window; ce.xclient.window = _window;
ce.xclient.format = 32; ce.xclient.format = 32;
ce.xclient.data.l[0] = property->atom(otk::Property::wm_take_focus); 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[2] = 0l;
ce.xclient.data.l[3] = 0l; ce.xclient.data.l[3] = 0l;
ce.xclient.data.l[4] = 0l; ce.xclient.data.l[4] = 0l;
@ -1151,8 +1151,8 @@ void Client::unfocus() const
{ {
if (!_focused) return; if (!_focused) return;
assert(Openbox::instance->focusedClient() == this); assert(openbox->focusedClient() == this);
Openbox::instance->setFocusedClient(0); openbox->setFocusedClient(0);
} }
@ -1167,7 +1167,7 @@ void Client::focusHandler(const XFocusChangeEvent &e)
frame->focus(); frame->focus();
_focused = true; _focused = true;
Openbox::instance->setFocusedClient(this); openbox->setFocusedClient(this);
} }
@ -1182,8 +1182,8 @@ void Client::unfocusHandler(const XFocusChangeEvent &e)
frame->unfocus(); frame->unfocus();
_focused = false; _focused = false;
if (Openbox::instance->focusedClient() == this) if (openbox->focusedClient() == this)
Openbox::instance->setFocusedClient(0); openbox->setFocusedClient(0);
} }
@ -1239,13 +1239,13 @@ void Client::configureRequestHandler(const XConfigureRequestEvent &e)
switch (e.detail) { switch (e.detail) {
case Below: case Below:
case BottomIf: case BottomIf:
Openbox::instance->screen(_screen)->restack(false, this); // lower openbox->screen(_screen)->restack(false, this); // lower
break; break;
case Above: case Above:
case TopIf: case TopIf:
default: default:
Openbox::instance->screen(_screen)->restack(true, this); // raise openbox->screen(_screen)->restack(true, this); // raise
break; break;
} }
} }
@ -1269,7 +1269,7 @@ void Client::unmapHandler(const XUnmapEvent &e)
otk::EventHandler::unmapHandler(e); otk::EventHandler::unmapHandler(e);
// this deletes us etc // this deletes us etc
Openbox::instance->screen(_screen)->unmanageWindow(this); openbox->screen(_screen)->unmanageWindow(this);
} }
@ -1282,7 +1282,7 @@ void Client::destroyHandler(const XDestroyWindowEvent &e)
otk::EventHandler::destroyHandler(e); otk::EventHandler::destroyHandler(e);
// this deletes us etc // this deletes us etc
Openbox::instance->screen(_screen)->unmanageWindow(this); openbox->screen(_screen)->unmanageWindow(this);
} }
@ -1311,7 +1311,7 @@ void Client::reparentHandler(const XReparentEvent &e)
XPutBackEvent(otk::Display::display, &ev); XPutBackEvent(otk::Display::display, &ev);
// this deletes us etc // this deletes us etc
Openbox::instance->screen(_screen)->unmanageWindow(this); openbox->screen(_screen)->unmanageWindow(this);
} }
} }

View file

@ -24,7 +24,7 @@ namespace ob {
const long Frame::event_mask; const long Frame::event_mask;
Frame::Frame(Client *client, otk::Style *style) 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), WidgetBase(WidgetBase::Type_Frame),
_client(client), _client(client),
_screen(otk::Display::screenInfo(client->screen())), _screen(otk::Display::screenInfo(client->screen())),
@ -45,8 +45,8 @@ Frame::Frame(Client *client, otk::Style *style)
XSelectInput(otk::Display::display, _window, Frame::event_mask); XSelectInput(otk::Display::display, _window, Frame::event_mask);
_grip_left.setCursor(Openbox::instance->cursors().ll_angle); _grip_left.setCursor(openbox->cursors().ll_angle);
_grip_right.setCursor(Openbox::instance->cursors().lr_angle); _grip_right.setCursor(openbox->cursors().lr_angle);
_label.setText(_client->title()); _label.setText(_client->title());
@ -412,7 +412,7 @@ void Frame::grabClient()
member set the root window, and one set to the client, but both get handled member set the root window, and one set to the client, but both get handled
and need to be ignored. and need to be ignored.
*/ */
if (Openbox::instance->state() == Openbox::State_Starting) if (openbox->state() == Openbox::State_Starting)
_client->ignore_unmaps += 2; _client->ignore_unmaps += 2;
// select the event mask on the client's parent (to receive config req's) // select the event mask on the client's parent (to receive config req's)

View file

@ -51,7 +51,7 @@ extern "C" {
namespace ob { namespace ob {
Openbox *Openbox::instance = (Openbox *) 0; Openbox *openbox = (Openbox *) 0;
void Openbox::signalHandler(int signal) void Openbox::signalHandler(int signal)
@ -59,7 +59,7 @@ void Openbox::signalHandler(int signal)
switch (signal) { switch (signal) {
case SIGUSR1: case SIGUSR1:
printf("Caught SIGUSR1 signal. Restarting.\n"); printf("Caught SIGUSR1 signal. Restarting.\n");
instance->restart(); openbox->restart();
break; break;
case SIGHUP: case SIGHUP:
@ -67,7 +67,7 @@ void Openbox::signalHandler(int signal)
case SIGTERM: case SIGTERM:
case SIGPIPE: case SIGPIPE:
printf("Caught signal %d. Exiting.\n", signal); printf("Caught signal %d. Exiting.\n", signal);
instance->shutdown(); openbox->shutdown();
break; break;
case SIGFPE: case SIGFPE:
@ -86,7 +86,7 @@ Openbox::Openbox(int argc, char **argv)
_state = State_Starting; // initializing everything _state = State_Starting; // initializing everything
Openbox::instance = this; openbox = this;
_displayreq = (char*) 0; _displayreq = (char*) 0;
_argv = argv; _argv = argv;
@ -378,7 +378,7 @@ void Openbox::setFocusedClient(Client *c)
// call the python Focus callbacks // call the python Focus callbacks
EventData data(_focused_screen->number(), c, EventFocus, 0); 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) void Openbox::execute(int screen, const std::string &bin)

View file

@ -38,6 +38,14 @@ struct Cursors {
Cursor ur_angle; //!< For resizing the right 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 //! The main class for the Openbox window manager
/*! /*!
@ -52,13 +60,6 @@ struct Cursors {
class Openbox : public otk::EventDispatcher, public otk::EventHandler class Openbox : public otk::EventDispatcher, public otk::EventHandler
{ {
public: 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 //! The posible running states of the window manager
enum RunState { enum RunState {
State_Starting, //!< The window manager is starting up (being created) State_Starting, //!< The window manager is starting up (being created)

View file

@ -20,9 +20,9 @@
//%include std_list.i //%include std_list.i
//%template(ClientList) std::list<Client*>; //%template(ClientList) std::list<Client*>;
%ignore ob::Openbox::instance; %ignore ob::openbox;
%inline %{ %inline %{
ob::Openbox *Openbox_instance() { return ob::Openbox::instance; } ob::Openbox *Openbox_instance() { return ob::openbox; }
%}; %};
%{ %{
@ -96,7 +96,7 @@ void python_callback(PyObject *func, KeyData *data)
%} %}
%extend ob::Screen { %extend ob::Screen {
Client *client(int i) { Client *client(int i) {
if (i >= (int)self->clients.size()) if (i < 0 || i >= (int)self->clients.size())
return NULL; return NULL;
ob::Client::List::iterator it = self->clients.begin(); ob::Client::List::iterator it = self->clients.begin();
std::advance(it,i); std::advance(it,i);

View file

@ -813,7 +813,7 @@ std::string SwigString_AsString(PyObject* o) {
#include <stdexcept> #include <stdexcept>
ob::Openbox *Openbox_instance() { return ob::Openbox::instance; } ob::Openbox *Openbox_instance() { return ob::openbox; }
namespace ob { namespace ob {
@ -889,7 +889,7 @@ void python_callback(PyObject *func, KeyData *data)
#include "ustring.hh" #include "ustring.hh"
ob::Client *ob_Screen_client(ob::Screen *self,int i){ 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; return NULL;
ob::Client::List::iterator it = self->clients.begin(); ob::Client::List::iterator it = self->clients.begin();
std::advance(it,i); std::advance(it,i);

View file

@ -100,7 +100,7 @@ PyObject *mbind(const std::string &button, ob::MouseContext context,
return NULL; return NULL;
} }
if (!ob::Openbox::instance->bindings()->addButton(button, context, if (!ob::openbox->bindings()->addButton(button, context,
action, func)) { action, func)) {
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding."); PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return NULL; return NULL;
@ -115,7 +115,7 @@ PyObject *ebind(ob::EventAction action, PyObject *func)
return NULL; 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."); PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return NULL; return NULL;
} }
@ -145,7 +145,7 @@ PyObject *kbind(PyObject *keylist, ob::KeyContext context, PyObject *func)
} }
(void)context; // XXX use this sometime! (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."); PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return NULL; return NULL;
} }
@ -174,7 +174,7 @@ PyObject *kunbind(PyObject *keylist, PyObject *func)
vectkeylist.push_back(PyString_AsString(str)); 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."); PyErr_SetString(PyExc_RuntimeError, "Could not remove callback.");
return NULL; return NULL;
} }
@ -183,12 +183,12 @@ PyObject *kunbind(PyObject *keylist, PyObject *func)
void kunbind_all() void kunbind_all()
{ {
ob::Openbox::instance->bindings()->removeAllKeys(); ob::openbox->bindings()->removeAllKeys();
} }
void set_reset_key(const std::string &key) 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, PyObject *send_client_msg(Window target, int type, Window about,
@ -205,7 +205,7 @@ PyObject *send_client_msg(Window target, int type, Window about,
e.xclient.type = ClientMessage; e.xclient.type = ClientMessage;
e.xclient.format = 32; e.xclient.format = 32;
e.xclient.message_type = 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.window = about;
e.xclient.data.l[0] = data; e.xclient.data.l[0] = data;
e.xclient.data.l[1] = data1; e.xclient.data.l[1] = data1;

View file

@ -65,17 +65,17 @@ Screen::Screen(int screen)
printf(_("Managing screen %d: visual 0x%lx, depth %d\n"), printf(_("Managing screen %d: visual 0x%lx, depth %d\n"),
_number, XVisualIDFromVisual(_info->visual()), _info->depth()); _number, XVisualIDFromVisual(_info->visual()), _info->depth());
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::openbox_pid, otk::Property::openbox_pid,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
(unsigned long) getpid()); (unsigned long) getpid());
// set the mouse cursor for the root window (the default cursor) // set the mouse cursor for the root window (the default cursor)
XDefineCursor(otk::Display::display, _info->rootWindow(), 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 // 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); _info, true);
_image_control->installRootColormap(); _image_control->installRootColormap();
_root_cmap_installed = True; _root_cmap_installed = True;
@ -101,7 +101,7 @@ Screen::Screen(int screen)
// Set the netwm properties for geometry // Set the netwm properties for geometry
unsigned long geometry[] = { _info->width(), unsigned long geometry[] = { _info->width(),
_info->height() }; _info->height() };
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_desktop_geometry, otk::Property::net_desktop_geometry,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
geometry, 2); geometry, 2);
@ -109,7 +109,7 @@ Screen::Screen(int screen)
// Set the net_desktop_names property // Set the net_desktop_names property
std::vector<otk::ustring> names; std::vector<otk::ustring> names;
python_get_stringlist("desktop_names", &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::net_desktop_names,
otk::Property::utf8, otk::Property::utf8,
names); names);
@ -137,11 +137,11 @@ Screen::Screen(int screen)
calcArea(); // initialize the available working area calcArea(); // initialize the available working area
// register this class as the event handler for the root window // 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 // call the python Startup callbacks
EventData data(_number, 0, EventShutdown, 0); EventData data(_number, 0, EventShutdown, 0);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
} }
@ -157,7 +157,7 @@ Screen::~Screen()
// call the python Shutdown callbacks // call the python Shutdown callbacks
EventData data(_number, 0, EventShutdown, 0); EventData data(_number, 0, EventShutdown, 0);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
XDestroyWindow(otk::Display::display, _focuswindow); XDestroyWindow(otk::Display::display, _focuswindow);
XDestroyWindow(otk::Display::display, _supportwindow); XDestroyWindow(otk::Display::display, _supportwindow);
@ -284,17 +284,17 @@ void Screen::changeSupportedAtoms()
0, 0, 1, 1, 0, 0, 0); 0, 0, 1, 1, 0, 0, 0);
// set supporting window // set supporting window
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_supporting_wm_check, otk::Property::net_supporting_wm_check,
otk::Property::Atom_Window, otk::Property::Atom_Window,
_supportwindow); _supportwindow);
//set properties on the supporting window //set properties on the supporting window
Openbox::instance->property()->set(_supportwindow, openbox->property()->set(_supportwindow,
otk::Property::net_wm_name, otk::Property::net_wm_name,
otk::Property::utf8, otk::Property::utf8,
"Openbox"); "Openbox");
Openbox::instance->property()->set(_supportwindow, openbox->property()->set(_supportwindow,
otk::Property::net_supporting_wm_check, otk::Property::net_supporting_wm_check,
otk::Property::Atom_Window, otk::Property::Atom_Window,
_supportwindow); _supportwindow);
@ -363,9 +363,9 @@ void Screen::changeSupportedAtoms()
// convert to the atom values // convert to the atom values
for (int i = 0; i < num_supported; ++i) for (int i = 0; i < num_supported; ++i)
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::net_supported,
otk::Property::Atom_Atom, otk::Property::Atom_Atom,
supported, num_supported); supported, num_supported);
@ -390,7 +390,7 @@ void Screen::changeClientList()
} else } else
windows = (Window*) 0; windows = (Window*) 0;
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_client_list, otk::Property::net_client_list,
otk::Property::Atom_Window, otk::Property::Atom_Window,
windows, size); windows, size);
@ -423,7 +423,7 @@ void Screen::changeStackingList()
} else } else
windows = (Window*) 0; windows = (Window*) 0;
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_client_list_stacking, otk::Property::net_client_list_stacking,
otk::Property::Atom_Window, otk::Property::Atom_Window,
windows, size); windows, size);
@ -442,7 +442,7 @@ void Screen::changeWorkArea() {
dims[(i * 4) + 2] = _area.width(); dims[(i * 4) + 2] = _area.width();
dims[(i * 4) + 3] = _area.height(); dims[(i * 4) + 3] = _area.height();
} }
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_workarea, otk::Property::net_workarea,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
dims, 4 * _num_desktops); dims, 4 * _num_desktops);
@ -480,9 +480,9 @@ void Screen::manageWindow(Window window)
// create the Client class, which gets all of the hints on the window // create the Client class, which gets all of the hints on the window
client = new Client(_number, window); client = new Client(_number, window);
// register for events // register for events
Openbox::instance->registerHandler(window, client); openbox->registerHandler(window, client);
// add to the wm's map // add to the wm's map
Openbox::instance->addClient(window, client); openbox->addClient(window, client);
// we dont want a border on the client // we dont want a border on the client
client->toggleClientBorder(false); client->toggleClientBorder(false);
@ -491,29 +491,29 @@ void Screen::manageWindow(Window window)
// reparented back to root automatically // reparented back to root automatically
XChangeSaveSet(otk::Display::display, window, SetModeInsert); XChangeSaveSet(otk::Display::display, window, SetModeInsert);
if (!(Openbox::instance->state() == Openbox::State_Starting || if (!(openbox->state() == Openbox::State_Starting ||
client->positionRequested())) { client->positionRequested())) {
// position the window intelligenty .. hopefully :) // position the window intelligenty .. hopefully :)
// call the python PLACEWINDOW binding // call the python PLACEWINDOW binding
EventData data(_number, client, EventPlaceWindow, 0); EventData data(_number, client, EventPlaceWindow, 0);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
} }
// create the decoration frame for the client window // create the decoration frame for the client window
client->frame = new Frame(client, &_style); client->frame = new Frame(client, &_style);
// add to the wm's map // add to the wm's map
Openbox::instance->addClient(client->frame->window(), client); openbox->addClient(client->frame->window(), client);
Openbox::instance->addClient(client->frame->plate(), client); openbox->addClient(client->frame->plate(), client);
Openbox::instance->addClient(client->frame->titlebar(), client); openbox->addClient(client->frame->titlebar(), client);
Openbox::instance->addClient(client->frame->label(), client); openbox->addClient(client->frame->label(), client);
Openbox::instance->addClient(client->frame->button_max(), client); openbox->addClient(client->frame->button_max(), client);
Openbox::instance->addClient(client->frame->button_iconify(), client); openbox->addClient(client->frame->button_iconify(), client);
Openbox::instance->addClient(client->frame->button_stick(), client); openbox->addClient(client->frame->button_stick(), client);
Openbox::instance->addClient(client->frame->button_close(), client); openbox->addClient(client->frame->button_close(), client);
Openbox::instance->addClient(client->frame->handle(), client); openbox->addClient(client->frame->handle(), client);
Openbox::instance->addClient(client->frame->grip_left(), client); openbox->addClient(client->frame->grip_left(), client);
Openbox::instance->addClient(client->frame->grip_right(), client); openbox->addClient(client->frame->grip_right(), client);
// reparent the client to the frame // reparent the client to the frame
client->frame->grabClient(); client->frame->grabClient();
@ -536,11 +536,11 @@ void Screen::manageWindow(Window window)
// update the root properties // update the root properties
changeClientList(); changeClientList();
Openbox::instance->bindings()->grabButtons(true, client); openbox->bindings()->grabButtons(true, client);
// call the python NEWWINDOW binding // call the python NEWWINDOW binding
EventData data(_number, client, EventNewWindow, 0); EventData data(_number, client, EventNewWindow, 0);
Openbox::instance->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
#ifdef DEBUG #ifdef DEBUG
printf("Managed window 0x%lx\n", window); printf("Managed window 0x%lx\n", window);
@ -554,25 +554,25 @@ void Screen::unmanageWindow(Client *client)
// call the python CLOSEWINDOW binding // call the python CLOSEWINDOW binding
EventData data(_number, client, EventCloseWindow, 0); 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 // remove from the wm's map
Openbox::instance->removeClient(client->window()); openbox->removeClient(client->window());
Openbox::instance->removeClient(frame->window()); openbox->removeClient(frame->window());
Openbox::instance->removeClient(frame->plate()); openbox->removeClient(frame->plate());
Openbox::instance->removeClient(frame->titlebar()); openbox->removeClient(frame->titlebar());
Openbox::instance->removeClient(frame->label()); openbox->removeClient(frame->label());
Openbox::instance->removeClient(frame->button_max()); openbox->removeClient(frame->button_max());
Openbox::instance->removeClient(frame->button_iconify()); openbox->removeClient(frame->button_iconify());
Openbox::instance->removeClient(frame->button_stick()); openbox->removeClient(frame->button_stick());
Openbox::instance->removeClient(frame->button_close()); openbox->removeClient(frame->button_close());
Openbox::instance->removeClient(frame->handle()); openbox->removeClient(frame->handle());
Openbox::instance->removeClient(frame->grip_left()); openbox->removeClient(frame->grip_left());
Openbox::instance->removeClient(frame->grip_right()); openbox->removeClient(frame->grip_right());
// unregister for handling events // unregister for handling events
Openbox::instance->clearHandler(client->window()); openbox->clearHandler(client->window());
// remove the window from our save set // remove the window from our save set
XChangeSaveSet(otk::Display::display, client->window(), SetModeDelete); XChangeSaveSet(otk::Display::display, client->window(), SetModeDelete);
@ -646,7 +646,7 @@ void Screen::changeDesktop(long desktop)
long old = _desktop; long old = _desktop;
_desktop = desktop; _desktop = desktop;
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_current_desktop, otk::Property::net_current_desktop,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
_desktop); _desktop);
@ -663,8 +663,8 @@ void Screen::changeDesktop(long desktop)
} }
// force the callbacks to fire // force the callbacks to fire
if (!Openbox::instance->focusedClient()) if (!openbox->focusedClient())
Openbox::instance->setFocusedClient(0); openbox->setFocusedClient(0);
} }
void Screen::changeNumDesktops(long num) void Screen::changeNumDesktops(long num)
@ -676,7 +676,7 @@ void Screen::changeNumDesktops(long num)
// XXX: move windows on desktops that will no longer exist! // XXX: move windows on desktops that will no longer exist!
_num_desktops = num; _num_desktops = num;
Openbox::instance->property()->set(_info->rootWindow(), openbox->property()->set(_info->rootWindow(),
otk::Property::net_number_of_desktops, otk::Property::net_number_of_desktops,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
_num_desktops); _num_desktops);
@ -684,7 +684,7 @@ void Screen::changeNumDesktops(long num)
// set the viewport hint // set the viewport hint
unsigned long *viewport = new unsigned long[_num_desktops * 2]; unsigned long *viewport = new unsigned long[_num_desktops * 2];
memset(viewport, 0, sizeof(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::net_desktop_viewport,
otk::Property::Atom_Cardinal, otk::Property::Atom_Cardinal,
viewport, _num_desktops * 2); viewport, _num_desktops * 2);
@ -697,7 +697,7 @@ void Screen::changeNumDesktops(long num)
void Screen::updateDesktopNames() void Screen::updateDesktopNames()
{ {
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
unsigned long num = (unsigned) -1; unsigned long num = (unsigned) -1;
@ -716,7 +716,7 @@ void Screen::setDesktopName(long i, const otk::ustring &name)
if (i >= _num_desktops) return; if (i >= _num_desktops) return;
const otk::Property *property = Openbox::instance->property(); const otk::Property *property = openbox->property();
otk::Property::StringVect newnames = _desktop_names; otk::Property::StringVect newnames = _desktop_names;
newnames[i] = name; newnames[i] = name;
@ -729,7 +729,7 @@ void Screen::propertyHandler(const XPropertyEvent &e)
{ {
otk::EventHandler::propertyHandler(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 // compress changes to a single property into a single change
XEvent ce; XEvent ce;
@ -753,7 +753,7 @@ void Screen::clientMessageHandler(const XClientMessageEvent &e)
if (e.format != 32) return; 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)) { if (e.message_type == property->atom(otk::Property::net_current_desktop)) {
changeDesktop(e.data.l[0]); changeDesktop(e.data.l[0]);
@ -778,14 +778,14 @@ void Screen::mapRequestHandler(const XMapRequestEvent &e)
right to the client window, because of how they are sent and their struct right to the client window, because of how they are sent and their struct
layout. layout.
*/ */
Client *c = Openbox::instance->findClient(e.window); Client *c = openbox->findClient(e.window);
if (c) { if (c) {
// send a net_active_window message // send a net_active_window message
XEvent ce; XEvent ce;
ce.xclient.type = ClientMessage; ce.xclient.type = ClientMessage;
ce.xclient.message_type = 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.display = otk::Display::display;
ce.xclient.window = c->window(); ce.xclient.window = c->window();
ce.xclient.format = 32; ce.xclient.format = 32;