X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fvigilance.c;h=05e19edc7faa76abd37ca07ad702ec6aec8f2adb;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=e276bd75bd3dc9ffbff065fe3d4c9d2eeb978eda;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba;p=xscreensaver diff --git a/hacks/glx/vigilance.c b/hacks/glx/vigilance.c index e276bd75..05e19edc 100644 --- a/hacks/glx/vigilance.c +++ b/hacks/glx/vigilance.c @@ -1,4 +1,4 @@ -/* vigilance, Copyright (c) 2017 Jamie Zawinski +/* vigilance, Copyright (c) 2017-2018 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -22,7 +22,7 @@ "*lensColor: #000000" "\n" \ "*groundColor: #004400" "\n" \ -# define refresh_camera 0 +# define free_camera 0 # define release_camera 0 #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) @@ -32,7 +32,7 @@ #include "xlockmore.h" #include "gltrackball.h" -#include "xpm-ximage.h" +#include "ximage-loader.h" #include "normals.h" #include @@ -136,7 +136,15 @@ ENTRYPOINT void reshape_camera (ModeInfo *mi, int width, int height) { GLfloat h = (GLfloat) height / (GLfloat) width; - glViewport (0, 0, width, height); + 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 (30.0, 1/h, 1.0, 200); @@ -216,7 +224,7 @@ init_camera (ModeInfo *mi) camera_configuration *bp; int wire = MI_IS_WIREFRAME(mi); int i; - MI_INIT (mi, bps, 0); + MI_INIT (mi, bps); bp = &bps[MI_SCREEN(mi)]; @@ -879,8 +887,10 @@ tick_camera (ModeInfo *mi, camera *c) which = i-2; else if (i >= 1 && which == 1) which = i-1; - else if (i < bp->ncameras-1 && which == 2) + else if (i < bp->ncameras-2 && which == 2) which = i+2; + else if (i == bp->ncameras-1) + which = i-1; else /* (i < bp->ncameras-2 && which == 3) */ which = i+1;