X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fgalaxy.c;h=7f72af5b2ccb22b0aee64cb6c13af4805341d13f;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hp=43a0b5bf49500f609d58bbc90393bda0d5b5ae48;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/hacks/galaxy.c b/hacks/galaxy.c index 43a0b5bf..7f72af5b 100644 --- a/hacks/galaxy.c +++ b/hacks/galaxy.c @@ -45,9 +45,10 @@ static const char sccsid[] = "@(#)galaxy.c 4.04 97/07/28 xlockmore"; "*cycles: 250 \n" \ "*ncolors: 64 \n" \ "*fpsSolid: true \n" \ + "*ignoreRotation: True \n" \ # define UNIFORM_COLORS -# define galaxy_handle_event 0 +# define release_galaxy 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ @@ -158,8 +159,9 @@ x-axis */ static unistruct *universes = NULL; static void -free_galaxies(unistruct * gp) +free_galaxies(ModeInfo * mi) { + unistruct *gp = &universes[MI_SCREEN(mi)]; if (gp->galaxies != NULL) { int i; @@ -191,7 +193,7 @@ startover(ModeInfo * mi) gp->rot_x = 0; if (MI_BATCHCOUNT(mi) < -MINGALAXIES) - free_galaxies(gp); + free_galaxies(mi); gp->ngalaxies = MI_BATCHCOUNT(mi); if (gp->ngalaxies < -MINGALAXIES) gp->ngalaxies = NRAND(-gp->ngalaxies - MINGALAXIES + 1) + MINGALAXIES; @@ -306,14 +308,10 @@ init_galaxy(ModeInfo * mi) { unistruct *gp; - if (universes == NULL) { - if ((universes = (unistruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (unistruct))) == NULL) - return; - } + MI_INIT (mi, universes, free_galaxies); gp = &universes[MI_SCREEN(mi)]; -# ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */ +# ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */ dbufp = False; # endif @@ -447,22 +445,21 @@ reshape_galaxy(ModeInfo * mi, int width, int height) } ENTRYPOINT void -release_galaxy(ModeInfo * mi) +refresh_galaxy(ModeInfo * mi) { - if (universes != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) - free_galaxies(&universes[screen]); - (void) free((void *) universes); - universes = NULL; - } + /* Do nothing, it will refresh by itself */ } -ENTRYPOINT void -refresh_galaxy(ModeInfo * mi) +ENTRYPOINT Bool +galaxy_handle_event (ModeInfo *mi, XEvent *event) { - /* Do nothing, it will refresh by itself */ + if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) + { + reshape_galaxy (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + return True; + } + return False; } + XSCREENSAVER_MODULE ("Galaxy", galaxy)