X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=72a33b41fd4f8a571647794115145bdd28172937;hb=3cca07840b571a18e599d66b4108626cbd48788d;hp=6525150bc478e4af53ea5cc07cde2908c5f835d2;hpb=8d4fe416e5d940670df7b974a004ac041e21196f;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index 6525150b..72a33b41 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::Shutdown, 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); @@ -224,7 +224,7 @@ void Screen::updateStrut() void Screen::calcArea() { - otk::Rect old_area = _area; +// otk::Rect old_area = _area; /* #ifdef XINERAMA @@ -261,7 +261,7 @@ void Screen::calcArea() #endif // XINERAMA */ - if (old_area != _area) + //if (old_area != _area) // XXX: re-maximize windows changeWorkArea(); @@ -433,16 +433,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; } @@ -498,10 +516,13 @@ void Screen::manageWindow(Window window) client->positionRequested())) { // 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 +535,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,12 +546,12 @@ 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\n", window); + printf("Managed window 0x%lx frame 0x%lx\n", + window, client->frame->window()); #endif } @@ -537,7 +561,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); @@ -572,6 +596,9 @@ void Screen::unmanageWindow(Client *client) // reparent the window out of the frame frame->releaseClient(); +#ifdef DEBUG + Window framewin = client->frame->window(); +#endif delete client->frame; client->frame = 0; @@ -581,11 +608,15 @@ 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(); #ifdef DEBUG - printf("Unmanaged window 0x%lx\n", client->window()); + printf("Unmanaged window 0x%lx frame 0x%lx\n", client->window(), framewin); #endif delete client; @@ -771,7 +802,13 @@ void Screen::mapRequestHandler(const XMapRequestEvent &e) printf("MapRequest for 0x%lx\n", e.window); #endif // DEBUG - manageWindow(e.window); + Client *c = openbox->findClient(e.window); + if (c) { +#ifdef DEBUG + printf("DEBUG: MAP REQUEST CAUGHT IN SCREEN. IGNORED.\n"); +#endif + } else + manageWindow(e.window); } }