+#ifdef HAVE_XINERAMA
+ if (xinerama_p && placement_only_p)
+ {
+ int nscreens = 0;
+ XineramaScreenInfo *xsi = XineramaQueryScreens (si->dpy, &nscreens);
+ if (xsi)
+ {
+ /* Find the screen that contains the mouse. */
+ int which = -1;
+ int i;
+ for (i = 0; i < nscreens; i++)
+ {
+ if (target_x >= xsi[i].x_org &&
+ target_y >= xsi[i].y_org &&
+ target_x < xsi[i].x_org + xsi[i].width &&
+ target_y < xsi[i].y_org + xsi[i].height)
+ which = i;
+ if (verbose_p)
+ {
+ fprintf (stderr, "%s: %d: xinerama vp: %dx%d+%d+%d",
+ blurb(), i,
+ xsi[which].width, xsi[which].height,
+ xsi[i].x_org, xsi[i].y_org);
+ if (which == i)
+ fprintf (stderr, "; mouse at %d,%d",
+ target_x, target_y);
+ fprintf (stderr, ".\n");
+ }
+ }
+ if (which == -1) which = 0; /* didn't find it? Use the first. */
+ *x_ret = xsi[which].x_org;
+ *y_ret = xsi[which].y_org;
+ *w_ret = xsi[which].width;
+ *h_ret = xsi[which].height;
+ XFree (xsi);
+ return;
+ }
+ }
+#endif /* HAVE_XINERAMA */