From 961391ac0804f708e46fa3b8c54d84e26ab392e6 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 25 Aug 2006 09:11:42 +0000 Subject: [PATCH] Fixed GLUT behavior on window creation (STR #1267) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5363 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 1 + src/glut_compatability.cxx | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index a07df5b26..5a5182769 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.1.8 + - Fixed GLUT behavior on window creation (STR #1267) - Fixed OS X bug that would hide tooltips before they were shown (STR #1392) - Fixed Fl_Tabs tooltip reappearing (STR #1324) diff --git a/src/glut_compatability.cxx b/src/glut_compatability.cxx index 90d2d80ca..85ea3cb6d 100644 --- a/src/glut_compatability.cxx +++ b/src/glut_compatability.cxx @@ -42,6 +42,7 @@ #define MAXWINDOWS 32 static Fl_Glut_Window *windows[MAXWINDOWS+1]; +static unsigned char reshaped[MAXWINDOWS+1]; Fl_Glut_Window *glut_window; int glut_menu; @@ -60,8 +61,17 @@ static int indraw; void Fl_Glut_Window::draw() { glut_window = this; indraw = 1; - if (!valid()) {reshape(w(),h()); valid(1);} - display(); + if (!reshaped[number] ) { + // ignore the first show event on glutCreateWindow + reshaped[number] = 1; + } else { + if( !valid() || reshaped[number] == 1 ) { + reshaped[number] = 2; + reshape(w(),h()); + valid(1); + } + display(); + } indraw = 0; } @@ -71,8 +81,17 @@ void glutSwapBuffers() { void Fl_Glut_Window::draw_overlay() { glut_window = this; - if (!valid()) {reshape(w(),h()); valid(1);} - overlaydisplay(); + if (!reshaped[number] ) { + // ignore the first show event on glutCreateWindow + reshaped[number] = 1; + } else { + if( !valid() || reshaped[number] == 1 ) { + reshaped[number] = 2; + reshape(w(),h()); + valid(1); + } + overlaydisplay(); + } } static void domenu(int, int, int);