X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fscreen.cc;h=8ea1b49ea8a0432f48bf86ed50278a9434cbb880;hb=eef665c6b899cea2598b4b5cbfc4129dcf90287f;hp=bebc82d17705d59763ed827038b478b4e4e3d9b4;hpb=7bae794382c7a64a6427b16d1339b98120a5166f;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index bebc82d1..8ea1b49e 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -518,6 +518,15 @@ void OBScreen::manageWindow(Window window) setClientList(); Openbox::instance->bindings()->grabButtons(true, client); + + // XXX: make this optional or more intelligent + if (client->normal()) + client->focus(); + + // call the python NEWWINDOW binding + EventData *data = new_event_data(window, EventNewWindow, 0); + Openbox::instance->bindings()->fireEvent(data); + Py_DECREF((PyObject*)data); } @@ -525,6 +534,11 @@ void OBScreen::unmanageWindow(OBClient *client) { OBFrame *frame = client->frame; + // call the python CLOSEWINDOW binding + EventData *data = new_event_data(client->window(), EventCloseWindow, 0); + Openbox::instance->bindings()->fireEvent(data); + Py_DECREF((PyObject*)data); + Openbox::instance->bindings()->grabButtons(false, client); // remove from the stacking order @@ -533,9 +547,13 @@ void OBScreen::unmanageWindow(OBClient *client) // pass around focus if this window was focused XXX do this better! if (Openbox::instance->focusedClient() == client) { OBClient *newfocus = 0; - if (!_stacking.empty()) - newfocus = _stacking.front(); - if (! (newfocus && newfocus->focus())) + ClientList::iterator it, end = _stacking.end(); + for (it = _stacking.begin(); it != end; ++it) + if ((*it)->normal() && (*it)->focus()) { + newfocus = *it; + break; + } + if (!newfocus) client->unfocus(); }