all repos — openbox @ f11bd1b0cc5973590d1ee547736ac00f50447efa

openbox fork - make it a bit more like ryudo

better reparent handling, dont fux with the event stack..
Dana Jansens danakj@orodu.net
commit

f11bd1b0cc5973590d1ee547736ac00f50447efa

parent

2ae5aaca65b4d9c9747fe787c920a547e7ec13c0

6 files changed, 40 insertions(+), 37 deletions(-)

jump to
M src/client.ccsrc/client.cc

@@ -1269,14 +1269,8 @@ the window manager never sees it because an unmap event is not sent

to an already unmapped window. */ - // put another copy of this event on the stack (for the frame reparent - // process) - XEvent ev; - ev.xreparent = e; - XPutBackEvent(otk::OBDisplay::display, &ev); - // this deletes us etc - Openbox::instance->screen(_screen)->unmanageWindow(this); + Openbox::instance->screen(_screen)->unmanageWindow(this, true); } }
M src/frame.ccsrc/frame.cc

@@ -56,14 +56,11 @@

otk::OtkWidget::unfocus(); // stuff starts out appearing focused in otk _plate.show(); // the other stuff is shown based on decor settings - - grabClient(); } OBFrame::~OBFrame() { - releaseClient(); }

@@ -432,24 +429,13 @@

void OBFrame::releaseClient() { - // check if the app has already reparented its window to the root window - XEvent ev; - if (XCheckTypedWindowEvent(otk::OBDisplay::display, _client->window(), - ReparentNotify, &ev)) { - /* - If the app reparented itself, then we unmanage the window. This causes - the window to be unmapped, so to be nice to it, we remap the window - here. We don't put the event back onto the stack because we put it there - in the first place. - */ - XMapWindow(otk::OBDisplay::display, _client->window()); - } else { - // according to the ICCCM - if the client doesn't reparent to - // root, then we have to do it for them - XReparentWindow(otk::OBDisplay::display, _client->window(), - _screen->rootWindow(), - _client->area().x(), _client->area().y()); - } + // XXX: check for a reparent before reparenting? + + // according to the ICCCM - if the client doesn't reparent to + // root, then we have to do it for them + XReparentWindow(otk::OBDisplay::display, _client->window(), + _screen->rootWindow(), + _client->area().x(), _client->area().y()); }
M src/frame.hhsrc/frame.hh

@@ -67,11 +67,6 @@ is duplicated here so that it can be overridden per-window by the user.

*/ OBClient::DecorationFlags _decorations; - //! Reparents the client window from the root window onto the frame - void grabClient(); - //! Reparents the client window back to the root window - void releaseClient(); - public: //! Constructs an OBFrame object, and reparents the client to itself /*!

@@ -95,6 +90,14 @@ virtual void unfocus();

void setTitle(const std::string &text); + //! Reparents the client window from the root window onto the frame + void grabClient(); + //! Reparents the client window back to the root window + /*! + This is not to be called if the client has already reparented itself. + */ + void releaseClient(); + //! Update the frame's size to match the client void adjustSize(); //! Update the frame's position to match the client
M src/openbox_wrap.ccsrc/openbox_wrap.cc

@@ -1604,13 +1604,19 @@ static PyObject *_wrap_OBScreen_unmanageWindow(PyObject *self, PyObject *args) {

PyObject *resultobj; ob::OBScreen *arg1 = (ob::OBScreen *) 0 ; ob::OBClient *arg2 = (ob::OBClient *) 0 ; + bool arg3 = (bool) false ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OO:OBScreen_unmanageWindow",&obj0,&obj1)) goto fail; + if(!PyArg_ParseTuple(args,(char *)"OO|O:OBScreen_unmanageWindow",&obj0,&obj1,&obj2)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBScreen,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - (arg1)->unmanageWindow(arg2); + if (obj2) { + arg3 = (bool) PyInt_AsLong(obj2); + if (PyErr_Occurred()) SWIG_fail; + } + (arg1)->unmanageWindow(arg2,arg3); Py_INCREF(Py_None); resultobj = Py_None; return resultobj;
M src/screen.ccsrc/screen.cc

@@ -519,6 +519,9 @@ Openbox::instance->addClient(client->frame->handle(), client);

Openbox::instance->addClient(client->frame->grip_left(), client); Openbox::instance->addClient(client->frame->grip_right(), client); + // reparent the client to the frame + client->frame->grabClient(); + // if on the current desktop.. (or all desktops) if (client->desktop() == _desktop || client->desktop() == (signed)0xffffffff) {

@@ -548,7 +551,7 @@ printf("Managed window 0x%lx\n", window);

} -void OBScreen::unmanageWindow(OBClient *client) +void OBScreen::unmanageWindow(OBClient *client, bool reparented) { OBFrame *frame = client->frame;

@@ -587,6 +590,14 @@

// give the client its border back client->toggleClientBorder(true); + if (!reparented) + // reparent the window out of the frame + frame->releaseClient(); + else + // the client is already reparented, so, since we unmapped the window + // above, we remap it here. aren't we nice? :) + XMapWindow(otk::OBDisplay::display, client->window()); + delete client->frame; client->frame = 0;
M src/screen.hhsrc/screen.hh

@@ -177,8 +177,11 @@ //! Unmanage a client

/*! This removes the window's frame, reparents it to root, unselects events on it, etc. + @param client The client to unmanage + @param reparented true if the client's window has already reparented + itself; false if it has not. */ - void unmanageWindow(OBClient *client); + void unmanageWindow(OBClient *client, bool reparented = false); //! Raises/Lowers a client window above/below all others in its stacking //! layer