X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=f44e291cee51ebbe884d3a8446854c81ff7b60ba;hb=d13f021b8bb2a6b8e49f69a370409e79a7f02213;hp=bebc82d17705d59763ed827038b478b4e4e3d9b4;hpb=7bae794382c7a64a6427b16d1339b98120a5166f;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index bebc82d1..f44e291c 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -518,6 +518,14 @@ void OBScreen::manageWindow(Window window) setClientList(); Openbox::instance->bindings()->grabButtons(true, client); + + // XXX: make this optional or more intelligent + 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 +533,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 +546,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(); }