From: David Vogt Date: Thu, 2 Jun 2011 20:39:19 +0000 (+0200) Subject: place_least_overlap(): fix leak X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=61e1cc0e195453af01817aee675ce6a25fa87fc8;p=dana%2Fopenbox.git place_least_overlap(): fix leak Also, use pick_head() info from caller instead of calling it again in place_least_overlap(), thus saving a little bit of overhead. --- diff --git a/openbox/place.c b/openbox/place.c index cbfc8874..c0ae93a8 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -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);