]> Dogcows Code - chaz/openbox/blobdiff - src/Screen.cc
default all xinerama support options to off
[chaz/openbox] / src / Screen.cc
index 6b895644e7b28fac65599d36d9e40c2b55c9ac7e..46b15b2238800c6bb007e42c6f824666eab61552 100644 (file)
@@ -29,6 +29,11 @@ extern "C" {
 #include <X11/Xatom.h>
 #include <X11/keysym.h>
 
+#ifdef    XINERAMA
+#  include <X11/Xlib.h>
+#  include <X11/extensions/Xinerama.h>
+#endif // XINERAMA
+
 #ifdef HAVE_STDLIB_H
 #  include <stdlib.h>
 #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();
This page took 0.023054 seconds and 4 git commands to generate.