diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2003-04-27 16:09:11 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2003-04-27 16:09:11 +0000 |
commit | 17d3134ec082a6320de3d65e9033477728618b83 (patch) | |
tree | 977559e2a000269882d6cc3c96e2e85230c93472 | |
parent | 39c81446d6edd89fb2f0f73d1f6ad7a8ac56ef6f (diff) |
Force multiple applications to play nicer with each other.
-rw-r--r-- | src/glut/mini/window.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/glut/mini/window.c b/src/glut/mini/window.c index 9c21dc6afe..48a9feffa4 100644 --- a/src/glut/mini/window.c +++ b/src/glut/mini/window.c @@ -224,6 +224,7 @@ void APIENTRY glutMainLoop (void) GLboolean idle; GLboolean have_event; XEvent evt; + int visible = 0; glutPostRedisplay(); if (reshape_func) reshape_func(g_width, g_height); @@ -232,7 +233,7 @@ void APIENTRY glutMainLoop (void) idle = GL_TRUE; - if (idle_func) + if (visible && idle_func) have_event = XCheckWindowEvent( dpy, win, ~0, &evt ); else have_event = XNextEvent( dpy, &evt ); @@ -242,10 +243,16 @@ void APIENTRY glutMainLoop (void) idle = GL_FALSE; switch(evt.type) { case MapNotify: - if (visibility_func) visibility_func(GLUT_VISIBLE); + if (visibility_func) { + visibility_func(GLUT_VISIBLE); + } + visible = 1; break; case UnmapNotify: - if (visibility_func) visibility_func(GLUT_NOT_VISIBLE); + if (visibility_func) { + visibility_func(GLUT_NOT_VISIBLE); + } + visible = 0; break; case Expose: g_redisplay = 1; @@ -253,14 +260,14 @@ void APIENTRY glutMainLoop (void) } } - if (g_redisplay && display_func) { + if (visible && g_redisplay && display_func) { idle = GL_FALSE; g_redisplay = GL_FALSE; display_func(); } - if (idle && idle_func) { + if (visible && idle && idle_func) { idle_func(); } } |