]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
when Image Dither is changed in the menu, make ob reconfigure so it uses the dithering
[chaz/openbox] / src / Window.cc
index d733afc3be8605b1db387941ded36fe318bce061..f768f6c15e90ad088401ce6071e1b7055c04535d 100644 (file)
@@ -1539,6 +1539,8 @@ void OpenboxWindow::maximize(unsigned int button) {
   if (! screen->fullMax()) {
 #ifdef    SLIT
     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;
@@ -1562,19 +1564,23 @@ void OpenboxWindow::maximize(unsigned int button) {
           slit->placement() == Slit::TopRight)) ||
         slit->placement() == Slit::TopCenter) {
       // exclude top
-      if (tbartop) {
-        space.setY(slit->area().y());
-        space.setH(space.h() - space.y());
-      } else
+      if (tbartop && slit_y + slit->area().h() < tbarh) {
+        space.setY(space.y() + tbarh);
         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 {
+        space.setY(space.y() + (slit_y + slit->area().h() +
+                                screen->getBorderWidth() * 2));
+        space.setH(space.h() - (slit_y + slit->area().h() +
+                                screen->getBorderWidth() * 2));
+        if (!tbartop)
+          space.setH(space.h() - tbarh);
+      }
     } 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));
+      space.setW(space.w() - (screen->size().w() - slit_x));
       if (tbartop)
         space.setY(space.y() + tbarh);
       space.setH(space.h() - tbarh);
@@ -1583,14 +1589,24 @@ void OpenboxWindow::maximize(unsigned int button) {
                slit->placement() == Slit::BottomRight)) ||
              slit->placement() == Slit::BottomCenter) {
       // exclude bottom
-      space.setH(space.h() - (screen->size().h() - slit->area().y()));
+      if (!tbartop && (screen->size().h() - slit_y) < tbarh) {
+        space.setH(space.h() - tbarh);
+      } else {
+        space.setH(space.h() - (screen->size().h() - slit_y));
+        if (tbartop) {
+          space.setY(space.y() + tbarh);
+          space.setH(space.h() - tbarh);
+        }
+      }
     } 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));
+      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);
@@ -2868,7 +2884,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
       int snap_distance = screen->edgeSnapThreshold();
       // width/height of the snapping window
       unsigned int snap_w = frame.width + (frame.border_w * 2);
-      unsigned int snap_h = size().h() + (frame.border_w * 2);
+      unsigned int snap_h = area().h() + (frame.border_w * 2);
       if (snap_distance) {
         int drx = screen->size().w() - (dx + snap_w);
 
@@ -2891,7 +2907,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
 
         default:
           dtty = 0;
-         dbby = screen->getToolbar()->getY();
+         dbby = screen->getToolbar()->area().y();
           break;
         }
 
This page took 0.026241 seconds and 4 git commands to generate.