From http://www.jwz.org/xscreensaver/xscreensaver-5.22.tar.gz
[xscreensaver] / hacks / xlockmore.c
index 34cffeb1c60482813fbcd864def957a8cbe5c51c..23c12b6dc33fb1d75f412609fe6a77dac461a6a3 100644 (file)
@@ -1,5 +1,5 @@
 /* xlockmore.c --- xscreensaver compatibility layer for xlockmore modules.
- * xscreensaver, Copyright (c) 1997-2008 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1997-2013 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -282,7 +282,6 @@ xlockmore_init (Display *dpy, Window window,
   XGCValues gcv;
   XColor color;
   int i;
-  int orig_pause;
   Bool root_p;
 
   if (! xlmft)
@@ -383,18 +382,21 @@ xlockmore_init (Display *dpy, Window window,
       switch (mi->xlmft->desired_color_scheme)
         {
         case color_scheme_uniform:
-          make_uniform_colormap (dpy, mi->xgwa.visual, mi->xgwa.colormap,
+          make_uniform_colormap (mi->xgwa.screen, mi->xgwa.visual,
+                                 mi->xgwa.colormap,
                                  mi->colors, &mi->npixels,
                                  True, &mi->writable_p, True);
           break;
         case color_scheme_smooth:
-          make_smooth_colormap (dpy, mi->xgwa.visual, mi->xgwa.colormap,
+          make_smooth_colormap (mi->xgwa.screen, mi->xgwa.visual,
+                                mi->xgwa.colormap,
                                 mi->colors, &mi->npixels,
                                 True, &mi->writable_p, True);
           break;
         case color_scheme_bright:
         case color_scheme_default:
-          make_random_colormap (dpy, mi->xgwa.visual, mi->xgwa.colormap,
+          make_random_colormap (mi->xgwa.screen, mi->xgwa.visual,
+                                mi->xgwa.colormap,
                                 mi->colors, &mi->npixels,
                                 (mi->xlmft->desired_color_scheme ==
                                  color_scheme_bright),
@@ -444,12 +446,12 @@ xlockmore_init (Display *dpy, Window window,
   mi->use_shm = get_boolean_resource (dpy, "useSHM", "Boolean");
 #endif /* !HAVE_XSHM_EXTENSION */
   mi->fps_p = get_boolean_resource (dpy, "doFPS", "DoFPS");
+  mi->recursion_depth = -1;  /* see fps.c */
 
   if (mi->pause < 0)
     mi->pause = 0;
   else if (mi->pause > 100000000)
     mi->pause = 100000000;
-  orig_pause = mi->pause;
 
   /* If this hack uses fonts (meaning, mentioned "font" in DEFAULTS)
      then load it. */
@@ -525,6 +527,15 @@ xlockmore_event (Display *dpy, Window window, void *closure, XEvent *event)
     return False;
 }
 
+void
+xlockmore_do_fps (Display *dpy, Window w, fps_state *fpst, void *closure)
+{
+  ModeInfo *mi = (ModeInfo *) closure;
+  fps_compute (fpst, 0, mi ? mi->recursion_depth : -1);
+  fps_draw (fpst);
+}
+
+
 static void
 xlockmore_free (Display *dpy, Window window, void *closure)
 {