X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fpinion.c;h=f6793eb446b01366bc2802965983707c7b9f6601;hb=39809ded547bdbb08207d3e514950425215b4410;hp=389786de62f50990c2c032d4c9fd7a6a82d56797;hpb=d5186197bc394e10a4402f7f6d23fbb14103bc50;p=xscreensaver diff --git a/hacks/glx/pinion.c b/hacks/glx/pinion.c index 389786de..f6793eb4 100644 --- a/hacks/glx/pinion.c +++ b/hacks/glx/pinion.c @@ -16,7 +16,7 @@ "*titleFont2: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-*-*\n" \ "*titleFont3: -*-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-*\n" \ -# define refresh_pinion 0 +# define free_pinion 0 # define release_pinion 0 #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) @@ -1246,10 +1246,17 @@ find_mouse_gear (ModeInfo *mi) ENTRYPOINT void reshape_pinion (ModeInfo *mi, int width, int height) { - GLfloat h = (GLfloat) height / (GLfloat) width; pinion_configuration *pp = &pps[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; + } - glViewport (0, 0, (GLint) width, (GLint) height); + glViewport (0, y, (GLint) width, (GLint) height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -1315,14 +1322,7 @@ init_pinion (ModeInfo *mi) { pinion_configuration *pp; - if (!pps) { - pps = (pinion_configuration *) - calloc (MI_NUM_SCREENS(mi), sizeof (pinion_configuration)); - if (!pps) { - fprintf(stderr, "%s: out of memory\n", progname); - exit(1); - } - } + MI_INIT (mi, pps); pp = &pps[MI_SCREEN(mi)];