summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-08-25 17:46:04 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-08-25 17:46:04 +0000
commit8e247d52e34793e195e8164c0a461fb428c171af (patch)
tree9f205f43589c27b4619b396cbd89105d7a620272 /progs
parentb8a804d24f1b0ea19ed10c3c666f0bd30817c075 (diff)
Update the glut idle function after a new window is created
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/reflect.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/progs/demos/reflect.c b/progs/demos/reflect.c
index 9a41a86083..892930417e 100644
--- a/progs/demos/reflect.c
+++ b/progs/demos/reflect.c
@@ -410,6 +410,15 @@ Idle(void)
static void
+UpdateIdleFunc(void)
+{
+ if (AnyAnimating())
+ glutIdleFunc(Idle);
+ else
+ glutIdleFunc(NULL);
+}
+
+static void
Key(unsigned char key, int x, int y)
{
struct window *w = CurrentWindow();
@@ -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);