From http://www.jwz.org/xscreensaver/xscreensaver-5.38.tar.gz
[xscreensaver] / hacks / glx / cityflow.c
index ae1397d6dad951d91359a9bb9a1495dce04f2698..2b3bd4fcea33af810fb1c502d169de385e5cc9c1 100644 (file)
@@ -14,7 +14,7 @@
                        "*showFPS:      False       \n" \
                        "*wireframe:    False       \n" \
 
-# define refresh_cube 0
+# define free_cube 0
 # define release_cube 0
 #undef countof
 #define countof(x) (sizeof((x))/sizeof((*x)))
@@ -99,8 +99,15 @@ ENTRYPOINT void
 reshape_cube (ModeInfo *mi, int width, int height)
 {
   GLfloat h = (GLfloat) height / (GLfloat) width;
+  int y = 0;
 
-  glViewport (0, 0, (GLint) width, (GLint) height);
+  if (width > height * 2) {   /* tiny window: show middle */
+    height = width;
+    y = -height/2;
+    h = height / (GLfloat) width;
+  }
+
+  glViewport (0, y, (GLint) width, (GLint) height);
 
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
@@ -290,7 +297,7 @@ init_cube (ModeInfo *mi)
   int i;
   cube_configuration *cc;
 
-  MI_INIT (mi, ccs, NULL);
+  MI_INIT (mi, ccs);
 
   cc = &ccs[MI_SCREEN(mi)];