- }
-
- /* has to be more than me in the group */
- if (diffhead && client_has_group_siblings(c)) {
- guint *num, most;
- GSList *it;
-
- /* find how many clients in the group are on each monitor, use the
- monitor with the most in it */
- num = g_new0(guint, screen_num_monitors);
- for (it = c->group->members; it; it = g_slist_next(it))
- if (it->data != c)
- ++num[client_monitor(it->data)];
- most = 0;
- for (i = 1; i < screen_num_monitors; ++i)
- if (num[i] > num[most])
- most = i;
-
- g_free(num);
-
- a = screen_physical_area_monitor(most);
- if (RECT_CONTAINS(*a, a1->x, a1->y))
- return -1;
- if (RECT_CONTAINS(*a, a2->x, a2->y))
- return 1;
- }
-
- return MIN((a1->width - carea->width), (a1->height - carea->height)) -
- MIN((a2->width - carea->width), (a2->height - carea->height));
-}
-
-typedef enum
-{
- SMART_FULL,
- SMART_GROUP,
- SMART_FOCUSED
-} ObSmartType;
-
-#define SMART_IGNORE(placer, c) \
- (placer == c || c->shaded || !c->frame->visible || \
- c->type == OB_CLIENT_TYPE_SPLASH || c->type == OB_CLIENT_TYPE_DESKTOP || \
- ((c->type == OB_CLIENT_TYPE_MENU || c->type == OB_CLIENT_TYPE_TOOLBAR) &&\
- client_has_parent(c)) || \
- (c->desktop != DESKTOP_ALL && \
- c->desktop != (placer->desktop == DESKTOP_ALL ? \
- screen_desktop : placer->desktop)))
-
-static gboolean place_smart(ObClient *client, gint *x, gint *y,
- ObSmartType type, gboolean ignore_max)
-{
- gboolean ret = FALSE;
- GSList *spaces = NULL, *sit;
- GList *it;
- Rect **areas;
- guint i;
-
- if (type == SMART_GROUP) {
- /* has to be more than me in the group */
- if (!client_has_group_siblings(client))
- return FALSE;
- }
-
- areas = pick_head(client);
-
- for (i = 0; i < screen_num_monitors && !ret; ++i) {
- spaces = area_add(spaces, areas[i]);
-
- /* stay out from under windows in higher layers */
- for (it = stacking_list; it; it = g_list_next(it)) {
- ObClient *c;
-
- if (WINDOW_IS_CLIENT(it->data)) {
- c = it->data;
- if (ignore_max &&
- (c->fullscreen || (c->max_vert && c->max_horz)))
- continue;
- } else
- continue;