+ if (!RECT_INTERSECTS_RECT(*monitor, *search)) {
+ /* If we don't intersect then find the distance between the search
+ rect and the monitor. We'll use the closest monitor from this
+ metric if none of the monitors intersect. */
+ guint distance = rect_manhatten_distance(*monitor, *search);
+
+ if (distance < closest_distance) {
+ closest_distance = distance;
+ closest_distance_index = i;
+ }
+ continue;
+ }
+