X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=b16a75ded71e3c52652e21fa61442711ac4f5cfa;hb=bd748f74022019c4c9ee3e078afcef14cf47d370;hp=7f15b243a4a2d62a246ff75368ac7a2a4b3c7a67;hpb=9d2ba8205c981776b8120c4c7edb623864206298;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index 7f15b243..b16a75de 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -284,7 +284,6 @@ void OBScreen::changeSupportedAtoms() _supportwindow = XCreateSimpleWindow(otk::OBDisplay::display, _info->rootWindow(), 0, 0, 1, 1, 0, 0, 0); - assert(_supportwindow != None); // set supporting window Openbox::instance->property()->set(_info->rootWindow(), @@ -459,19 +458,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 +493,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 +518,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(); } @@ -540,7 +546,9 @@ void OBScreen::manageWindow(Window window) Openbox::instance->bindings()->fireEvent(data); Py_DECREF((PyObject*)data); +#ifdef DEBUG printf("Managed window 0x%lx\n", window); +#endif } @@ -556,12 +564,6 @@ void OBScreen::unmanageWindow(OBClient *client) Openbox::instance->bindings()->grabButtons(false, client); - // remove from the stacking order - _stacking.remove(client); - - // unfocus the client - client->unfocus(); - // remove from the wm's map Openbox::instance->removeClient(client->window()); Openbox::instance->removeClient(frame->window()); @@ -589,11 +591,25 @@ void OBScreen::unmanageWindow(OBClient *client) // give the client its border back client->toggleClientBorder(true); + // reparent the window out of the frame + frame->releaseClient(); + delete client->frame; client->frame = 0; + // remove from the stacking order + _stacking.remove(client); + // remove from the screen's list clients.remove(client); + + // unfocus the client (calls the focus callbacks) + client->unfocus(); + +#ifdef DEBUG + printf("Unmanaged window 0x%lx\n", client->window()); +#endif + delete client; // update the root properties @@ -655,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)