]> Dogcows Code - chaz/openbox/commitdiff
even better bestfit placement. way to go colophon!
authorDana Jansens <danakj@orodu.net>
Sun, 21 Apr 2002 03:36:09 +0000 (03:36 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 21 Apr 2002 03:36:09 +0000 (03:36 +0000)
src/Workspace.cc

index 70b043c062e81d384e044f02ade89fda4bf1a2e9..4b6c23b4dcfcf9f2f3fbbba2f72874a9895acb2b 100644 (file)
@@ -391,11 +391,14 @@ Point *Workspace::bestFitPlacement(const Size &win_size, const Rect &space)
   //Find first space that fits the window
   best = NULL;
   for (siter=spaces.begin(); siter!=spaces.end(); ++siter) {
-    if ((siter->w() >= win_size.w()) &&
-        (siter->h() >= win_size.h()))
-      best = siter;
+    if ((siter->w() >= win_size.w()) && (siter->h() >= win_size.h())) {
+      if (best == NULL)
+        best = siter;
+      else if (win_size.w() * win_size.h() - siter->w() * siter->h() <
+               best->w() + best->h())
+        best = siter;
+    }
   }
-
   if (best != NULL) {
     Point *pt = new Point(best->origin());
     if (screen.colPlacementDirection() != BScreen::TopBottom)
This page took 0.023735 seconds and 4 git commands to generate.