+ for (i = 0; i < si->nscreens; i++)
+ {
+ saver_screen_info *ssi = &si->screens[i];
+ if (ssi->cmap)
+ {
+ Colormap c = DefaultColormapOfScreen (ssi->screen);
+ /* avoid technicolor */
+ XClearWindow (si->dpy, ssi->screensaver_window);
+ if (c) XInstallColormap (si->dpy, c);
+ }
+ XUnmapWindow (si->dpy, ssi->screensaver_window);
+ }
+ }
+
+
+ /* 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
+ pick up the other colormaps that had been installed, too; perhaps
+ XListInstalledColormaps could be used for that?)
+ */
+ {
+ Window focus = 0;
+ int revert_to;
+ XGetInputFocus (si->dpy, &focus, &revert_to);
+ if (focus && focus != PointerRoot && focus != None)
+ {
+ XWindowAttributes xgwa;
+ xgwa.colormap = 0;
+ XGetWindowAttributes (si->dpy, focus, &xgwa);
+ if (xgwa.colormap &&
+ xgwa.colormap != DefaultColormapOfScreen (xgwa.screen))
+ XInstallColormap (si->dpy, xgwa.colormap);
+ }
+ }
+
+
+ for (i = 0; i < si->nscreens; i++)
+ {
+ saver_screen_info *ssi = &si->screens[i];
+ kill_xsetroot_data (si->dpy, ssi->screensaver_window, p->verbose_p);
+ }
+
+ store_activate_time(si, False); /* store unblank time */
+
+ ungrab_keyboard_and_mouse (si);
+ restore_real_vroot (si);
+
+#ifdef HAVE_XHPDISABLERESET
+ if (hp_locked_p)
+ {
+ XHPEnableReset (si->dpy); /* turn C-Sh-Reset back on */
+ hp_locked_p = False;
+ }
+#endif
+
+ /* Unmap the windows a second time, dammit -- just to avoid a race
+ with the screen-grabbing hacks. (I'm not sure if this is really
+ necessary; I'm stabbing in the dark now.)
+ */
+ for (i = 0; i < si->nscreens; i++)
+ XUnmapWindow (si->dpy, si->screens[i].screensaver_window);
+
+ si->screen_blanked_p = False;
+}
+
+
+static void
+store_activate_time (saver_info *si, Bool use_last_p)
+{
+ static time_t last_time = 0;
+ time_t now = ((use_last_p && last_time) ? last_time : time ((time_t) 0));
+ CARD32 now32 = (CARD32) now;
+ int i;
+ last_time = now;
+
+ for (i = 0; i < si->nscreens; i++)
+ {
+ saver_screen_info *ssi = &si->screens[i];
+ if (!ssi->screensaver_window) continue;
+ XChangeProperty (si->dpy, ssi->screensaver_window, XA_SCREENSAVER_TIME,
+ XA_INTEGER, 32, PropModeReplace,
+ (unsigned char *) &now32, 1);
+ }
+}
+
+
+Bool
+select_visual (saver_screen_info *ssi, const char *visual_name)
+{
+ saver_info *si = ssi->global;
+ saver_preferences *p = &si->prefs;
+ Bool install_cmap_p = p->install_cmap_p;
+ Bool was_installed_p = (ssi->cmap != DefaultColormapOfScreen(ssi->screen));
+ Visual *new_v;
+ Bool got_it;
+
+ if (visual_name && *visual_name)
+ {
+ if (!strcmp(visual_name, "default-i"))