X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2FScreen.cc;h=46b15b2238800c6bb007e42c6f824666eab61552;hb=47585423c6494391db0425f2237890e82f1b031a;hp=6b895644e7b28fac65599d36d9e40c2b55c9ac7e;hpb=bd7f9481590d79ba81c03d3d22ba190826921194;p=chaz%2Fopenbox diff --git a/src/Screen.cc b/src/Screen.cc index 6b895644..46b15b22 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -29,6 +29,11 @@ extern "C" { #include #include +#ifdef XINERAMA +# include +# include +#endif // XINERAMA + #ifdef HAVE_STDLIB_H # include #endif // HAVE_STDLIB_H @@ -154,8 +159,7 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) { XDefineCursor(blackbox->getXDisplay(), getRootWindow(), blackbox->getSessionCursor()); - // start off full screen, top left. - usableArea.setSize(getWidth(), getHeight()); + updateAvailableArea(); image_control = new BImageControl(blackbox, this, True, blackbox->getColorsPerChannel(), @@ -2070,10 +2074,25 @@ const Rect& BScreen::availableArea(void) const { } +#ifdef XINERAMA +RectList BScreen::allAvailableAreas(void) const { + assert(isXineramaActive()); + assert(xineramaUsableArea.size() > 0); + return xineramaUsableArea; +} +#endif // XINERAMA + + void BScreen::updateAvailableArea(void) { Rect old_area = usableArea; usableArea = getRect(); // reset to full screen +#ifdef XINERAMA + // reset to the full areas + if (isXineramaActive()) + xineramaUsableArea = getXineramaAreas(); +#endif // XINERAMA + /* these values represent offsets from the screen edge * we look for the biggest offset on each edge and then apply them * all at once @@ -2100,6 +2119,27 @@ void BScreen::updateAvailableArea(void) { usableArea.setSize(usableArea.width() - (current_left + current_right), usableArea.height() - (current_top + current_bottom)); +#ifdef XINERAMA + if (isXineramaActive()) { + // keep each of the ximerama-defined areas inside the strut + RectList::iterator xit, xend = xineramaUsableArea.end(); + for (xit = xineramaUsableArea.begin(); xit != xend; ++xit) { + if (xit->x() < usableArea.x()) { + xit->setX(usableArea.x()); + xit->setWidth(xit->width() - usableArea.x()); + } + if (xit->y() < usableArea.y()) { + xit->setY(usableArea.y()); + xit->setHeight(xit->height() - usableArea.y()); + } + if (xit->x() + xit->width() > usableArea.width()) + xit->setWidth(usableArea.width() - xit->x()); + if (xit->y() + xit->height() > usableArea.height()) + xit->setHeight(usableArea.height() - xit->y()); + } + } +#endif // XINERAMA + if (old_area != usableArea) { BlackboxWindowList::iterator it = windowList.begin(), end = windowList.end();