X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fcube21.c;fp=hacks%2Fglx%2Fcube21.c;h=a29b47dc7fa29d4dea3c2589a0042f28f590a32f;hp=0cfd2123f62d80091a42030feaa9293f40b676b2;hb=39809ded547bdbb08207d3e514950425215b4410;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba diff --git a/hacks/glx/cube21.c b/hacks/glx/cube21.c index 0cfd2123..a29b47dc 100644 --- a/hacks/glx/cube21.c +++ b/hacks/glx/cube21.c @@ -45,7 +45,7 @@ "*showFPS: False \n" \ "*wireframe: False \n" -# define refresh_cube21 0 +# define free_cube21 0 # define release_cube21 0 #include "xlockmore.h" @@ -846,9 +846,18 @@ static void init_cp(cube21_conf *cp) ENTRYPOINT void reshape_cube21(ModeInfo *mi, int width, int height) { cube21_conf *cp = &cube21[MI_SCREEN(mi)]; + int y = 0; if(!height) height = 1; cp->ratio = (GLfloat)width/(GLfloat)height; - glViewport(0, 0, (GLint) width, (GLint) height); + + if (width > height * 5) { /* tiny window: show middle */ + height = width; + y = -height/2; + cp->ratio = width / (GLfloat) height; + cp->posarg = 0; + } + + glViewport(0, y, (GLint) width, (GLint) height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.0, cp->ratio, 1.0, 100.0); @@ -873,7 +882,7 @@ cube21_handle_event (ModeInfo *mi, XEvent *event) ENTRYPOINT void init_cube21(ModeInfo *mi) { cube21_conf *cp; - MI_INIT(mi, cube21, NULL); + MI_INIT(mi, cube21); cp = &cube21[MI_SCREEN(mi)]; cp->trackball = gltrackball_init (False);