+static gboolean place_under_mouse(ObClient *client, gint *x, gint *y)
+{
+ guint i;
+ gint l, r, t, b;
+ gint px, py;
+ Rect *area;
+
+ screen_pointer_pos(&px, &py);
+
+ for (i = 0; i < screen_num_monitors; ++i) {
+ area = screen_area_monitor(client->desktop, i);
+ if (RECT_CONTAINS(*area, px, py))
+ break;
+ }
+ if (i == screen_num_monitors)
+ area = screen_area_monitor(client->desktop, 0);
+
+ l = area->x;
+ t = area->y;
+ r = area->x + area->width - client->frame->area.width;
+ b = area->y + area->height - client->frame->area.height;
+
+ *x = px - client->area.width / 2 - client->frame->size.left;
+ *x = MIN(MAX(*x, l), r);
+ *y = py - client->area.height / 2 - client->frame->size.top;
+ *y = MIN(MAX(*y, t), b);
+
+ return TRUE;
+}
+