X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fgeodesicgears.c;h=ecc7f26c05ec8e9e25154920c9952b262019c63a;hb=39809ded547bdbb08207d3e514950425215b4410;hp=dc234809fbda035ad9b5d4b657373b7dec32e844;hpb=aa75c7476aeaa84cf3abc192b376a8b03c325213;p=xscreensaver diff --git a/hacks/glx/geodesicgears.c b/hacks/glx/geodesicgears.c index dc234809..ecc7f26c 100644 --- a/hacks/glx/geodesicgears.c +++ b/hacks/glx/geodesicgears.c @@ -20,7 +20,7 @@ "*suppressRotationAnimation: True\n" \ "*font: -*-helvetica-medium-r-normal-*-*-160-*-*-*-*-*-*\n" \ -# define refresh_geodesic 0 +# define release_geodesic 0 #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) @@ -1315,9 +1315,19 @@ make_182 (ModeInfo *mi, const GLfloat *args) ENTRYPOINT void reshape_geodesic (ModeInfo *mi, int width, int height) { + geodesic_configuration *bp = &bps[MI_SCREEN(mi)]; GLfloat h = (GLfloat) height / (GLfloat) width; + int y = 0; + + if (width > height * 5) { /* tiny window: show middle */ + height = width * 9/16; + y = -height/2; + h = height / (GLfloat) width; + } + + glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context)); - glViewport (0, 0, (GLint) width, (GLint) height); + glViewport (0, y, (GLint) width, (GLint) height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -1405,14 +1415,7 @@ init_geodesic (ModeInfo *mi) geodesic_configuration *bp; int wire = MI_IS_WIREFRAME(mi); - if (!bps) { - bps = (geodesic_configuration *) - calloc (MI_NUM_SCREENS(mi), sizeof (geodesic_configuration)); - if (!bps) { - fprintf(stderr, "%s: out of memory\n", progname); - exit(1); - } - } + MI_INIT (mi, bps); bp = &bps[MI_SCREEN(mi)]; @@ -1782,9 +1785,12 @@ draw_geodesic (ModeInfo *mi) } ENTRYPOINT void -release_geodesic (ModeInfo *mi) +free_geodesic (ModeInfo *mi) { geodesic_configuration *bp = &bps[MI_SCREEN(mi)]; + if (!bp->glx_context) + return; + glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context)); free_texture_font (bp->font); free (bp->colors); free_sphere_gears (mi);