http://ftp.x.org/contrib/applications/xscreensaver-3.19.tar.gz
[xscreensaver] / hacks / imsmap.c
index 54e8a77409eff781728f5d9e2d4f02655c063a65..f89f95fede33925458a1d8262c4fbab7171f33bb 100644 (file)
@@ -27,7 +27,7 @@
 #define COUNT (1 << NSTEPS)
 #define CELL(c, r) cell[((unsigned int)(c)) + ((unsigned int) (r)) * xmax]
 
-static enum mode_t { MODE_H, MODE_S, MODE_V, MODE_RANDOM } mode;
+static enum imsmap_mode { MODE_H, MODE_S, MODE_V, MODE_RANDOM } mode;
 
 static GC gc, gc2;
 static XWindowAttributes xgwa;
@@ -55,7 +55,7 @@ init_map (Display *dpy, Window window)
   int fg_h, bg_h;
   double fg_s, fg_v, bg_s, bg_v;
 
-  enum mode_t this_mode;
+  enum imsmap_mode this_mode;
   static Bool rv_p;
     
   XGCValues gcv;
@@ -439,22 +439,23 @@ draw_map (Display *dpy, Window window)
       xstep = xnextStep;
       ystep = ynextStep;
       if (!mono_p)
-       XSync (dpy, True);
+       XSync (dpy, False);
+      screenhack_handle_events (dpy);
     }
   if (mono_p)
     /* in mono-mode, we do all the drawing at the end */
     floyd_steinberg (dpy, window);
   
   free (cell);
-  XSync (dpy, True);
+  XSync (dpy, False);
 }
 
 
 char *progclass = "Imsmap";
 
 char *defaults [] = {
-  "Imsmap.background:  black",         /* to placate SGI */
-  "Imsmap.foreground:  black",
+  ".background:        black",
+  ".foreground:        black",
   "*mode:      random",
   "*ncolors:   50",
   "*iterations:        7",
@@ -493,10 +494,14 @@ screenhack (Display *dpy, Window window)
                    rotate_colors (dpy, cmap, colors, ncolors,
                                   cycle_direction);
                    if (cycle_delay) usleep(cycle_delay);
+                    screenhack_handle_events (dpy);
                  }
              }
            else
-             sleep (delay);
+              {
+                screenhack_handle_events (dpy);
+                sleep (delay);
+              }
          }
       }
 }