From 17d3134ec082a6320de3d65e9033477728618b83 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 27 Apr 2003 16:09:11 +0000 Subject: Force multiple applications to play nicer with each other. --- src/glut/mini/window.c | 17 ++++++++++++----- 1 file 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(); } } -- cgit v1.2.3