X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=driver%2Fwindows.c;h=23ba01ff3fa75f9ac15e1c6272016c723731bd01;hp=60de0a92fa2a51dd7069a995caf5c0f4a2618481;hb=c494fd2e6b3b25582375d62e40f4f5cc984ca424;hpb=ffd8c0873576a9e3065696a624dce6b766b77062 diff --git a/driver/windows.c b/driver/windows.c index 60de0a92..23ba01ff 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -1,5 +1,5 @@ /* windows.c --- turning the screen black; dealing with visuals, virtual roots. - * xscreensaver, Copyright (c) 1991-2004 Jamie Zawinski + * xscreensaver, Copyright (c) 1991-2007 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,7 +30,7 @@ #endif /* HAVE_UNAME */ #include -#include /* for CARD32 */ +/* #include / * for CARD32 */ #include #include /* for XSetClassHint() */ #include @@ -39,6 +39,13 @@ #include #include +/* You might think that to store an array of 32-bit quantities onto a + server-side property, you would pass an array of 32-bit data quantities + into XChangeProperty(). You would be wrong. You have to use an array + of longs, even if long is 64 bits (using 32 of each 64.) + */ +typedef long PROP32; + #ifdef HAVE_MIT_SAVER_EXTENSION # include #endif /* HAVE_MIT_SAVER_EXTENSION */ @@ -966,16 +973,16 @@ store_saver_id (saver_screen_info *ssi) void store_saver_status (saver_info *si) { - CARD32 *status; + PROP32 *status; int size = si->nscreens + 2; int i; - status = (CARD32 *) calloc (size, sizeof(CARD32)); + status = (PROP32 *) calloc (size, sizeof(PROP32)); - status[0] = (CARD32) (si->screen_blanked_p + status[0] = (PROP32) (si->screen_blanked_p ? (si->locked_p ? XA_LOCK : XA_BLANK) : 0); - status[1] = (CARD32) si->blank_time; + status[1] = (PROP32) si->blank_time; for (i = 0; i < si->nscreens; i++) { @@ -1412,7 +1419,12 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) attrs.backing_pixel = ssi->black_pixel; attrs.border_pixel = ssi->black_pixel; - if (p->debug_p && !p->quad_p) width = width / 2; + if (p->debug_p +# ifdef QUAD_MODE + && !p->quad_p +# endif + ) + width = width / 2; if (!p->verbose_p || printed_visual_info) ; @@ -1590,9 +1602,21 @@ resize_screensaver_window (saver_info *si) */ int nscreens; XineramaScreenInfo *xsi = XineramaQueryScreens (si->dpy, &nscreens); - if (nscreens != si->nscreens) abort(); + + if (nscreens != si->nscreens) { + /* Apparently some Xinerama implementations let you use a hot-key + to change the number of screens in use! This is, of course, + documented nowhere. Let's try to do something marginally less + bad than crashing. + */ + fprintf (stderr, "%s: bad craziness: xinerama screen count changed " + "from %d to %d!\n", blurb(), si->nscreens, nscreens); + if (nscreens > si->nscreens) + nscreens = si->nscreens; + } + if (!xsi) abort(); - for (i = 0; i < si->nscreens; i++) + for (i = 0; i < nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; if (p->verbose_p && @@ -1670,7 +1694,12 @@ resize_screensaver_window (saver_info *si) changes.height = height; changes.border_width = 0; - if (p->debug_p && !p->quad_p) changes.width = changes.width / 2; + if (p->debug_p +# ifdef QUAD_MODE + && !p->quad_p +# endif + ) + changes.width = changes.width / 2; if (p->verbose_p) fprintf (stderr, @@ -1978,7 +2007,7 @@ unblank_screen (saver_info *si) /* If the focus window does has a non-default colormap, then install that colormap as well. (On SGIs, this will cause both the root map - and the focus map to be installed simultaniously. It'd be nice to + and the focus map to be installed simultaneously. It'd be nice to pick up the other colormaps that had been installed, too; perhaps XListInstalledColormaps could be used for that?) */