+ guint i;
+ for (i = 0; i < screen_num_monitors; ++i) {
+ if (choice[i] == mychoice)
+ return;
+ else if (choice[i] == screen_num_monitors) {
+ choice[i] = mychoice;
+ return;
+ }
+ }
+}
+
+static Rect *pick_pointer_head(ObClient *c)
+{
+ guint i;
+ gint px, py;
+
+ screen_pointer_pos(&px, &py);
+
+ for (i = 0; i < screen_num_monitors; ++i) {
+ if (RECT_CONTAINS(*screen_physical_area_monitor(i), px, py)) {
+ return screen_area_monitor(c->desktop, i);
+ }
+ }
+ g_assert_not_reached();
+}
+
+/*! Pick a monitor to place a window on.
+ The returned array value should be freed with g_free. The areas within the
+ array should not be freed. */
+static Rect **pick_head(ObClient *c)
+{
+ Rect **area;
+ guint *choice;
+ guint i;
+ gint px, py;
+ ObClient *p;
+
+ area = g_new(Rect*, screen_num_monitors);
+ choice = g_new(guint, screen_num_monitors);
+ for (i = 0; i < screen_num_monitors; ++i)
+ choice[i] = screen_num_monitors; /* make them all invalid to start */
+