]> Dogcows Code - chaz/openbox/commitdiff
optimized the finding-the-slit-position code in positionWindow
authorDana Jansens <danakj@orodu.net>
Thu, 18 Apr 2002 18:49:22 +0000 (18:49 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 18 Apr 2002 18:49:22 +0000 (18:49 +0000)
src/Workspace.cc

index 6884b10f6449f979c08d96e0e7039f0844da16ba..06bd9d66c9a5ede34ee399dbb5a70341c9d40031 100644 (file)
@@ -549,38 +549,28 @@ void Workspace::placeWindow(OpenboxWindow *win) {
        (slit->placement() == Slit::TopLeft ||
         slit->placement() == Slit::TopRight)) ||
       slit->placement() == Slit::TopCenter)
-    remove = 0;
+    // exclude top
+    space.setY(slit->area().h() + screen.getBorderWidth() * 2);
   else if ((slit->direction() == Slit::Vertical &&
             (slit->placement() == Slit::TopRight ||
              slit->placement() == Slit::BottomRight)) ||
            slit->placement() == Slit::CenterRight)
-    remove = 1;
+    // exclude right
+    space.setW(screen.size().w() -
+               (slit->area().w() + screen.getBorderWidth() * 2));
   else if ((slit->direction() == Slit::Horizontal &&
             (slit->placement() == Slit::BottomLeft ||
              slit->placement() == Slit::BottomRight)) ||
            slit->placement() == Slit::TopCenter)
-    remove = 2;
+    // exclude bottom
+    space.setH(screen.size().h() -
+               (slit->area().h() + screen.getBorderWidth() * 2));
   else// if ((slit->direction() == Slit::Vertical &&
       //      (slit->placement() == Slit::TopLeft ||
       //       slit->placement() == Slit::BottomLeft)) ||
       //     slit->placement() == Slit::CenterLeft)
-    remove = 3;
-  switch (remove) {
-  case 0: // top
-    space.setY(slit->area().h() + screen.getBorderWidth() * 2);
-    break;
-  case 1: // right
-    space.setW(screen.size().w() -
-               (slit->area().w() + screen.getBorderWidth() * 2));
-    break;
-  case 2: // bottom
-    space.setH(screen.size().h() -
-               (slit->area().h() + screen.getBorderWidth() * 2));
-    break;
-  case 3: // left
+    // exclude left
     space.setX(slit->area().w() + screen.getBorderWidth() * 2);
-    break;
-  }
 #endif
 
   Toolbar *toolbar = screen.getToolbar();
This page took 0.030012 seconds and 4 git commands to generate.