From: Dana Jansens Date: Mon, 13 Jan 2003 09:04:57 +0000 (+0000) Subject: use the new non-static display X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=cdcc526a0274cace9f542960fe4eee4ddcc23d31;p=chaz%2Fopenbox use the new non-static display --- diff --git a/src/actions.cc b/src/actions.cc index c3675cc3..10edeec2 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -84,7 +84,7 @@ void Actions::buttonPressHandler(const XButtonEvent &e) if (c) screen = c->screen(); 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(), MousePress); openbox->bindings()->fireButton(&data); @@ -122,7 +122,7 @@ void Actions::buttonReleaseHandler(const XButtonEvent &e) // find the area of the window XWindowAttributes attr; - if (!XGetWindowAttributes(otk::Display::display, e.window, &attr)) return; + if (!XGetWindowAttributes(**otk::display, e.window, &attr)) return; // if not on the window any more, it isnt a CLICK if (!(e.same_screen && e.x >= 0 && e.y >= 0 && @@ -138,7 +138,7 @@ void Actions::buttonReleaseHandler(const XButtonEvent &e) if (c) screen = c->screen(); 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(), MouseClick); openbox->bindings()->fireButton(&data); @@ -179,7 +179,7 @@ void Actions::enterHandler(const XCrossingEvent &e) if (c) screen = c->screen(); else - screen = otk::Display::findScreen(e.root)->screen(); + screen = otk::display->findScreen(e.root)->screen(); EventData data(screen, c, EventEnterWindow, e.state); openbox->bindings()->fireEvent(&data); } @@ -195,7 +195,7 @@ void Actions::leaveHandler(const XCrossingEvent &e) if (c) screen = c->screen(); else - screen = otk::Display::findScreen(e.root)->screen(); + screen = otk::display->findScreen(e.root)->screen(); EventData data(screen, c, EventLeaveWindow, e.state); openbox->bindings()->fireEvent(&data); } @@ -209,7 +209,7 @@ void Actions::keyPressHandler(const XKeyEvent &e) unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); openbox->bindings()-> - fireKey(otk::Display::findScreen(e.root)->screen(), + fireKey(otk::display->findScreen(e.root)->screen(), state, e.keycode, e.time); } @@ -224,9 +224,9 @@ void Actions::motionHandler(const XMotionEvent &e) // compress changes to a window into a single change XEvent ce; - while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) { + while (XCheckTypedEvent(**otk::display, e.type, &ce)) { if (ce.xmotion.window != e.window) { - XPutBackEvent(otk::Display::display, &ce); + XPutBackEvent(**otk::display, &ce); break; } else { x_root = e.x_root; @@ -248,7 +248,7 @@ void Actions::motionHandler(const XMotionEvent &e) if (c) screen = c->screen(); 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, x_root, y_root, _posqueue[0]->pos, _posqueue[0]->clientarea); openbox->bindings()->fireButton(&data); diff --git a/src/bindings.cc b/src/bindings.cc index 253e1383..83c9913f 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -98,7 +98,7 @@ bool Bindings::translate(const std::string &str, Binding &b,bool askey) const printf(_("Invalid Key name in key binding: %s\n"), key.c_str()); return false; } - if (!(b.key = XKeysymToKeycode(otk::Display::display, sym))) + if (!(b.key = XKeysymToKeycode(**otk::display, sym))) printf(_("No valid keycode for Key in key binding: %s\n"), key.c_str()); return b.key != 0; } else { @@ -244,14 +244,14 @@ bool Bindings::addKey(const StringVect &keylist, PyObject *callback) destroytree(tree); } else { // grab the server here to make sure no key pressed go missed - otk::Display::grab(); + otk::display->grab(); grabKeys(false); // assimilate this built tree into the main tree assimilate(tree); // assimilation destroys/uses the tree grabKeys(true); - otk::Display::ungrab(); + otk::display->ungrab(); } Py_INCREF(callback); @@ -277,7 +277,7 @@ bool Bindings::removeKey(const StringVect &keylist, PyObject *callback) callback); if (it != t->callbacks.end()) { // grab the server here to make sure no key pressed go missed - otk::Display::grab(); + otk::display->grab(); grabKeys(false); _curpos = &_keytree; @@ -286,7 +286,7 @@ bool Bindings::removeKey(const StringVect &keylist, PyObject *callback) Py_XDECREF(*it); grabKeys(true); - otk::Display::ungrab(); + otk::display->ungrab(); return true; } @@ -300,12 +300,12 @@ void Bindings::setResetKey(const std::string &key) Binding b(0, 0); if (translate(key, b)) { // grab the server here to make sure no key pressed go missed - otk::Display::grab(); + otk::display->grab(); grabKeys(false); _resetkey.key = b.key; _resetkey.modifiers = b.modifiers; grabKeys(true); - otk::Display::ungrab(); + otk::display->ungrab(); } } @@ -342,28 +342,28 @@ void Bindings::removeAllKeys() void Bindings::grabKeys(bool grab) { 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; while (p) { if (grab) { - otk::Display::grabKey(p->binding.key, p->binding.modifiers, + otk::display->grabKey(p->binding.key, p->binding.modifiers, root, false, GrabModeAsync, GrabModeAsync, false); } else - otk::Display::ungrabKey(p->binding.key, p->binding.modifiers, + otk::display->ungrabKey(p->binding.key, p->binding.modifiers, root); p = p->next_sibling; } if (_resetkey.key) if (grab) - otk::Display::grabKey(_resetkey.key, _resetkey.modifiers, + otk::display->grabKey(_resetkey.key, _resetkey.modifiers, root, false, GrabModeAsync, GrabModeAsync, false); else - otk::Display::ungrabKey(_resetkey.key, _resetkey.modifiers, + otk::display->ungrabKey(_resetkey.key, _resetkey.modifiers, root); } } @@ -381,11 +381,11 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key, if (p->chain) { _timer.start(); // start/restart the timer // grab the server here to make sure no key pressed go missed - otk::Display::grab(); + otk::display->grab(); grabKeys(false); _curpos = p; grabKeys(true); - otk::Display::ungrab(); + otk::display->ungrab(); } else { Client *c = openbox->focusedClient(); KeyData data(screen, c, time, modifiers, key); @@ -405,11 +405,11 @@ void Bindings::resetChains(Bindings *self) { self->_timer.stop(); // grab the server here to make sure no key pressed go missed - otk::Display::grab(); + otk::display->grab(); self->grabKeys(false); self->_curpos = &self->_keytree; self->grabKeys(true); - otk::Display::ungrab(); + otk::display->ungrab(); } @@ -500,10 +500,10 @@ void Bindings::grabButton(bool grab, const Binding &b, MouseContext context, return; } if (grab) - otk::Display::grabButton(b.key, b.modifiers, win, false, mask, mode, - GrabModeAsync, None, None, false); + otk::display->grabButton(b.key, b.modifiers, win, false, mask, mode, + GrabModeAsync, None, None, false); else - otk::Display::ungrabButton(b.key, b.modifiers, win); + otk::display->ungrabButton(b.key, b.modifiers, win); } void Bindings::grabButtons(bool grab, Client *client) @@ -519,7 +519,7 @@ void Bindings::fireButton(MouseData *data) { if (data->context == MC_Window) { // Replay the event, so it goes to the client, and ungrab the device. - XAllowEvents(otk::Display::display, ReplayPointer, data->time); + XAllowEvents(**otk::display, ReplayPointer, data->time); } ButtonBindingList::iterator it, end = _buttons[data->context].end(); @@ -541,7 +541,7 @@ bool Bindings::addEvent(EventAction action, PyObject *callback) } #ifdef XKB if (action == EventBell && _eventlist[action].empty()) - XkbSelectEvents(otk::Display::display, XkbUseCoreKbd, + XkbSelectEvents(**otk::display, XkbUseCoreKbd, XkbBellNotifyMask, XkbBellNotifyMask); #endif // XKB _eventlist[action].push_back(callback); @@ -563,7 +563,7 @@ bool Bindings::removeEvent(EventAction action, PyObject *callback) _eventlist[action].erase(it); #ifdef XKB if (action == EventBell && _eventlist[action].empty()) - XkbSelectEvents(otk::Display::display, XkbUseCoreKbd, + XkbSelectEvents(**otk::display, XkbUseCoreKbd, XkbBellNotifyMask, 0); #endif // XKB return true; diff --git a/src/buttonwidget.cc b/src/buttonwidget.cc index 59374c6e..52398d92 100644 --- a/src/buttonwidget.cc +++ b/src/buttonwidget.cc @@ -114,18 +114,18 @@ void ButtonWidget::update() *_style->getButtonPicUnfocus()); // set the clip region - XSetClipMask(otk::Display::display, pen.gc(), pm->mask); - XSetClipOrigin(otk::Display::display, pen.gc(), + XSetClipMask(**otk::display, pen.gc(), pm->mask); + XSetClipOrigin(**otk::display, pen.gc(), (width - pm->w)/2, (width - pm->h)/2); // fill in the clipped region - XFillRectangle(otk::Display::display, _window, pen.gc(), + XFillRectangle(**otk::display, _window, pen.gc(), (width - pm->w)/2, (width - pm->h)/2, (width + pm->w)/2, (width + pm->h)/2); // unset the clip region - XSetClipMask(otk::Display::display, pen.gc(), None); - XSetClipOrigin(otk::Display::display, pen.gc(), 0, 0); + XSetClipMask(**otk::display, pen.gc(), None); + XSetClipOrigin(**otk::display, pen.gc(), 0, 0); } } diff --git a/src/client.cc b/src/client.cc index 231992f1..df519050 100644 --- a/src/client.cc +++ b/src/client.cc @@ -273,7 +273,7 @@ void Client::getArea() XWindowAttributes wattrib; Status ret; - ret = XGetWindowAttributes(otk::Display::display, _window, &wattrib); + ret = XGetWindowAttributes(**otk::display, _window, &wattrib); assert(ret != BadWindow); _area.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height); @@ -332,14 +332,14 @@ void Client::getShaped() { _shaped = false; #ifdef SHAPE - if (otk::Display::shape()) { + if (otk::display->shape()) { int foo; unsigned int ufoo; int s; - XShapeSelectInput(otk::Display::display, _window, ShapeNotifyMask); + XShapeSelectInput(**otk::display, _window, ShapeNotifyMask); - XShapeQueryExtents(otk::Display::display, _window, &s, &foo, + XShapeQueryExtents(**otk::display, _window, &s, &foo, &foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo); _shaped = (s != 0); } @@ -385,7 +385,7 @@ void Client::updateProtocols() _decorations &= ~Decor_Close; _functions &= ~Func_Close; - if (XGetWMProtocols(otk::Display::display, _window, &proto, &num_return)) { + if (XGetWMProtocols(**otk::display, _window, &proto, &num_return)) { for (int i = 0; i < num_return; ++i) { if (proto[i] == property->atom(otk::Property::wm_delete_window)) { _decorations |= Decor_Close; @@ -419,7 +419,7 @@ void Client::updateNormalHints() // point.. // get the hints from the window - if (XGetWMNormalHints(otk::Display::display, _window, &size, &ret)) { + if (XGetWMNormalHints(**otk::display, _window, &size, &ret)) { _positioned = (size.flags & (PPosition|USPosition)); if (size.flags & PWinGravity) @@ -457,7 +457,7 @@ void Client::updateWMHints() _can_focus = true; _urgent = false; - if ((hints = XGetWMHints(otk::Display::display, _window)) != NULL) { + if ((hints = XGetWMHints(**otk::display, _window)) != NULL) { if (hints->flags & InputHint) _can_focus = hints->input; @@ -572,7 +572,7 @@ void Client::updateTransientFor() Window t = 0; Client *c = 0; - if (XGetTransientForHint(otk::Display::display, _window, &t) && + if (XGetTransientForHint(**otk::display, _window, &t) && t != _window) { // cant be transient to itself! c = openbox->findClient(t); assert(c != this); // if this happens then we need to check for it @@ -581,7 +581,7 @@ void Client::updateTransientFor() // not transient to a client, see if it is transient for a group if (//t == _group->leader() || t == None || - t == otk::Display::screenInfo(_screen)->rootWindow()) { + t == otk::display->screenInfo(_screen)->rootWindow()) { // window is a transient for its group! // XXX: for now this is treated as non-transient. // this needs to be fixed! @@ -610,11 +610,11 @@ void Client::propertyHandler(const XPropertyEvent &e) // compress changes to a single property into a single change XEvent ce; - while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) { + while (XCheckTypedEvent(**otk::display, e.type, &ce)) { // XXX: it would be nice to compress ALL changes to a property, not just // changes in a row without other props between. if (ce.xproperty.atom != e.atom) { - XPutBackEvent(otk::Display::display, &ce); + XPutBackEvent(**otk::display, &ce); break; } } @@ -850,12 +850,12 @@ void Client::toggleClientBorder(bool addborder) _area.setPos(x, y); if (addborder) { - XSetWindowBorderWidth(otk::Display::display, _window, _border_width); + XSetWindowBorderWidth(**otk::display, _window, _border_width); // move the client so it is back it the right spot _with_ its border! - XMoveWindow(otk::Display::display, _window, x, y); + XMoveWindow(**otk::display, _window, x, y); } else - XSetWindowBorderWidth(otk::Display::display, _window, 0); + XSetWindowBorderWidth(**otk::display, _window, 0); } @@ -871,11 +871,11 @@ void Client::clientMessageHandler(const XClientMessageEvent &e) // compress changes into a single change bool compress = false; XEvent ce; - while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) { + while (XCheckTypedEvent(**otk::display, e.type, &ce)) { // XXX: it would be nice to compress ALL messages of a type, not just // messages in a row without other message types between. if (ce.xclient.message_type != e.message_type) { - XPutBackEvent(otk::Display::display, &ce); + XPutBackEvent(**otk::display, &ce); break; } compress = true; @@ -889,11 +889,11 @@ void Client::clientMessageHandler(const XClientMessageEvent &e) // compress changes into a single change bool compress = false; XEvent ce; - while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) { + while (XCheckTypedEvent(**otk::display, e.type, &ce)) { // XXX: it would be nice to compress ALL messages of a type, not just // messages in a row without other message types between. if (ce.xclient.message_type != e.message_type) { - XPutBackEvent(otk::Display::display, &ce); + XPutBackEvent(**otk::display, &ce); break; } compress = true; @@ -998,7 +998,7 @@ void Client::resize(Corner anchor, int w, int h, int x, int y) _area.setSize(w, h); - XResizeWindow(otk::Display::display, _window, w, h); + XResizeWindow(**otk::display, _window, w, h); // resize the frame to match the request frame->adjustSize(); @@ -1018,7 +1018,7 @@ void Client::move(int x, int y) // yet) XEvent event; event.type = ConfigureNotify; - event.xconfigure.display = otk::Display::display; + event.xconfigure.display = **otk::display; event.xconfigure.event = _window; event.xconfigure.window = _window; event.xconfigure.x = x; @@ -1049,7 +1049,7 @@ void Client::close() ce.xclient.type = ClientMessage; ce.xclient.message_type = property->atom(otk::Property::wm_protocols); - ce.xclient.display = otk::Display::display; + ce.xclient.display = **otk::display; ce.xclient.window = _window; ce.xclient.format = 32; ce.xclient.data.l[0] = property->atom(otk::Property::wm_delete_window); @@ -1057,7 +1057,7 @@ void Client::close() ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; - XSendEvent(otk::Display::display, _window, false, NoEventMask, &ce); + XSendEvent(**otk::display, _window, false, NoEventMask, &ce); } @@ -1123,7 +1123,7 @@ bool Client::focus() const if (_focused) return true; if (_can_focus) - XSetInputFocus(otk::Display::display, _window, + XSetInputFocus(**otk::display, _window, RevertToNone, CurrentTime); if (_focus_notify) { @@ -1132,7 +1132,7 @@ bool Client::focus() const ce.xclient.type = ClientMessage; ce.xclient.message_type = property->atom(otk::Property::wm_protocols); - ce.xclient.display = otk::Display::display; + ce.xclient.display = **otk::display; ce.xclient.window = _window; ce.xclient.format = 32; ce.xclient.data.l[0] = property->atom(otk::Property::wm_take_focus); @@ -1140,7 +1140,7 @@ bool Client::focus() const ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; - XSendEvent(otk::Display::display, _window, False, NoEventMask, &ce); + XSendEvent(**otk::display, _window, False, NoEventMask, &ce); } return true; @@ -1308,7 +1308,7 @@ void Client::reparentHandler(const XReparentEvent &e) // server to deal with after we unmanage the window XEvent ev; ev.xreparent = e; - XPutBackEvent(otk::Display::display, &ev); + XPutBackEvent(**otk::display, &ev); // this deletes us etc openbox->screen(_screen)->unmanageWindow(this); diff --git a/src/frame.cc b/src/frame.cc index 35634b4c..e85ff345 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -27,7 +27,7 @@ Frame::Frame(Client *client, otk::Style *style) : otk::Widget(openbox, style, Horizontal, 0, 1, true), WidgetBase(WidgetBase::Type_Frame), _client(client), - _screen(otk::Display::screenInfo(client->screen())), + _screen(otk::display->screenInfo(client->screen())), _plate(this, WidgetBase::Type_Plate), _titlebar(this, WidgetBase::Type_Titlebar), _button_close(&_titlebar, WidgetBase::Type_CloseButton), @@ -43,7 +43,7 @@ Frame::Frame(Client *client, otk::Style *style) assert(client); assert(style); - XSelectInput(otk::Display::display, _window, Frame::event_mask); + XSelectInput(**otk::display, _window, Frame::event_mask); _grip_left.setCursor(openbox->cursors().ll_angle); _grip_right.setCursor(openbox->cursors().lr_angle); @@ -361,13 +361,13 @@ void Frame::adjustShape() if (!_client->shaped()) { // clear the shape on the frame window - XShapeCombineMask(otk::Display::display, _window, ShapeBounding, + XShapeCombineMask(**otk::display, _window, ShapeBounding, _innersize.left, _innersize.top, None, ShapeSet); } else { // make the frame's shape match the clients - XShapeCombineShape(otk::Display::display, _window, ShapeBounding, + XShapeCombineShape(**otk::display, _window, ShapeBounding, _innersize.left, _innersize.top, _client->window(), ShapeBounding, ShapeSet); @@ -391,7 +391,7 @@ void Frame::adjustShape() ++num; } - XShapeCombineRectangles(otk::Display::display, window(), + XShapeCombineRectangles(**otk::display, window(), ShapeBounding, 0, 0, xrect, num, ShapeUnion, Unsorted); } @@ -402,7 +402,7 @@ void Frame::adjustShape() void Frame::grabClient() { // reparent the client to the frame - XReparentWindow(otk::Display::display, _client->window(), + XReparentWindow(**otk::display, _client->window(), _plate.window(), 0, 0); /* When reparenting the client window, it is usually not mapped yet, since @@ -416,11 +416,11 @@ void Frame::grabClient() _client->ignore_unmaps += 2; // select the event mask on the client's parent (to receive config req's) - XSelectInput(otk::Display::display, _plate.window(), + XSelectInput(**otk::display, _plate.window(), SubstructureRedirectMask); // map the client so it maps when the frame does - XMapWindow(otk::Display::display, _client->window()); + XMapWindow(**otk::display, _client->window()); adjustSize(); adjustPosition(); @@ -432,15 +432,15 @@ void Frame::releaseClient() XEvent ev; // check if the app has already reparented its window away - if (XCheckTypedWindowEvent(otk::Display::display, _client->window(), + if (XCheckTypedWindowEvent(**otk::display, _client->window(), ReparentNotify, &ev)) { - XPutBackEvent(otk::Display::display, &ev); + XPutBackEvent(**otk::display, &ev); // re-map the window since the unmanaging process unmaps it - XMapWindow(otk::Display::display, _client->window()); + XMapWindow(**otk::display, _client->window()); } else { // according to the ICCCM - if the client doesn't reparent itself, then we // will reparent the window to root for them - XReparentWindow(otk::Display::display, _client->window(), + XReparentWindow(**otk::display, _client->window(), _screen->rootWindow(), _client->area().x(), _client->area().y()); } diff --git a/src/labelwidget.cc b/src/labelwidget.cc index 16c8eae2..d76bd3f1 100644 --- a/src/labelwidget.cc +++ b/src/labelwidget.cc @@ -14,8 +14,8 @@ LabelWidget::LabelWidget(otk::Widget *parent, WidgetBase::WidgetType type) : otk::Widget(parent), WidgetBase(type) { - const otk::ScreenInfo *info = otk::Display::screenInfo(_screen); - _xftdraw = XftDrawCreate(otk::Display::display, _window, info->visual(), + const otk::ScreenInfo *info = otk::display->screenInfo(_screen); + _xftdraw = XftDrawCreate(**otk::display, _window, info->visual(), info->colormap()); } diff --git a/src/openbox.cc b/src/openbox.cc index 0b3148e8..2f089891 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -11,7 +11,6 @@ #include "bindings.hh" #include "python.hh" #include "otk/property.hh" -#include "otk/display.hh" #include "otk/assassin.hh" #include "otk/util.hh" @@ -80,7 +79,8 @@ void Openbox::signalHandler(int signal) Openbox::Openbox(int argc, char **argv) : otk::EventDispatcher(), - otk::EventHandler() + otk::EventHandler(), + _display() { struct sigaction action; @@ -99,11 +99,7 @@ Openbox::Openbox(int argc, char **argv) parseCommandLine(argc, argv); - // open the X display (and gets some info about it, and its screens) - otk::Display::initialize(_displayreq); - assert(otk::Display::display); - - XSynchronize(otk::Display::display, _sync); + XSynchronize(**otk::display, _sync); // set up the signal handler action.sa_handler = Openbox::signalHandler; @@ -124,12 +120,12 @@ Openbox::Openbox(int argc, char **argv) setMasterHandler(_actions); // set as the master event handler // create the mouse cursors we'll use - _cursors.session = XCreateFontCursor(otk::Display::display, XC_left_ptr); - _cursors.move = XCreateFontCursor(otk::Display::display, XC_fleur); - _cursors.ll_angle = XCreateFontCursor(otk::Display::display, XC_ll_angle); - _cursors.lr_angle = XCreateFontCursor(otk::Display::display, XC_lr_angle); - _cursors.ul_angle = XCreateFontCursor(otk::Display::display, XC_ul_angle); - _cursors.ur_angle = XCreateFontCursor(otk::Display::display, XC_ur_angle); + _cursors.session = XCreateFontCursor(**otk::display, XC_left_ptr); + _cursors.move = XCreateFontCursor(**otk::display, XC_fleur); + _cursors.ll_angle = XCreateFontCursor(**otk::display, XC_ll_angle); + _cursors.lr_angle = XCreateFontCursor(**otk::display, XC_lr_angle); + _cursors.ul_angle = XCreateFontCursor(**otk::display, XC_ul_angle); + _cursors.ur_angle = XCreateFontCursor(**otk::display, XC_ur_angle); // initialize scripting python_init(argv[0]); @@ -144,8 +140,8 @@ Openbox::Openbox(int argc, char **argv) // initialize all the screens Screen *screen; - int i = _single ? DefaultScreen(otk::Display::display) : 0; - int max = _single ? i + 1 : ScreenCount(otk::Display::display); + int i = _single ? DefaultScreen(**otk::display) : 0; + int max = _single ? i + 1 : ScreenCount(**otk::display); for (; i < max; ++i) { screen = new Screen(i); if (screen->managed()) @@ -189,19 +185,19 @@ Openbox::~Openbox() python_destroy(); - XSetInputFocus(otk::Display::display, PointerRoot, RevertToNone, + XSetInputFocus(**otk::display, PointerRoot, RevertToNone, CurrentTime); - XSync(otk::Display::display, false); + XSync(**otk::display, false); // this tends to block.. i honestly am not sure why. causing an x error in // the shutdown process unblocks it. blackbox simply did a ::exit(0), so // all im gunna do is the same. - //otk::Display::destroy(); + //otk::display->destroy(); if (_restart) { if (!_restart_prog.empty()) { const std::string &dstr = - otk::Display::screenInfo(first_screen)->displayString(); + otk::display->screenInfo(first_screen)->displayString(); otk::putenv(const_cast(dstr.c_str())); execlp(_restart_prog.c_str(), _restart_prog.c_str(), NULL); perror(_restart_prog.c_str()); @@ -321,7 +317,7 @@ void Openbox::eventLoop() { while (true) { dispatchEvents(); // from otk::EventDispatcher - XFlush(otk::Display::display); // flush here before we go wait for timers + XFlush(**otk::display); // flush here before we go wait for timers // don't wait if we're to shutdown if (_shutdown) break; _timermanager.fire(!_sync); // wait if not in sync mode @@ -363,14 +359,14 @@ void Openbox::setFocusedClient(Client *c) _focused_screen = _screens[c->screen()]; } else { assert(_focused_screen); - XSetInputFocus(otk::Display::display, _focused_screen->focuswindow(), + XSetInputFocus(**otk::display, _focused_screen->focuswindow(), RevertToNone, CurrentTime); } // set the NET_ACTIVE_WINDOW hint for all screens ScreenList::iterator it, end = _screens.end(); for (it = _screens.begin(); it != end; ++it) { int num = (*it)->number(); - Window root = otk::Display::screenInfo(num)->rootWindow(); + Window root = otk::display->screenInfo(num)->rootWindow(); _property->set(root, otk::Property::net_active_window, otk::Property::Atom_Window, (c && _focused_screen == *it) ? c->window() : None); @@ -383,9 +379,9 @@ void Openbox::setFocusedClient(Client *c) void Openbox::execute(int screen, const std::string &bin) { - if (screen >= ScreenCount(otk::Display::display)) + if (screen >= ScreenCount(**otk::display)) screen = 0; - otk::bexec(bin, otk::Display::screenInfo(screen)->displayString()); + otk::bexec(bin, otk::display->screenInfo(screen)->displayString()); } } diff --git a/src/openbox.hh b/src/openbox.hh index 9001db60..fe49df15 100644 --- a/src/openbox.hh +++ b/src/openbox.hh @@ -14,6 +14,7 @@ extern "C" { #include #include +#include "otk/display.hh" #include "otk/screeninfo.hh" #include "otk/timerqueuemanager.hh" #include "otk/property.hh" @@ -74,6 +75,9 @@ public: typedef std::vector ScreenList; private: + //! The display on which Openbox is running + otk::Display _display; + // stuff that can be passed on the command line //! Path to the config file to use/in use /*! diff --git a/src/openbox.i b/src/openbox.i index 59dbecdd..ef86b9bc 100644 --- a/src/openbox.i +++ b/src/openbox.i @@ -90,6 +90,8 @@ void python_callback(PyObject *func, KeyData *data) } %} +#ignore ob::openbox; + %ignore ob::Screen::clients; %{ #include @@ -107,10 +109,7 @@ void python_callback(PyObject *func, KeyData *data) } }; -%ignore otk::Display::display; -%inline %{ - Display *Display_display() { return otk::Display::display; } -%}; +%ignore otk::display; %include "../otk/ustring.i" diff --git a/src/openbox.py b/src/openbox.py index 0aacf7ec..1f263d30 100644 --- a/src/openbox.py +++ b/src/openbox.py @@ -29,50 +29,35 @@ except AttributeError: Openbox_instance = _openbox.Openbox_instance -Display_display = _openbox.Display_display - class Display(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, Display, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, Display, name) - __swig_getmethods__["initialize"] = lambda x: _openbox.Display_initialize - if _newclass:initialize = staticmethod(_openbox.Display_initialize) - __swig_getmethods__["destroy"] = lambda x: _openbox.Display_destroy - if _newclass:destroy = staticmethod(_openbox.Display_destroy) - __swig_getmethods__["gcCache"] = lambda x: _openbox.Display_gcCache - if _newclass:gcCache = staticmethod(_openbox.Display_gcCache) - __swig_getmethods__["screenInfo"] = lambda x: _openbox.Display_screenInfo - if _newclass:screenInfo = staticmethod(_openbox.Display_screenInfo) - __swig_getmethods__["findScreen"] = lambda x: _openbox.Display_findScreen - if _newclass:findScreen = staticmethod(_openbox.Display_findScreen) - __swig_getmethods__["xkb"] = lambda x: _openbox.Display_xkb - if _newclass:xkb = staticmethod(_openbox.Display_xkb) - __swig_getmethods__["xkbEventBase"] = lambda x: _openbox.Display_xkbEventBase - if _newclass:xkbEventBase = staticmethod(_openbox.Display_xkbEventBase) - __swig_getmethods__["shape"] = lambda x: _openbox.Display_shape - if _newclass:shape = staticmethod(_openbox.Display_shape) - __swig_getmethods__["shapeEventBase"] = lambda x: _openbox.Display_shapeEventBase - if _newclass:shapeEventBase = staticmethod(_openbox.Display_shapeEventBase) - __swig_getmethods__["xinerama"] = lambda x: _openbox.Display_xinerama - if _newclass:xinerama = staticmethod(_openbox.Display_xinerama) - __swig_getmethods__["numLockMask"] = lambda x: _openbox.Display_numLockMask - if _newclass:numLockMask = staticmethod(_openbox.Display_numLockMask) - __swig_getmethods__["scrollLockMask"] = lambda x: _openbox.Display_scrollLockMask - if _newclass:scrollLockMask = staticmethod(_openbox.Display_scrollLockMask) - __swig_getmethods__["grab"] = lambda x: _openbox.Display_grab - if _newclass:grab = staticmethod(_openbox.Display_grab) - __swig_getmethods__["ungrab"] = lambda x: _openbox.Display_ungrab - if _newclass:ungrab = staticmethod(_openbox.Display_ungrab) - __swig_getmethods__["grabButton"] = lambda x: _openbox.Display_grabButton - if _newclass:grabButton = staticmethod(_openbox.Display_grabButton) - __swig_getmethods__["ungrabButton"] = lambda x: _openbox.Display_ungrabButton - if _newclass:ungrabButton = staticmethod(_openbox.Display_ungrabButton) - __swig_getmethods__["grabKey"] = lambda x: _openbox.Display_grabKey - if _newclass:grabKey = staticmethod(_openbox.Display_grabKey) - __swig_getmethods__["ungrabKey"] = lambda x: _openbox.Display_ungrabKey - if _newclass:ungrabKey = staticmethod(_openbox.Display_ungrabKey) - def __init__(self): raise RuntimeError, "No constructor defined" + def __init__(self,*args): + self.this = apply(_openbox.new_Display,args) + self.thisown = 1 + def __del__(self, destroy= _openbox.delete_Display): + try: + if self.thisown: destroy(self) + except: pass + def gcCache(*args): return apply(_openbox.Display_gcCache,args) + def screenInfo(*args): return apply(_openbox.Display_screenInfo,args) + def findScreen(*args): return apply(_openbox.Display_findScreen,args) + def xkb(*args): return apply(_openbox.Display_xkb,args) + def xkbEventBase(*args): return apply(_openbox.Display_xkbEventBase,args) + def shape(*args): return apply(_openbox.Display_shape,args) + def shapeEventBase(*args): return apply(_openbox.Display_shapeEventBase,args) + def xinerama(*args): return apply(_openbox.Display_xinerama,args) + def numLockMask(*args): return apply(_openbox.Display_numLockMask,args) + def scrollLockMask(*args): return apply(_openbox.Display_scrollLockMask,args) + def __mul__(*args): return apply(_openbox.Display___mul__,args) + def grab(*args): return apply(_openbox.Display_grab,args) + def ungrab(*args): return apply(_openbox.Display_ungrab,args) + def grabButton(*args): return apply(_openbox.Display_grabButton,args) + def ungrabButton(*args): return apply(_openbox.Display_ungrabButton,args) + def grabKey(*args): return apply(_openbox.Display_grabKey,args) + def ungrabKey(*args): return apply(_openbox.Display_ungrabKey,args) def __repr__(self): return "" % (self.this,) @@ -82,42 +67,6 @@ class DisplayPtr(Display): if not hasattr(self,"thisown"): self.thisown = 0 self.__class__ = Display _openbox.Display_swigregister(DisplayPtr) -Display_initialize = _openbox.Display_initialize - -Display_destroy = _openbox.Display_destroy - -Display_gcCache = _openbox.Display_gcCache - -Display_screenInfo = _openbox.Display_screenInfo - -Display_findScreen = _openbox.Display_findScreen - -Display_xkb = _openbox.Display_xkb - -Display_xkbEventBase = _openbox.Display_xkbEventBase - -Display_shape = _openbox.Display_shape - -Display_shapeEventBase = _openbox.Display_shapeEventBase - -Display_xinerama = _openbox.Display_xinerama - -Display_numLockMask = _openbox.Display_numLockMask - -Display_scrollLockMask = _openbox.Display_scrollLockMask - -Display_grab = _openbox.Display_grab - -Display_ungrab = _openbox.Display_ungrab - -Display_grabButton = _openbox.Display_grabButton - -Display_ungrabButton = _openbox.Display_ungrabButton - -Display_grabKey = _openbox.Display_grabKey - -Display_ungrabKey = _openbox.Display_ungrabKey - class Point(_object): __swig_setmethods__ = {} diff --git a/src/openbox_wrap.cc b/src/openbox_wrap.cc index d098ed8b..4a66d956 100644 --- a/src/openbox_wrap.cc +++ b/src/openbox_wrap.cc @@ -679,8 +679,8 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { #define SWIGTYPE_p_otk__ustring swig_types[31] #define SWIGTYPE_p_std__string swig_types[32] #define SWIGTYPE_p_XCrossingEvent swig_types[33] -#define SWIGTYPE_p_Display swig_types[34] -#define SWIGTYPE_p_otk__Display swig_types[35] +#define SWIGTYPE_p_otk__Display swig_types[34] +#define SWIGTYPE_p_Display swig_types[35] #define SWIGTYPE_p_XMappingEvent swig_types[36] #define SWIGTYPE_p_otk__Style swig_types[37] #define SWIGTYPE_p_otk__EventHandler swig_types[38] @@ -883,9 +883,6 @@ void python_callback(PyObject *func, KeyData *data) #include - Display *Display_display() { return otk::Display::display; } - - #include "ustring.hh" ob::Client *ob_Screen_client(ob::Screen *self,int i){ @@ -915,39 +912,28 @@ static PyObject *_wrap_Openbox_instance(PyObject *self, PyObject *args) { } -static PyObject *_wrap_Display_display(PyObject *self, PyObject *args) { - PyObject *resultobj; - Display *result; - - if(!PyArg_ParseTuple(args,(char *)":Display_display")) goto fail; - result = (Display *)Display_display(); - - resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_Display, 0); - return resultobj; - fail: - return NULL; -} - - -static PyObject *_wrap_Display_initialize(PyObject *self, PyObject *args) { +static PyObject *_wrap_new_Display(PyObject *self, PyObject *args) { PyObject *resultobj; - char *arg1 ; + otk::Display *result; - if(!PyArg_ParseTuple(args,(char *)"s:Display_initialize",&arg1)) goto fail; - otk::Display::initialize(arg1); + if(!PyArg_ParseTuple(args,(char *)":new_Display")) goto fail; + result = (otk::Display *)new otk::Display(); - Py_INCREF(Py_None); resultobj = Py_None; + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__Display, 1); return resultobj; fail: return NULL; } -static PyObject *_wrap_Display_destroy(PyObject *self, PyObject *args) { +static PyObject *_wrap_delete_Display(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_destroy")) goto fail; - otk::Display::destroy(); + if(!PyArg_ParseTuple(args,(char *)"O:delete_Display",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + delete arg1; Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -958,10 +944,13 @@ static PyObject *_wrap_Display_destroy(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_gcCache(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; otk::GCCache *result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_gcCache")) goto fail; - result = (otk::GCCache *)otk::Display::gcCache(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_gcCache",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (otk::GCCache *)((otk::Display const *)arg1)->gcCache(); resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__GCCache, 0); return resultobj; @@ -972,11 +961,14 @@ static PyObject *_wrap_Display_gcCache(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_screenInfo(PyObject *self, PyObject *args) { PyObject *resultobj; - int arg1 ; + otk::Display *arg1 = (otk::Display *) 0 ; + int arg2 ; otk::ScreenInfo *result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"i:Display_screenInfo",&arg1)) goto fail; - result = (otk::ScreenInfo *)otk::Display::screenInfo(arg1); + if(!PyArg_ParseTuple(args,(char *)"Oi:Display_screenInfo",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (otk::ScreenInfo *)(arg1)->screenInfo(arg2); resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__ScreenInfo, 0); return resultobj; @@ -987,14 +979,17 @@ static PyObject *_wrap_Display_screenInfo(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_findScreen(PyObject *self, PyObject *args) { PyObject *resultobj; - Window arg1 ; + otk::Display *arg1 = (otk::Display *) 0 ; + Window arg2 ; otk::ScreenInfo *result; PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"O:Display_findScreen",&obj0)) goto fail; - arg1 = (Window) PyInt_AsLong(obj0); + if(!PyArg_ParseTuple(args,(char *)"OO:Display_findScreen",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (Window) PyInt_AsLong(obj1); if (PyErr_Occurred()) SWIG_fail; - result = (otk::ScreenInfo *)otk::Display::findScreen(arg1); + result = (otk::ScreenInfo *)(arg1)->findScreen(arg2); resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__ScreenInfo, 0); return resultobj; @@ -1005,10 +1000,13 @@ static PyObject *_wrap_Display_findScreen(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_xkb(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; bool result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_xkb")) goto fail; - result = (bool)otk::Display::xkb(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_xkb",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (bool)((otk::Display const *)arg1)->xkb(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1019,10 +1017,13 @@ static PyObject *_wrap_Display_xkb(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_xkbEventBase(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; int result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_xkbEventBase")) goto fail; - result = (int)otk::Display::xkbEventBase(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_xkbEventBase",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int)((otk::Display const *)arg1)->xkbEventBase(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1033,10 +1034,13 @@ static PyObject *_wrap_Display_xkbEventBase(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_shape(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; bool result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_shape")) goto fail; - result = (bool)otk::Display::shape(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_shape",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (bool)((otk::Display const *)arg1)->shape(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1047,10 +1051,13 @@ static PyObject *_wrap_Display_shape(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_shapeEventBase(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; int result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_shapeEventBase")) goto fail; - result = (int)otk::Display::shapeEventBase(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_shapeEventBase",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int)((otk::Display const *)arg1)->shapeEventBase(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1061,10 +1068,13 @@ static PyObject *_wrap_Display_shapeEventBase(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_xinerama(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; bool result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_xinerama")) goto fail; - result = (bool)otk::Display::xinerama(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_xinerama",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (bool)((otk::Display const *)arg1)->xinerama(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1075,10 +1085,13 @@ static PyObject *_wrap_Display_xinerama(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_numLockMask(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; unsigned int result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_numLockMask")) goto fail; - result = (unsigned int)otk::Display::numLockMask(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_numLockMask",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int)((otk::Display const *)arg1)->numLockMask(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1089,10 +1102,13 @@ static PyObject *_wrap_Display_numLockMask(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_scrollLockMask(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; unsigned int result; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_scrollLockMask")) goto fail; - result = (unsigned int)otk::Display::scrollLockMask(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_scrollLockMask",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int)((otk::Display const *)arg1)->scrollLockMask(); resultobj = PyInt_FromLong((long)result); return resultobj; @@ -1101,11 +1117,31 @@ static PyObject *_wrap_Display_scrollLockMask(PyObject *self, PyObject *args) { } +static PyObject *_wrap_Display___mul__(PyObject *self, PyObject *args) { + PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; + Display *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:Display___mul__",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (Display *)((otk::Display const *)arg1)->operator *(); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_Display, 0); + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_Display_grab(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_grab")) goto fail; - otk::Display::grab(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_grab",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + (arg1)->grab(); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -1116,9 +1152,12 @@ static PyObject *_wrap_Display_grab(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_ungrab(PyObject *self, PyObject *args) { PyObject *resultobj; + otk::Display *arg1 = (otk::Display *) 0 ; + PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)":Display_ungrab")) goto fail; - otk::Display::ungrab(); + if(!PyArg_ParseTuple(args,(char *)"O:Display_ungrab",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + (arg1)->ungrab(); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -1129,43 +1168,46 @@ static PyObject *_wrap_Display_ungrab(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_grabButton(PyObject *self, PyObject *args) { PyObject *resultobj; - unsigned int arg1 ; + otk::Display *arg1 = (otk::Display *) 0 ; unsigned int arg2 ; - Window arg3 ; - bool arg4 ; - unsigned int arg5 ; - int arg6 ; + unsigned int arg3 ; + Window arg4 ; + bool arg5 ; + unsigned int arg6 ; int arg7 ; - Window arg8 ; - Cursor arg9 ; - bool arg10 ; + int arg8 ; + Window arg9 ; + Cursor arg10 ; + bool arg11 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - PyObject * obj7 = 0 ; + PyObject * obj5 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOOOOiiOOO:Display_grabButton",&obj0,&obj1,&obj2,&obj3,&obj4,&arg6,&arg7,&obj7,&obj8,&obj9)) goto fail; - arg1 = (unsigned int) PyInt_AsLong(obj0); - if (PyErr_Occurred()) SWIG_fail; + if(!PyArg_ParseTuple(args,(char *)"OOOOOOiiOOO:Display_grabButton",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&arg7,&arg8,&obj8,&obj9,&obj10)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; arg2 = (unsigned int) PyInt_AsLong(obj1); if (PyErr_Occurred()) SWIG_fail; - arg3 = (Window) PyInt_AsLong(obj2); + arg3 = (unsigned int) PyInt_AsLong(obj2); if (PyErr_Occurred()) SWIG_fail; - arg4 = (bool) PyInt_AsLong(obj3); + arg4 = (Window) PyInt_AsLong(obj3); if (PyErr_Occurred()) SWIG_fail; - arg5 = (unsigned int) PyInt_AsLong(obj4); + arg5 = (bool) PyInt_AsLong(obj4); if (PyErr_Occurred()) SWIG_fail; - arg8 = (Window) PyInt_AsLong(obj7); + arg6 = (unsigned int) PyInt_AsLong(obj5); if (PyErr_Occurred()) SWIG_fail; - arg9 = (Cursor) PyInt_AsLong(obj8); + arg9 = (Window) PyInt_AsLong(obj8); if (PyErr_Occurred()) SWIG_fail; - arg10 = (bool) PyInt_AsLong(obj9); + arg10 = (Cursor) PyInt_AsLong(obj9); if (PyErr_Occurred()) SWIG_fail; - otk::Display::grabButton(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); + arg11 = (bool) PyInt_AsLong(obj10); + if (PyErr_Occurred()) SWIG_fail; + ((otk::Display const *)arg1)->grabButton(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -1176,21 +1218,24 @@ static PyObject *_wrap_Display_grabButton(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_ungrabButton(PyObject *self, PyObject *args) { PyObject *resultobj; - unsigned int arg1 ; + otk::Display *arg1 = (otk::Display *) 0 ; unsigned int arg2 ; - Window arg3 ; + unsigned int arg3 ; + Window arg4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:Display_ungrabButton",&obj0,&obj1,&obj2)) goto fail; - arg1 = (unsigned int) PyInt_AsLong(obj0); - if (PyErr_Occurred()) SWIG_fail; + if(!PyArg_ParseTuple(args,(char *)"OOOO:Display_ungrabButton",&obj0,&obj1,&obj2,&obj3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; arg2 = (unsigned int) PyInt_AsLong(obj1); if (PyErr_Occurred()) SWIG_fail; - arg3 = (Window) PyInt_AsLong(obj2); + arg3 = (unsigned int) PyInt_AsLong(obj2); + if (PyErr_Occurred()) SWIG_fail; + arg4 = (Window) PyInt_AsLong(obj3); if (PyErr_Occurred()) SWIG_fail; - otk::Display::ungrabButton(arg1,arg2,arg3); + ((otk::Display const *)arg1)->ungrabButton(arg2,arg3,arg4); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -1201,31 +1246,34 @@ static PyObject *_wrap_Display_ungrabButton(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_grabKey(PyObject *self, PyObject *args) { PyObject *resultobj; - unsigned int arg1 ; + otk::Display *arg1 = (otk::Display *) 0 ; unsigned int arg2 ; - Window arg3 ; - bool arg4 ; - int arg5 ; + unsigned int arg3 ; + Window arg4 ; + bool arg5 ; int arg6 ; - bool arg7 ; + int arg7 ; + bool arg8 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; - PyObject * obj6 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj7 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOOOiiO:Display_grabKey",&obj0,&obj1,&obj2,&obj3,&arg5,&arg6,&obj6)) goto fail; - arg1 = (unsigned int) PyInt_AsLong(obj0); - if (PyErr_Occurred()) SWIG_fail; + if(!PyArg_ParseTuple(args,(char *)"OOOOOiiO:Display_grabKey",&obj0,&obj1,&obj2,&obj3,&obj4,&arg6,&arg7,&obj7)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; arg2 = (unsigned int) PyInt_AsLong(obj1); if (PyErr_Occurred()) SWIG_fail; - arg3 = (Window) PyInt_AsLong(obj2); + arg3 = (unsigned int) PyInt_AsLong(obj2); if (PyErr_Occurred()) SWIG_fail; - arg4 = (bool) PyInt_AsLong(obj3); + arg4 = (Window) PyInt_AsLong(obj3); if (PyErr_Occurred()) SWIG_fail; - arg7 = (bool) PyInt_AsLong(obj6); + arg5 = (bool) PyInt_AsLong(obj4); if (PyErr_Occurred()) SWIG_fail; - otk::Display::grabKey(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + arg8 = (bool) PyInt_AsLong(obj7); + if (PyErr_Occurred()) SWIG_fail; + ((otk::Display const *)arg1)->grabKey(arg2,arg3,arg4,arg5,arg6,arg7,arg8); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -1236,21 +1284,24 @@ static PyObject *_wrap_Display_grabKey(PyObject *self, PyObject *args) { static PyObject *_wrap_Display_ungrabKey(PyObject *self, PyObject *args) { PyObject *resultobj; - unsigned int arg1 ; + otk::Display *arg1 = (otk::Display *) 0 ; unsigned int arg2 ; - Window arg3 ; + unsigned int arg3 ; + Window arg4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:Display_ungrabKey",&obj0,&obj1,&obj2)) goto fail; - arg1 = (unsigned int) PyInt_AsLong(obj0); - if (PyErr_Occurred()) SWIG_fail; + if(!PyArg_ParseTuple(args,(char *)"OOOO:Display_ungrabKey",&obj0,&obj1,&obj2,&obj3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Display,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; arg2 = (unsigned int) PyInt_AsLong(obj1); if (PyErr_Occurred()) SWIG_fail; - arg3 = (Window) PyInt_AsLong(obj2); + arg3 = (unsigned int) PyInt_AsLong(obj2); if (PyErr_Occurred()) SWIG_fail; - otk::Display::ungrabKey(arg1,arg2,arg3); + arg4 = (Window) PyInt_AsLong(obj3); + if (PyErr_Occurred()) SWIG_fail; + ((otk::Display const *)arg1)->ungrabKey(arg2,arg3,arg4); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; @@ -7902,9 +7953,8 @@ static PyObject *_wrap_send_client_msg(PyObject *self, PyObject *args) { static PyMethodDef SwigMethods[] = { { (char *)"Openbox_instance", _wrap_Openbox_instance, METH_VARARGS }, - { (char *)"Display_display", _wrap_Display_display, METH_VARARGS }, - { (char *)"Display_initialize", _wrap_Display_initialize, METH_VARARGS }, - { (char *)"Display_destroy", _wrap_Display_destroy, METH_VARARGS }, + { (char *)"new_Display", _wrap_new_Display, METH_VARARGS }, + { (char *)"delete_Display", _wrap_delete_Display, METH_VARARGS }, { (char *)"Display_gcCache", _wrap_Display_gcCache, METH_VARARGS }, { (char *)"Display_screenInfo", _wrap_Display_screenInfo, METH_VARARGS }, { (char *)"Display_findScreen", _wrap_Display_findScreen, METH_VARARGS }, @@ -7915,6 +7965,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Display_xinerama", _wrap_Display_xinerama, METH_VARARGS }, { (char *)"Display_numLockMask", _wrap_Display_numLockMask, METH_VARARGS }, { (char *)"Display_scrollLockMask", _wrap_Display_scrollLockMask, METH_VARARGS }, + { (char *)"Display___mul__", _wrap_Display___mul__, METH_VARARGS }, { (char *)"Display_grab", _wrap_Display_grab, METH_VARARGS }, { (char *)"Display_ungrab", _wrap_Display_ungrab, METH_VARARGS }, { (char *)"Display_grabButton", _wrap_Display_grabButton, METH_VARARGS }, @@ -8257,8 +8308,8 @@ static swig_type_info _swigt__p_XRectangle[] = {{"_p_XRectangle", 0, "XRectangle static swig_type_info _swigt__p_otk__ustring[] = {{"_p_otk__ustring", 0, "otk::ustring *", 0},{"_p_otk__ustring"},{0}}; static swig_type_info _swigt__p_std__string[] = {{"_p_std__string", 0, "std::string *", 0},{"_p_std__string"},{0}}; static swig_type_info _swigt__p_XCrossingEvent[] = {{"_p_XCrossingEvent", 0, "XCrossingEvent *", 0},{"_p_XCrossingEvent"},{0}}; -static swig_type_info _swigt__p_Display[] = {{"_p_Display", 0, "Display *", 0},{"_p_Display"},{0}}; static swig_type_info _swigt__p_otk__Display[] = {{"_p_otk__Display", 0, "otk::Display *", 0},{"_p_otk__Display"},{0}}; +static swig_type_info _swigt__p_Display[] = {{"_p_Display", 0, "Display *", 0},{"_p_Display"},{0}}; static swig_type_info _swigt__p_XMappingEvent[] = {{"_p_XMappingEvent", 0, "XMappingEvent *", 0},{"_p_XMappingEvent"},{0}}; static swig_type_info _swigt__p_otk__Style[] = {{"_p_otk__Style", 0, "otk::Style *", 0},{"_p_otk__Style"},{0}}; static swig_type_info _swigt__p_otk__EventHandler[] = {{"_p_otk__EventHandler", 0, "otk::EventHandler *", 0},{"_p_ob__Client", _p_ob__ClientTo_p_otk__EventHandler},{"_p_ob__Actions", _p_ob__ActionsTo_p_otk__EventHandler},{"_p_otk__EventHandler"},{"_p_ob__Openbox", _p_ob__OpenboxTo_p_otk__EventHandler},{"_p_ob__Screen", _p_ob__ScreenTo_p_otk__EventHandler},{0}}; @@ -8321,8 +8372,8 @@ _swigt__p_XRectangle, _swigt__p_otk__ustring, _swigt__p_std__string, _swigt__p_XCrossingEvent, -_swigt__p_Display, _swigt__p_otk__Display, +_swigt__p_Display, _swigt__p_XMappingEvent, _swigt__p_otk__Style, _swigt__p_otk__EventHandler, diff --git a/src/python.cc b/src/python.cc index 912f196d..12e74eee 100644 --- a/src/python.cc +++ b/src/python.cc @@ -213,7 +213,7 @@ PyObject *send_client_msg(Window target, int type, Window about, e.xclient.data.l[3] = data3; e.xclient.data.l[4] = data4; - XSendEvent(otk::Display::display, target, false, + XSendEvent(**otk::display, target, false, SubstructureRedirectMask | SubstructureNotifyMask, &e); Py_INCREF(Py_None); return Py_None; diff --git a/src/python.hh b/src/python.hh index c346f928..a2cfa366 100644 --- a/src/python.hh +++ b/src/python.hh @@ -154,7 +154,7 @@ public: this->client = client; this->time = time; this->state = state; - this->key = XKeysymToString(XKeycodeToKeysym(otk::Display::display, + this->key = XKeysymToString(XKeycodeToKeysym(**otk::display, key, 0)); } }; diff --git a/src/screen.cc b/src/screen.cc index 884f85c3..22ff3ca9 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -49,14 +49,14 @@ Screen::Screen(int screen) : WidgetBase(WidgetBase::Type_Root), _number(screen) { - assert(screen >= 0); assert(screen < ScreenCount(otk::Display::display)); - _info = otk::Display::screenInfo(screen); + assert(screen >= 0); assert(screen < ScreenCount(**otk::display)); + _info = otk::display->screenInfo(screen); ::running = false; XErrorHandler old = XSetErrorHandler(::anotherWMRunning); - XSelectInput(otk::Display::display, _info->rootWindow(), + XSelectInput(**otk::display, _info->rootWindow(), Screen::event_mask); - XSync(otk::Display::display, false); + XSync(**otk::display, false); XSetErrorHandler(old); _managed = !::running; @@ -71,7 +71,7 @@ Screen::Screen(int screen) (unsigned long) getpid()); // set the mouse cursor for the root window (the default cursor) - XDefineCursor(otk::Display::display, _info->rootWindow(), + XDefineCursor(**otk::display, _info->rootWindow(), openbox->cursors().session); // initialize the shit that is used for all drawing on the screen @@ -126,10 +126,10 @@ Screen::Screen(int screen) // create the window which gets focus when no clients get it XSetWindowAttributes attr; attr.override_redirect = true; - _focuswindow = XCreateWindow(otk::Display::display, _info->rootWindow(), + _focuswindow = XCreateWindow(**otk::display, _info->rootWindow(), -100, -100, 1, 1, 0, 0, InputOnly, _info->visual(), CWOverrideRedirect, &attr); - XMapWindow(otk::Display::display, _focuswindow); + XMapWindow(**otk::display, _focuswindow); // these may be further updated if any pre-existing windows are found in // the manageExising() function @@ -149,7 +149,7 @@ Screen::~Screen() { if (! _managed) return; - XSelectInput(otk::Display::display, _info->rootWindow(), NoEventMask); + XSelectInput(**otk::display, _info->rootWindow(), NoEventMask); // unmanage all windows while (!clients.empty()) @@ -159,8 +159,8 @@ Screen::~Screen() EventData data(_number, 0, EventShutdown, 0); openbox->bindings()->fireEvent(&data); - XDestroyWindow(otk::Display::display, _focuswindow); - XDestroyWindow(otk::Display::display, _supportwindow); + XDestroyWindow(**otk::display, _focuswindow); + XDestroyWindow(**otk::display, _supportwindow); delete _image_control; } @@ -170,14 +170,14 @@ void Screen::manageExisting() { unsigned int i, j, nchild; Window r, p, *children; - XQueryTree(otk::Display::display, _info->rootWindow(), &r, &p, + XQueryTree(**otk::display, _info->rootWindow(), &r, &p, &children, &nchild); // preen the window list of all icon windows... for better dockapp support for (i = 0; i < nchild; i++) { if (children[i] == None) continue; - XWMHints *wmhints = XGetWMHints(otk::Display::display, + XWMHints *wmhints = XGetWMHints(**otk::display, children[i]); if (wmhints) { @@ -201,7 +201,7 @@ void Screen::manageExisting() continue; XWindowAttributes attrib; - if (XGetWindowAttributes(otk::Display::display, children[i], &attrib)) { + if (XGetWindowAttributes(**otk::display, children[i], &attrib)) { if (attrib.override_redirect) continue; if (attrib.map_state != IsUnmapped) { @@ -279,7 +279,7 @@ void Screen::calcArea() void Screen::changeSupportedAtoms() { // create the netwm support window - _supportwindow = XCreateSimpleWindow(otk::Display::display, + _supportwindow = XCreateSimpleWindow(**otk::display, _info->rootWindow(), 0, 0, 1, 1, 0, 0, 0); @@ -456,14 +456,14 @@ void Screen::manageWindow(Window window) XWMHints *wmhint; XSetWindowAttributes attrib_set; - otk::Display::grab(); + otk::display->grab(); // is the window a docking app - if ((wmhint = XGetWMHints(otk::Display::display, window))) { + if ((wmhint = XGetWMHints(**otk::display, window))) { if ((wmhint->flags & StateHint) && wmhint->initial_state == WithdrawnState) { //slit->addClient(w); // XXX: make dock apps work! - otk::Display::ungrab(); + otk::display->ungrab(); XFree(wmhint); return; @@ -474,7 +474,7 @@ void Screen::manageWindow(Window window) // choose the events we want to receive on the CLIENT window attrib_set.event_mask = Client::event_mask; attrib_set.do_not_propagate_mask = Client::no_propagate_mask; - XChangeWindowAttributes(otk::Display::display, window, + XChangeWindowAttributes(**otk::display, window, CWEventMask|CWDontPropagate, &attrib_set); // create the Client class, which gets all of the hints on the window @@ -489,7 +489,7 @@ void Screen::manageWindow(Window window) // 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); + XChangeSaveSet(**otk::display, window, SetModeInsert); if (!(openbox->state() == Openbox::State_Starting || client->positionRequested())) { @@ -526,7 +526,7 @@ void Screen::manageWindow(Window window) // XXX: handle any requested states such as maximized - otk::Display::ungrab(); + otk::display->ungrab(); // add to the screen's list clients.push_back(client); @@ -575,10 +575,10 @@ void Screen::unmanageWindow(Client *client) openbox->clearHandler(client->window()); // remove the window from our save set - XChangeSaveSet(otk::Display::display, client->window(), SetModeDelete); + XChangeSaveSet(**otk::display, client->window(), SetModeDelete); // we dont want events no more - XSelectInput(otk::Display::display, client->window(), NoEventMask); + XSelectInput(**otk::display, client->window(), NoEventMask); frame->hide(); @@ -633,7 +633,7 @@ void Screen::restack(bool raise, Client *client) for (; it != end; ++it) wins.push_back((*it)->frame->window()); - XRestackWindows(otk::Display::display, &wins[0], wins.size()); + XRestackWindows(**otk::display, &wins[0], wins.size()); changeStackingList(); } @@ -733,11 +733,11 @@ void Screen::propertyHandler(const XPropertyEvent &e) // compress changes to a single property into a single change XEvent ce; - while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) { + while (XCheckTypedEvent(**otk::display, e.type, &ce)) { // XXX: it would be nice to compress ALL changes to a property, not just // changes in a row without other props between. if (ce.xproperty.atom != e.atom) { - XPutBackEvent(otk::Display::display, &ce); + XPutBackEvent(**otk::display, &ce); break; } } @@ -786,7 +786,7 @@ void Screen::mapRequestHandler(const XMapRequestEvent &e) ce.xclient.type = ClientMessage; ce.xclient.message_type = openbox->property()->atom(otk::Property::net_active_window); - ce.xclient.display = otk::Display::display; + ce.xclient.display = **otk::display; ce.xclient.window = c->window(); ce.xclient.format = 32; ce.xclient.data.l[0] = 0l; @@ -794,7 +794,7 @@ void Screen::mapRequestHandler(const XMapRequestEvent &e) ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; - XSendEvent(otk::Display::display, _info->rootWindow(), false, + XSendEvent(**otk::display, _info->rootWindow(), false, SubstructureRedirectMask | SubstructureNotifyMask, &ce); } else