Update the glut idle function after a new window is created
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 25 Aug 2005 17:46:04 +0000 (17:46 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 25 Aug 2005 17:46:04 +0000 (17:46 +0000)
progs/demos/reflect.c

index 9a41a86083a8d3ad7ab7442b6da3780cad836a52..892930417e2dc16bd545684af589b8426d5ca09b 100644 (file)
@@ -409,6 +409,15 @@ Idle(void)
 }
 
 
+static void
+UpdateIdleFunc(void)
+{
+   if (AnyAnimating())
+      glutIdleFunc(Idle);
+   else
+      glutIdleFunc(NULL);
+}
+
 static void
 Key(unsigned char key, int x, int y)
 {
@@ -436,14 +445,12 @@ Key(unsigned char key, int x, int y)
    case ' ':
       w->anim = !w->anim;
       w->t0 = -1;
-      if (AnyAnimating())
-         glutIdleFunc(Idle);
-      else
-         glutIdleFunc(NULL);
+      UpdateIdleFunc();
       glutPostRedisplay();
       break;
    case 'n':
       CreateWindow();
+      UpdateIdleFunc();
       break;
    case 'k':
       KillWindow(w);