X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fflipflop.c;h=c26458c2dc1cb22283514114fe8cefafb38c62a5;hp=02ec2d570266864cbf1ca9c89f732da0bf50fa29;hb=39809ded547bdbb08207d3e514950425215b4410;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba diff --git a/hacks/glx/flipflop.c b/hacks/glx/flipflop.c index 02ec2d57..c26458c2 100644 --- a/hacks/glx/flipflop.c +++ b/hacks/glx/flipflop.c @@ -43,7 +43,6 @@ "*showFPS: False \n" \ "*wireframe: False \n" -# define refresh_flipflop 0 # define release_flipflop 0 # include "xlockmore.h" @@ -96,7 +95,7 @@ ENTRYPOINT ModeSpecOpt flipflop_opts = {countof(opts), opts, countof(vars), vars #ifdef USE_MODULES ModStruct flipflop_description = {"flipflop", "init_flipflop", "draw_flipflop", NULL, - "draw_flipflop", "init_flipflop", NULL, &flipflop_opts, + "draw_flipflop", "init_flipflop", "free_flipflop", &flipflop_opts, 1000, 1, 2, 1, 4, 1.0, "", "Flipflop", 0, NULL}; @@ -284,12 +283,20 @@ display(ModeInfo *mi) ENTRYPOINT void reshape_flipflop(ModeInfo *mi, int width, int height) { - GLfloat h = (GLfloat) height / (GLfloat) width; - glViewport(0,0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(45, 1/h, 1.0, 300.0); - glMatrixMode(GL_MODELVIEW); + 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,y, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45, 1/h, 1.0, 300.0); + glMatrixMode(GL_MODELVIEW); } static void @@ -348,8 +355,6 @@ get_texture(ModeInfo *modeinfo) image_loaded_cb, c); } -static void free_flipflop(ModeInfo *mi); - ENTRYPOINT void init_flipflop(ModeInfo *mi) { @@ -395,7 +400,7 @@ init_flipflop(ModeInfo *mi) screen = MI_SCREEN(mi); wire = MI_IS_WIREFRAME(mi); - MI_INIT(mi, qs, free_flipflop); + MI_INIT(mi, qs); c = &qs[screen]; c->window = MI_WINDOW(mi); @@ -465,7 +470,7 @@ draw_flipflop(ModeInfo *mi) } -static void +ENTRYPOINT void free_flipflop(ModeInfo *mi) { Flipflopcreen *c = &qs[MI_SCREEN(mi)];