+ i = screen_monitor_primary(FALSE);
+ if (i < screen_num_monitors) {
+ choice[i].flags |= HEAD_PRIMARY;
+ if (config_place_monitor == OB_PLACE_MONITOR_PRIMARY)
+ choice[i].flags |= HEAD_PLACED;
+ if (settings &&
+ settings->monitor_type == OB_PLACE_MONITOR_PRIMARY)
+ choice[i].flags |= HEAD_PERAPP;
+ }
+
+ i = screen_monitor_active();
+ if (i < screen_num_monitors) {
+ if (config_place_monitor == OB_PLACE_MONITOR_ACTIVE)
+ choice[i].flags |= HEAD_PLACED;
+ if (settings &&
+ settings->monitor_type == OB_PLACE_MONITOR_ACTIVE)
+ choice[i].flags |= HEAD_PERAPP;
+ }
+
+ i = screen_monitor_pointer();
+ if (i < screen_num_monitors) {
+ if (config_place_monitor == OB_PLACE_MONITOR_MOUSE)
+ choice[i].flags |= HEAD_PLACED;
+ if (settings &&
+ settings->monitor_type == OB_PLACE_MONITOR_MOUSE)
+ choice[i].flags |= HEAD_PERAPP;
+ }
+
+ if (settings) {
+ i = settings->monitor - 1;
+ if (i < screen_num_monitors)
+ choice[i].flags |= HEAD_PERAPP;
+ }
+
+ /* direct parent takes highest precedence */
+ if ((p = client_direct_parent(c))) {
+ i = client_monitor(p);
+ if (i < screen_num_monitors)
+ choice[i].flags |= HEAD_PARENT;
+ }
+
+ qsort(choice, screen_num_monitors, sizeof(ObPlaceHead),
+ client_to_be_foregrounded ? cmp_foreground : cmp_background);
+
+ /* save the areas of the monitors in order of their being chosen */
+ for (i = 0; i < screen_num_monitors; ++i)
+ {
+ ob_debug("placement choice %d is monitor %d", i, choice[i].monitor);
+ if (choice[i].flags & HEAD_PARENT)
+ ob_debug(" - parent on monitor");
+ if (choice[i].flags & HEAD_PLACED)
+ ob_debug(" - placement choice");
+ if (choice[i].flags & HEAD_PRIMARY)
+ ob_debug(" - primary monitor");
+ if (choice[i].flags & HEAD_GROUP_DESK)
+ ob_debug(" - group on same desktop");
+ if (choice[i].flags & HEAD_GROUP)
+ ob_debug(" - group on other desktop");
+ }
+
+ area = screen_area(c->desktop, choice[0].monitor, NULL);
+
+ g_free(choice);
+
+ /* return the area for the chosen monitor */
+ return area;