X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fmorph3d.c;h=078044496b5fa57d31990b708f740b7adc8a6cab;hb=39809ded547bdbb08207d3e514950425215b4410;hp=e96309acc5817fd2f1f3d2571e481a9f40dc9915;hpb=aa75c7476aeaa84cf3abc192b376a8b03c325213;p=xscreensaver diff --git a/hacks/glx/morph3d.c b/hacks/glx/morph3d.c index e96309ac..07804449 100644 --- a/hacks/glx/morph3d.c +++ b/hacks/glx/morph3d.c @@ -58,8 +58,9 @@ static const char sccsid[] = "@(#)morph3d.c 5.01 2001/03/01 xlockmore"; "*count: 0 \n" \ "*suppressRotationAnimation: True\n" \ -# define refresh_morph3d 0 -# define morph3d_handle_event 0 +# define free_morph3d 0 +# define release_morph3d 0 +# define morph3d_handle_event xlockmore_no_events # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ @@ -72,7 +73,7 @@ ENTRYPOINT ModeSpecOpt morph3d_opts = #ifdef USE_MODULES ModStruct morph3d_description = -{"morph3d", "init_morph3d", "draw_morph3d", "release_morph3d", +{"morph3d", "init_morph3d", "draw_morph3d", (char *) NULL, "draw_morph3d", "change_morph3d", (char *) NULL, &morph3d_opts, 1000, 0, 1, 1, 4, 1.0, "", "Shows GL morphing polyhedra", 0, NULL}; @@ -594,8 +595,14 @@ ENTRYPOINT void reshape_morph3d(ModeInfo * mi, int width, int height) { morph3dstruct *mp = &morph3d[MI_SCREEN(mi)]; + int y = 0; - glViewport(0, 0, mp->WindW = (GLint) width, mp->WindH = (GLint) height); + if (width > height * 5) { /* tiny window: show middle */ + height = width; + y = -height/2; + } + + glViewport(0, y, mp->WindW = (GLint) width, mp->WindH = (GLint) height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0); @@ -718,11 +725,7 @@ init_morph3d(ModeInfo * mi) { morph3dstruct *mp; - if (morph3d == NULL) { - if ((morph3d = (morph3dstruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (morph3dstruct))) == NULL) - return; - } + MI_INIT (mi, morph3d); mp = &morph3d[MI_SCREEN(mi)]; mp->step = NRAND(90); mp->VisibleSpikes = 1; @@ -829,16 +832,6 @@ change_morph3d(ModeInfo * mi) } #endif /* !STANDALONE */ -ENTRYPOINT void -release_morph3d(ModeInfo * mi) -{ - if (morph3d != NULL) { - (void) free((void *) morph3d); - morph3d = (morph3dstruct *) NULL; - } - FreeAllGL(mi); -} - #endif XSCREENSAVER_MODULE ("Morph3D", morph3d)