X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fsproingies.c;h=1860b11eaf574baef8134920d0b5d306acf44c7c;hp=41a31a1590ff070af9f4b1af3b31705fa994d25f;hb=39809ded547bdbb08207d3e514950425215b4410;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba diff --git a/hacks/glx/sproingies.c b/hacks/glx/sproingies.c index 41a31a15..1860b11e 100644 --- a/hacks/glx/sproingies.c +++ b/hacks/glx/sproingies.c @@ -728,14 +728,23 @@ NextSproingieDisplay(sp_instance *si) } void -ReshapeSproingies(int w, int h) +ReshapeSproingies(int width, int height) { - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 0.1, 2000.0); /* was 200000.0 */ - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + double 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, y, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(65.0, 1/h, 0.1, 2000.0); /* was 200000.0 */ + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); } void