]> Dogcows Code - chaz/openbox/commitdiff
maximize and placeWindow now behave properly when the slit is hidden
authorDana Jansens <danakj@orodu.net>
Mon, 22 Apr 2002 22:24:15 +0000 (22:24 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 22 Apr 2002 22:24:15 +0000 (22:24 +0000)
src/Window.cc
src/Workspace.cc

index 6a057a75d75c67d16ced15c2d977e4705a133e6d..6d9d8859baad3a97d5a235ced4e0daa8b4b13310 100644 (file)
@@ -1587,7 +1587,8 @@ void OpenboxWindow::maximize(unsigned int button) {
                slit->placement() == Slit::BottomRight)) ||
              slit->placement() == Slit::BottomCenter) {
       // exclude bottom
-      space.setH(space.h() - (screen->size().h() - slit_y));
+      space.setH(space.h() - ((screen->size().h() - slit_y) > tbarh ?
+                              screen->size().h() - slit_y : tbarh));
     } else {// if ((slit->direction() == Slit::Vertical &&
       //      (slit->placement() == Slit::TopLeft ||
       //       slit->placement() == Slit::BottomLeft)) ||
index 551f56423432dc552f383714ce27b3130abcb5bb..45dc2bc303c44a1f762680e835af5b711b907656 100644 (file)
@@ -546,63 +546,70 @@ void Workspace::placeWindow(OpenboxWindow *win) {
   Rect space(0, 0, screen.size().w(), screen.size().h());
 
 #ifdef    SLIT
-  Slit *slit = screen.getSlit();
-  Toolbar *toolbar = screen.getToolbar();
-  int tbarh = screen.hideToolbar() ? 0 :
-    toolbar->getExposedHeight() + screen.getBorderWidth() * 2;
-  bool tbartop;
-  switch (toolbar->placement()) {
-  case Toolbar::TopLeft:
-  case Toolbar::TopCenter:
-  case Toolbar::TopRight:
-    tbartop = true;
-    break;
-  case Toolbar::BottomLeft:
-  case Toolbar::BottomCenter:
-  case Toolbar::BottomRight:
-    tbartop = false;
-    break;
-  default:
-    ASSERT(false);      // unhandled placement
-  }
-  if ((slit->direction() == Slit::Horizontal &&
-       (slit->placement() == Slit::TopLeft ||
-        slit->placement() == Slit::TopRight)) ||
-      slit->placement() == Slit::TopCenter) {
-    // exclude top
-    if (tbartop) {
-      space.setY(slit->area().y());
-      space.setH(space.h() - space.y());
-    } else
-      space.setH(space.h() - tbarh);
-    space.setY(space.y() + slit->area().h() + screen.getBorderWidth() * 2);
-    space.setH(space.h() - (slit->area().h() + screen.getBorderWidth() * 2));
-  } else if ((slit->direction() == Slit::Vertical &&
+    Slit *slit = screen.getSlit();
+    int slit_x = slit->autoHide() ? slit->hiddenOrigin().x() : slit->area().x(),
+        slit_y = slit->autoHide() ? slit->hiddenOrigin().y() : slit->area().y();
+    Toolbar *toolbar = screen.getToolbar();
+    int tbarh = screen.hideToolbar() ? 0 :
+      toolbar->getExposedHeight() + screen.getBorderWidth() * 2;
+    bool tbartop;
+    switch (toolbar->placement()) {
+    case Toolbar::TopLeft:
+    case Toolbar::TopCenter:
+    case Toolbar::TopRight:
+      tbartop = true;
+      break;
+    case Toolbar::BottomLeft:
+    case Toolbar::BottomCenter:
+    case Toolbar::BottomRight:
+      tbartop = false;
+      break;
+    default:
+      ASSERT(false);      // unhandled placement
+    }
+    if ((slit->direction() == Slit::Horizontal &&
+         (slit->placement() == Slit::TopLeft ||
+          slit->placement() == Slit::TopRight)) ||
+        slit->placement() == Slit::TopCenter) {
+      // exclude top
+      if (tbartop)
+        space.setH(space.h() - slit_y);
+      else
+        space.setH(space.h() - tbarh);
+      space.setY(space.y() + slit_y + slit->area().h() +
+                 screen.getBorderWidth() * 2);
+      space.setH(space.h() - (slit_y + slit->area().h() +
+                              screen.getBorderWidth() * 2));
+    } else if ((slit->direction() == Slit::Vertical &&
               (slit->placement() == Slit::TopRight ||
                slit->placement() == Slit::BottomRight)) ||
              slit->placement() == Slit::CenterRight) {
-    // exclude right
-    space.setW(space.w() - (slit->area().w() + screen.getBorderWidth() * 2));
-    if (tbartop)
-      space.setY(space.y() + tbarh);
-    space.setH(space.h() - tbarh);
-  } else if ((slit->direction() == Slit::Horizontal &&
+      // exclude right
+      space.setW(space.w() - (screen.size().w() - slit_x +
+                              screen.getBorderWidth() * 2));
+      if (tbartop)
+        space.setY(space.y() + tbarh);
+      space.setH(space.h() - tbarh);
+    } else if ((slit->direction() == Slit::Horizontal &&
               (slit->placement() == Slit::BottomLeft ||
                slit->placement() == Slit::BottomRight)) ||
              slit->placement() == Slit::BottomCenter) {
-    // exclude bottom
-    space.setH(space.h() - (screen.size().h() - slit->area().y()));
-  } else {// if ((slit->direction() == Slit::Vertical &&
-    //      (slit->placement() == Slit::TopLeft ||
-    //       slit->placement() == Slit::BottomLeft)) ||
-    //     slit->placement() == Slit::CenterLeft)
-    // exclude left
-    space.setX(slit->area().w() + screen.getBorderWidth() * 2);
-    space.setW(space.w() - (slit->area().w() + screen.getBorderWidth() * 2));
-    if (tbartop)
-      space.setY(space.y() + tbarh);
-    space.setH(space.h() - tbarh);
-  }
+      // exclude bottom
+      space.setH(space.h() - ((screen.size().h() - slit_y) > tbarh ?
+                              screen.size().h() - slit_y : tbarh));
+    } else {// if ((slit->direction() == Slit::Vertical &&
+      //      (slit->placement() == Slit::TopLeft ||
+      //       slit->placement() == Slit::BottomLeft)) ||
+      //     slit->placement() == Slit::CenterLeft)
+      // exclude left
+      space.setX(slit_x + slit->area().w() +
+                 screen.getBorderWidth() * 2);
+      space.setW(space.w() - (slit_x + slit->area().w() +
+                              screen.getBorderWidth() * 2));
+      if (tbartop)
+        space.setY(space.y() + tbarh);
+      space.setH(space.h() - tbarh);
+    }
 #else // !SLIT
   Toolbar *toolbar = screen.getToolbar();
   int tbarh = screen.hideToolbar() ? 0 :
This page took 0.02586 seconds and 4 git commands to generate.