+void
+grab_screen_image (Screen *screen, Window window)
+{
+#ifdef HAVE_SGI_VIDEO
+ char c, *s = get_string_resource("grabVideoProbability", "Float");
+ double prob = -1;
+ if (!s ||
+ (1 != sscanf (s, " %lf %c", &prob, &c)) ||
+ prob < 0 ||
+ prob > 1)
+ prob = 0.5;
+
+ if ((random() % 100) < ((int) (100 * prob)))
+ {
+ XWindowAttributes xgwa;
+ Display *dpy = DisplayOfScreen (screen);
+ XGetWindowAttributes (dpy, window, &xgwa);
+# ifdef DEBUG
+ fprintf(stderr, "%s: trying to grab from video...\n", progname);
+# endif /* DEBUG */
+ if (grab_video_frame (screen, xgwa.visual, window))
+ {
+ if (xgwa.depth < 24)
+ {
+ int class = visual_class (screen, xgwa.visual);
+ if (class == PseudoColor || class == DirectColor)
+ make_cubic_colormap (screen, window, xgwa.visual);
+ }
+ return;
+ }
+ }
+#endif /* HAVE_SGI_VIDEO */
+
+ grab_screen_image_1 (screen, window);
+}
+