smart placement only avoids the focused window, and centers in its area
This commit is contained in:
parent
617a98d432
commit
21c29cba10
1 changed files with 7 additions and 5 deletions
|
@ -127,7 +127,7 @@ static gint area_cmp(gconstpointer p1, gconstpointer p2)
|
||||||
gint ret;
|
gint ret;
|
||||||
const Rect *a1 = p1, *a2 = p2;
|
const Rect *a1 = p1, *a2 = p2;
|
||||||
|
|
||||||
ret = RECT_BOTTOM(*a1) - RECT_BOTTOM(*a2);
|
ret = RECT_TOP(*a1) - RECT_TOP(*a2);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = RECT_LEFT(*a1) - RECT_LEFT(*a2);
|
ret = RECT_LEFT(*a1) - RECT_LEFT(*a2);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -137,7 +137,7 @@ static gboolean place_smart(ObClient *client, gint *x, gint *y)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GSList *spaces, *sit;
|
GSList *spaces = NULL, *sit;
|
||||||
GList *it, *list;
|
GList *it, *list;
|
||||||
|
|
||||||
list = focus_order[client->desktop == DESKTOP_ALL ?
|
list = focus_order[client->desktop == DESKTOP_ALL ?
|
||||||
|
@ -149,8 +149,10 @@ static gboolean place_smart(ObClient *client, gint *x, gint *y)
|
||||||
for (it = list; it; it = g_list_next(it)) {
|
for (it = list; it; it = g_list_next(it)) {
|
||||||
ObClient *c = it->data;
|
ObClient *c = it->data;
|
||||||
|
|
||||||
if (c != client && !c->shaded && client_normal(c))
|
if (c != client && !c->shaded && client_normal(c)) {
|
||||||
spaces = area_remove(spaces, &c->frame->area);
|
spaces = area_remove(spaces, &c->frame->area);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spaces = g_slist_sort(spaces, area_cmp);
|
spaces = g_slist_sort(spaces, area_cmp);
|
||||||
|
@ -162,8 +164,8 @@ static gboolean place_smart(ObClient *client, gint *x, gint *y)
|
||||||
if (r->width >= client->frame->area.width &&
|
if (r->width >= client->frame->area.width &&
|
||||||
r->height >= client->frame->area.height) {
|
r->height >= client->frame->area.height) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
*x = r->x;
|
*x = r->x + (r->width - client->frame->area.width) / 2;
|
||||||
*y = r->y;
|
*y = r->y + (r->height - client->frame->area.height) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue