X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=40f143a13539fe694610beb52733fa67c27bb734;hb=e2069b5792a80ba8ccfd03c9d1bdd5e364dbee10;hp=2a7711dee78f09293a2f585cce55c7b95f3cb585;hpb=39f19f427b68058b00e17ac972c5d9dfbda8c2e0;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index 2a7711de..40f143a1 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -134,7 +134,7 @@ Screen::Screen(int screen) openbox->registerHandler(_info->rootWindow(), this); // call the python Startup callbacks - EventData data(_number, 0, EventShutdown, 0); + EventData data(_number, 0, EventAction::Startup, 0); openbox->bindings()->fireEvent(&data); } @@ -150,7 +150,7 @@ Screen::~Screen() unmanageWindow(clients.front()); // call the python Shutdown callbacks - EventData data(_number, 0, EventShutdown, 0); + EventData data(_number, 0, EventAction::Shutdown, 0); openbox->bindings()->fireEvent(&data); XDestroyWindow(**otk::display, _focuswindow); @@ -208,6 +208,7 @@ void Screen::manageExisting() void Screen::updateStrut() { + otk::Strut old = _strut; _strut.left = _strut.right = _strut.top = _strut.bottom = 0; Client::List::iterator it, end = clients.end(); @@ -219,12 +220,18 @@ void Screen::updateStrut() _strut.bottom = std::max(_strut.bottom, s.bottom); } calcArea(); + + if (!(old == _strut)) { + // the strut has changed, adjust all the maximized windows + for (it = clients.begin(); it != end; ++it) + (*it)->remaximize(); + } } void Screen::calcArea() { - otk::Rect old_area = _area; +// otk::Rect old_area = _area; /* #ifdef XINERAMA @@ -261,7 +268,7 @@ void Screen::calcArea() #endif // XINERAMA */ - if (old_area != _area) + //if (old_area != _area) // XXX: re-maximize windows changeWorkArea(); @@ -433,16 +440,34 @@ void Screen::manageWindow(Window window) Client *client = 0; XWMHints *wmhint; XSetWindowAttributes attrib_set; + XEvent e; + XWindowAttributes attrib; otk::display->grab(); + // check if it has already been unmapped by the time we started mapping + // the grab does a sync so we don't have to here + if (XCheckTypedWindowEvent(**otk::display, window, DestroyNotify, &e) || + XCheckTypedWindowEvent(**otk::display, window, UnmapNotify, &e)) { + XPutBackEvent(**otk::display, &e); + + otk::display->ungrab(); + return; // don't manage it + } + + if (!XGetWindowAttributes(**otk::display, window, &attrib) || + attrib.override_redirect) { + otk::display->ungrab(); + return; // don't manage it + } + // is the window a docking app if ((wmhint = XGetWMHints(**otk::display, window))) { if ((wmhint->flags & StateHint) && wmhint->initial_state == WithdrawnState) { //slit->addClient(w); // XXX: make dock apps work! - otk::display->ungrab(); + otk::display->ungrab(); XFree(wmhint); return; } @@ -494,14 +519,16 @@ void Screen::manageWindow(Window window) // reparent the client to the frame client->frame->grabClient(); - if (!(openbox->state() == Openbox::State_Starting || - client->positionRequested())) { + if (openbox->state() != Openbox::State_Starting) { // position the window intelligenty .. hopefully :) // call the python PLACEWINDOW binding - EventData data(_number, client, EventPlaceWindow, 0); + EventData data(_number, client, EventAction::PlaceWindow, 0); openbox->bindings()->fireEvent(&data); } + EventData ddata(_number, client, EventAction::DisplayingWindow, 0); + openbox->bindings()->fireEvent(&ddata); + // if on the current desktop.. (or all desktops) if (client->desktop() == _desktop || client->desktop() == (signed)0xffffffff) { @@ -514,6 +541,9 @@ void Screen::manageWindow(Window window) // add to the screen's list clients.push_back(client); + // once the client is in the list, update our strut to include the new + // client's (it is good that this happens after window placement!) + updateStrut(); // this puts into the stacking order, then raises it _stacking.push_back(client); raiseWindow(client); @@ -522,9 +552,8 @@ void Screen::manageWindow(Window window) openbox->bindings()->grabButtons(true, client); - // call the python NEWWINDOW binding - EventData data(_number, client, EventNewWindow, 0); - openbox->bindings()->fireEvent(&data); + EventData ndata(_number, client, EventAction::NewWindow, 0); + openbox->bindings()->fireEvent(&ndata); #ifdef DEBUG printf("Managed window 0x%lx frame 0x%lx\n", @@ -538,7 +567,7 @@ void Screen::unmanageWindow(Client *client) Frame *frame = client->frame; // call the python CLOSEWINDOW binding - EventData data(_number, client, EventCloseWindow, 0); + EventData data(_number, client, EventAction::CloseWindow, 0); openbox->bindings()->fireEvent(&data); openbox->bindings()->grabButtons(false, client); @@ -585,6 +614,10 @@ void Screen::unmanageWindow(Client *client) // remove from the screen's list clients.remove(client); + // once the client is out of the list, update our strut to remove it's + // influence + updateStrut(); + // unfocus the client (calls the focus callbacks) client->unfocus();