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);
}
}
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();
}
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());
}
*/
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
/*!
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
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;
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) {
}
-void OBScreen::unmanageWindow(OBClient *client)
+void OBScreen::unmanageWindow(OBClient *client, bool reparented)
{
OBFrame *frame = client->frame;
// 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;
/*!
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