]> Dogcows Code - chaz/openbox/commitdiff
bestfit placement now honors the left->right and top->bottom options for window place...
authorDana Jansens <danakj@orodu.net>
Sun, 21 Apr 2002 02:02:27 +0000 (02:02 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 21 Apr 2002 02:02:27 +0000 (02:02 +0000)
fix for the placement config menu.

src/Configmenu.cc
src/Workspace.cc

index a12ca5ad1ac1f0f60161302bd4041152a82a34de..413e0b250a2b54664aa252bc5810e4d548c92142 100644 (file)
@@ -356,16 +356,16 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
   case BScreen::TopBottom:
     configmenu->screen.setColPlacementDirection(BScreen::TopBottom);
 
-    setItemSelected(5, True);
-    setItemSelected(6, False);
+    setItemSelected(6, True);
+    setItemSelected(7, False);
 
     break;
 
   case BScreen::BottomTop:
     configmenu->screen.setColPlacementDirection(BScreen::BottomTop);
 
-    setItemSelected(5, False);
-    setItemSelected(6, True);
+    setItemSelected(6, False);
+    setItemSelected(7, True);
 
     break;
   }
index 5f8817cb4023e8d92ef2616f4538286b2317d782..70b043c062e81d384e044f02ade89fda4bf1a2e9 100644 (file)
@@ -396,9 +396,14 @@ Point *Workspace::bestFitPlacement(const Size &win_size, const Rect &space)
       best = siter;
   }
 
-  if (best != NULL)
-    return new Point(best->origin());
-  else
+  if (best != NULL) {
+    Point *pt = new Point(best->origin());
+    if (screen.colPlacementDirection() != BScreen::TopBottom)
+      pt->setY(pt->y() + (best->h() - win_size.h()));
+    if (screen.rowPlacementDirection() != BScreen::LeftRight)
+      pt->setX(pt->x() + (best->w() - win_size.w()));
+    return pt;
+  } else
     return NULL; //fall back to cascade
 }
 
This page took 0.028833 seconds and 4 git commands to generate.