+ if (si->xinerama_p)
+ {
+ XineramaScreenInfo *xsi = XineramaQueryScreens (si->dpy, &si->nscreens);
+ if (!xsi)
+ si->xinerama_p = False;
+ else
+ {
+ si->screens = (saver_screen_info *)
+ calloc(sizeof(saver_screen_info), si->nscreens);
+ for (i = 0; i < si->nscreens; i++)
+ {
+ si->screens[i].x = xsi[i].x_org;
+ si->screens[i].y = xsi[i].y_org;
+ si->screens[i].width = xsi[i].width;
+ si->screens[i].height = xsi[i].height;
+ }
+ XFree (xsi);
+ }
+ si->default_screen = &si->screens[0];
+ si->default_screen->real_screen_p = True;
+ }
+# endif /* !HAVE_XINERAMA */
+
+ if (!si->xinerama_p)
+ {
+ si->nscreens = ScreenCount(si->dpy);
+ si->screens = (saver_screen_info *)
+ calloc(sizeof(saver_screen_info), si->nscreens);
+ si->default_screen = &si->screens[DefaultScreen(si->dpy)];
+
+ for (i = 0; i < si->nscreens; i++)
+ {
+ saver_screen_info *ssi = &si->screens[i];
+ ssi->width = DisplayWidth (si->dpy, i);
+ ssi->height = DisplayHeight (si->dpy, i);
+ ssi->real_screen_p = True;
+ ssi->real_screen_number = i;
+ }
+ }
+
+
+ /* In "quad mode", we use the Xinerama code to pretend that there are 4
+ screens for every physical screen, and run four times as many hacks...
+ */
+ if (si->prefs.quad_p)
+ {
+ int ns2 = si->nscreens * 4;
+ saver_screen_info *ssi2 = (saver_screen_info *)
+ calloc(sizeof(saver_screen_info), ns2);
+
+ for (i = 0; i < si->nscreens; i++)
+ {
+ saver_screen_info *old = &si->screens[i];
+
+ if (si->prefs.debug_p) old->width = old->width / 2;
+
+ ssi2[i*4 ] = *old;
+ ssi2[i*4+1] = *old;
+ ssi2[i*4+2] = *old;
+ ssi2[i*4+3] = *old;
+
+ ssi2[i*4 ].width /= 2;
+ ssi2[i*4 ].height /= 2;
+
+ ssi2[i*4+1].x += ssi2[i*4 ].width;
+ ssi2[i*4+1].width -= ssi2[i*4 ].width;
+ ssi2[i*4+1].height /= 2;
+
+ ssi2[i*4+2].y += ssi2[i*4 ].height;
+ ssi2[i*4+2].width /= 2;
+ ssi2[i*4+2].height -= ssi2[i*4 ].height;
+
+ ssi2[i*4+3].x += ssi2[i*4+2].width;
+ ssi2[i*4+3].y += ssi2[i*4+2].height;
+ ssi2[i*4+3].width -= ssi2[i*4+2].width;
+ ssi2[i*4+3].height -= ssi2[i*4+2].height;
+
+ ssi2[i*4+1].real_screen_p = False;
+ ssi2[i*4+2].real_screen_p = False;
+ ssi2[i*4+3].real_screen_p = False;
+ }
+
+ si->nscreens = ns2;
+ free (si->screens);
+ si->screens = ssi2;
+ si->default_screen = &si->screens[DefaultScreen(si->dpy) * 4];
+ si->xinerama_p = True;
+ }
+
+ /* finish initializing the screens.
+ */