X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fepicycle.c;h=65a468162ef9fe5dcbfb7974600652edbd337e31;hb=6a1da724858673ac40aa13a9612340d8bed8c7b9;hp=eed186ca75551629d9b51cdc336ca949619b3797;hpb=0bd2eabab3e404c6769fe8f59b639275e960c415;p=xscreensaver diff --git a/hacks/epicycle.c b/hacks/epicycle.c index eed186ca..65a46816 100644 --- a/hacks/epicycle.c +++ b/hacks/epicycle.c @@ -266,7 +266,10 @@ new_circle_chain(void) /* There are between minCircles and maxCircles in each figure. */ - n = minCircles + rand() % (maxCircles - minCircles); + if (maxCircles == minCircles) + n = minCircles; /* Avoid division by zero. */ + else + n = minCircles + random() % (maxCircles - minCircles); head = NULL; while (n--) @@ -534,6 +537,10 @@ check_events (void) /* X event handler [ rhess ] */ printf("re-mapped!\n"); unmapped = 0; break; + + default: + screenhack_handle_event(dpy, &e); + break; } /* If we're unmapped, don't return to the caller. This @@ -580,8 +587,10 @@ setup(void) } else { - XSelectInput(dpy, window, - ExposureMask|ButtonPressMask|StructureNotifyMask); + XGetWindowAttributes (dpy, window, &xgwa); + XSelectInput (dpy, window, + xgwa.your_event_mask | ExposureMask | + ButtonPressMask |StructureNotifyMask); } } @@ -814,6 +823,7 @@ screenhack(Display *disp, Window win) { XSync (dpy, False); + check_events(); if (holdtime) sleep(holdtime); /* show complete figure for a bit. */ @@ -821,6 +831,7 @@ screenhack(Display *disp, Window win) } + check_events(); if (delay) usleep (delay);