X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=09f57d64ebde4200b24e0593844da1b4cded300e;hb=889df8a74da733c849cb52c3a76ae59956755882;hp=eddda8df9dd1b1b67d32ef1ae2d746b36b6de039;hpb=dc532b7661e0d9bc72c25b74fa987ce50f3f0b31;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index eddda8df..09f57d64 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -459,19 +459,21 @@ void OBScreen::manageWindow(Window window) XWMHints *wmhint; XSetWindowAttributes attrib_set; + otk::OBDisplay::grab(); + // is the window a docking app if ((wmhint = XGetWMHints(otk::OBDisplay::display, window))) { if ((wmhint->flags & StateHint) && wmhint->initial_state == WithdrawnState) { //slit->addClient(w); // XXX: make dock apps work! + otk::OBDisplay::ungrab(); + XFree(wmhint); return; } XFree(wmhint); } - otk::OBDisplay::grab(); - // choose the events we want to receive on the CLIENT window attrib_set.event_mask = OBClient::event_mask; attrib_set.do_not_propagate_mask = OBClient::no_propagate_mask; @@ -492,8 +494,13 @@ void OBScreen::manageWindow(Window window) // reparented back to root automatically XChangeSaveSet(otk::OBDisplay::display, window, SetModeInsert); - if (!client->positionRequested()) { - // XXX: position the window intelligenty + if (!(Openbox::instance->state() == Openbox::State_Starting || + client->positionRequested())) { + // position the window intelligenty .. hopefully :) + // call the python PLACEWINDOW binding + EventData *data = new_event_data(_number, window, EventPlaceWindow, 0); + Openbox::instance->bindings()->fireEvent(data); + Py_DECREF((PyObject*)data); } // create the decoration frame for the client window @@ -512,12 +519,12 @@ void OBScreen::manageWindow(Window window) Openbox::instance->addClient(client->frame->grip_left(), client); Openbox::instance->addClient(client->frame->grip_right(), client); - bool shown = false; - + // 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) { - shown = true; client->frame->show(); } @@ -544,7 +551,7 @@ void OBScreen::manageWindow(Window window) } -void OBScreen::unmanageWindow(OBClient *client) +void OBScreen::unmanageWindow(OBClient *client, bool reparented) { OBFrame *frame = client->frame; @@ -583,6 +590,14 @@ void OBScreen::unmanageWindow(OBClient *client) // 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; @@ -656,7 +671,8 @@ void OBScreen::changeDesktop(long desktop) } // force the callbacks to fire - Openbox::instance->setFocusedClient(0); + if (!Openbox::instance->focusedClient()) + Openbox::instance->setFocusedClient(0); } void OBScreen::changeNumDesktops(long num)