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();
}
// 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
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?
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!!@*
// 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;
// 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);
}
// 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);
}
// 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);
}
}
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
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)
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;
}
}
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
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;
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)
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);
}
}
// 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);
Client::~Client()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
// clean up childrens' references
while (!_transients.empty()) {
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);
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);
void Client::getType()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_type = (WindowType) -1;
void Client::getMwmHints()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
unsigned long num = MwmHints::elements;
unsigned long *hints;
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;
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
}
}
}
void Client::updateProtocols()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
Atom *proto;
int num_return = 0;
void Client::updateTitle()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_title = "";
void Client::updateIconTitle()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_icon_title = "";
void Client::updateClass()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
// set the defaults
_app_name = _app_class = _role = "";
{
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))
_strut.top = data[2];
_strut.bottom = data[3];
- Openbox::instance->screen(_screen)->updateStrut();
+ openbox->screen(_screen)->updateStrut();
}
delete [] data;
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*/) {
{
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;
_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
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 ||
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
shade(false);
// XXX: deiconify
focus();
- Openbox::instance->screen(_screen)->restack(true, this); // raise
+ openbox->screen(_screen)->restack(true, this); // raise
}
}
void Client::close()
{
XEvent ce;
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
if (!(_functions & Func_Close)) return;
void Client::changeState()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
unsigned long state[2];
state[0] = _wmstate;
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);
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;
{
if (!_focused) return;
- assert(Openbox::instance->focusedClient() == this);
- Openbox::instance->setFocusedClient(0);
+ assert(openbox->focusedClient() == this);
+ openbox->setFocusedClient(0);
}
frame->focus();
_focused = true;
- Openbox::instance->setFocusedClient(this);
+ openbox->setFocusedClient(this);
}
frame->unfocus();
_focused = false;
- if (Openbox::instance->focusedClient() == this)
- Openbox::instance->setFocusedClient(0);
+ if (openbox->focusedClient() == this)
+ openbox->setFocusedClient(0);
}
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;
}
}
otk::EventHandler::unmapHandler(e);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
otk::EventHandler::destroyHandler(e);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
XPutBackEvent(otk::Display::display, &ev);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
}
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())),
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());
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)
namespace ob {
-Openbox *Openbox::instance = (Openbox *) 0;
+Openbox *openbox = (Openbox *) 0;
void Openbox::signalHandler(int signal)
switch (signal) {
case SIGUSR1:
printf("Caught SIGUSR1 signal. Restarting.\n");
- instance->restart();
+ openbox->restart();
break;
case SIGHUP:
case SIGTERM:
case SIGPIPE:
printf("Caught signal %d. Exiting.\n", signal);
- instance->shutdown();
+ openbox->shutdown();
break;
case SIGFPE:
_state = State_Starting; // initializing everything
- Openbox::instance = this;
+ openbox = this;
_displayreq = (char*) 0;
_argv = argv;
// 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)
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
/*!
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)
//%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; }
%};
%{
%}
%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);
#include <stdexcept>
- ob::Openbox *Openbox_instance() { return ob::Openbox::instance; }
+ ob::Openbox *Openbox_instance() { return ob::openbox; }
namespace ob {
#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);
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;
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;
}
}
(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;
}
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;
}
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,
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;
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;
// 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);
// 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);
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);
}
// 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);
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);
// 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);
} 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);
} 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);
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);
// 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);
// 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();
// 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);
// 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);
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);
}
// force the callbacks to fire
- if (!Openbox::instance->focusedClient())
- Openbox::instance->setFocusedClient(0);
+ if (!openbox->focusedClient())
+ openbox->setFocusedClient(0);
}
void Screen::changeNumDesktops(long num)
// 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);
// 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);
void Screen::updateDesktopNames()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
unsigned long num = (unsigned) -1;
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;
{
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;
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]);
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;