optimized the finding-the-slit-position code in positionWindow

This commit is contained in:
Dana Jansens 2002-04-18 18:49:22 +00:00
parent 83b39a9a3e
commit fa90396976

View file

@ -549,38 +549,28 @@ void Workspace::placeWindow(OpenboxWindow *win) {
(slit->placement() == Slit::TopLeft || (slit->placement() == Slit::TopLeft ||
slit->placement() == Slit::TopRight)) || slit->placement() == Slit::TopRight)) ||
slit->placement() == Slit::TopCenter) slit->placement() == Slit::TopCenter)
remove = 0; // exclude top
space.setY(slit->area().h() + screen.getBorderWidth() * 2);
else if ((slit->direction() == Slit::Vertical && else if ((slit->direction() == Slit::Vertical &&
(slit->placement() == Slit::TopRight || (slit->placement() == Slit::TopRight ||
slit->placement() == Slit::BottomRight)) || slit->placement() == Slit::BottomRight)) ||
slit->placement() == Slit::CenterRight) 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 && else if ((slit->direction() == Slit::Horizontal &&
(slit->placement() == Slit::BottomLeft || (slit->placement() == Slit::BottomLeft ||
slit->placement() == Slit::BottomRight)) || slit->placement() == Slit::BottomRight)) ||
slit->placement() == Slit::TopCenter) 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 && else// if ((slit->direction() == Slit::Vertical &&
// (slit->placement() == Slit::TopLeft || // (slit->placement() == Slit::TopLeft ||
// slit->placement() == Slit::BottomLeft)) || // slit->placement() == Slit::BottomLeft)) ||
// slit->placement() == Slit::CenterLeft) // slit->placement() == Slit::CenterLeft)
remove = 3; // exclude left
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
space.setX(slit->area().w() + screen.getBorderWidth() * 2); space.setX(slit->area().w() + screen.getBorderWidth() * 2);
break;
}
#endif #endif
Toolbar *toolbar = screen.getToolbar(); Toolbar *toolbar = screen.getToolbar();