http://ftp.x.org/contrib/applications/xscreensaver-3.17.tar.gz
[xscreensaver] / hacks / distort.c
index 7eed6281c8b9c4d3ecef180c77956506ae080fd9..74bcf4585cc3e04dd1b4024248b2dbef97123c7d 100644 (file)
@@ -377,7 +377,7 @@ static void init_round_lense(void)
 
 
 /* generate an XImage of from[][][] and draw it on the screen */
-void plain_draw(int k)
+static void plain_draw(int k)
 {
        int i, j;
        for(i = 0 ; i < 2*radius+speed+2; i++) {
@@ -403,7 +403,7 @@ void plain_draw(int k)
  * it should be possible to use the from[][] to speed it up
  * (once I figure out the algorithm used :)
  */
-void reflect_draw(int k)
+static void reflect_draw(int k)
 {
        int i, j;
        int     cx, cy;
@@ -432,8 +432,8 @@ void reflect_draw(int k)
                        else {
                                int     x = xy_coo[k].x + cx + (lx * rsq / dist);
                                int     y = xy_coo[k].y + cy + (ly * rsq / dist);
-                               if (x < 0 || x > xgwa.width ||
-                                       y < 0 || y > xgwa.height)
+                               if (x < 0 || x >= xgwa.width ||
+                                       y < 0 || y >= xgwa.height)
                                        XPutPixel( buffer_map, j, i, black_pixel );
                                else
                                        XPutPixel( buffer_map, j, i,
@@ -511,7 +511,7 @@ static void move_lense(int k)
 }
 
 /* make xy_coo[k] grow/shrink */
-void swamp_thing(int k)
+static void swamp_thing(int k)
 {
        if (xy_coo[k].r >= radius)
                xy_coo[k].r_change = -abs(xy_coo[k].r_change);
@@ -592,7 +592,8 @@ void screenhack(Display *dpy, Window window)
                        draw(k);
                }
 
-               XSync(dpy, True);
+               XSync(dpy, False);
+        screenhack_handle_events (dpy);
                if (delay) usleep(delay);
        }