place_least_overlap(): fix leak
authorDavid Vogt <dv@winged.ch>
Thu, 2 Jun 2011 20:39:19 +0000 (22:39 +0200)
committerDana Jansens <danakj@orodu.net>
Mon, 1 Oct 2012 00:37:28 +0000 (20:37 -0400)
Also, use pick_head() info from caller instead of calling it again
in place_least_overlap(), thus saving a little bit of overhead.

openbox/place.c

index cbfc88744a159de694835c4696324b0cc7f94e88..c0ae93a813194a5402835a913ffdd0e5d15639c4 100644 (file)
@@ -559,7 +559,7 @@ static gboolean place_transient_splash(ObClient *client, Rect *area,
     return FALSE;
 }
 
-static gboolean place_least_overlap(ObClient *c, gboolean foreground, gint *x, gint *y)
+static gboolean place_least_overlap(ObClient *c, gboolean foreground, gint *x, gint *y, Rect * const head)
 {
     /* assemble the list of "interesting" windows to calculate overlap against */
     GSList* interesting_clients = NULL;
@@ -598,9 +598,6 @@ static gboolean place_least_overlap(ObClient *c, gboolean foreground, gint *x, g
     }
     g_slist_free(interesting_clients);
 
-    /* add the monitor */
-    Rect * const head = pick_head(c, foreground);
-
     Point result;
     Size req_size;
     SIZE_SET(req_size, c->frame->area.width, c->frame->area.height);
@@ -633,8 +630,10 @@ gboolean place_client(ObClient *client, gboolean foreground, gint *x, gint *y,
     /* try a number of methods */
     ret = place_per_app_setting(client, area, x, y, settings) ||
         place_transient_splash(client, area, x, y) ||
-        (config_place_policy == OB_PLACE_POLICY_MOUSE        && place_under_mouse  (client,       x, y)) ||
-        (config_place_policy == OB_PLACE_POLICY_LEASTOVERLAP && place_least_overlap(client, foreground, x, y)) ||
+        (config_place_policy == OB_PLACE_POLICY_MOUSE
+            && place_under_mouse  (client, x, y)) ||
+        (config_place_policy == OB_PLACE_POLICY_LEASTOVERLAP
+            && place_least_overlap(client, foreground, x, y, area)) ||
         place_nooverlap(client, area, x, y) ||
         place_random(client, area, x, y);
     g_assert(ret);