-static gint area_cmp(gconstpointer p1, gconstpointer p2, gpointer data)
-{
- ObClient *c = data;
- Rect *carea = &c->frame->area;
- const Rect *a1 = p1, *a2 = p2;
- gboolean diffhead = FALSE;
- guint i;
- Rect *a;
-
- for (i = 0; i < screen_num_monitors; ++i) {
- a = screen_physical_area_monitor(i);
- if (RECT_CONTAINS(*a, a1->x, a1->y) &&
- !RECT_CONTAINS(*a, a2->x, a2->y))
- {
- diffhead = TRUE;
- break;
- }
- }
-
- /* 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)
+enum {
+ IGNORE_FULLSCREEN = 1 << 0,
+ IGNORE_MAXIMIZED = 1 << 1,
+ IGNORE_MENUTOOL = 1 << 2,
+ /*IGNORE_SHADED = 1 << 3,*/
+ IGNORE_NONGROUP = 1 << 3,
+ IGNORE_BELOW = 1 << 4,
+ IGNORE_NONFOCUS = 1 << 5,
+ IGNORE_END = 1 << 6
+};
+
+static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)