Place a window in the smallest area it fits in, not the largest we can find
authorMikael Magnusson <mikachu@gmail.com>
Wed, 10 Feb 2010 02:35:47 +0000 (03:35 +0100)
committerMikael Magnusson <mikachu@gmail.com>
Sun, 19 Sep 2010 15:53:57 +0000 (17:53 +0200)
openbox/place.c

index d9919d0cadd3ed09c53e23a820d1642f006fad07..24a0c1b5da9681f33919c15ade74a0b8cc588ca6 100644 (file)
@@ -233,13 +233,13 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
     Rect **areas;
     gint ignore;
     gboolean ret;
-    gint maxsize;
+    gint minsize;
     GSList *spaces = NULL, *sit, *maxit;
     guint i;
 
     areas = pick_head(c);
     ret = FALSE;
-    maxsize = 0;
+    minsize = 0;
     maxit = NULL;
 
     /* try ignoring different things to find empty space */
@@ -310,9 +310,9 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
 
                 if (r->width >= c->frame->area.width &&
                     r->height >= c->frame->area.height &&
-                    r->width * r->height > maxsize)
+                    (!minsize || r->width * r->height < minsize))
                 {
-                    maxsize = r->width * r->height;
+                    minsize = r->width * r->height;
                     maxit = sit;
                 }
             }