Author: manolo
Date: 2012-03-05 01:04:36 -0800 (Mon, 05 Mar 2012)
New Revision: 9265
Log:
Propagated fix to STR #2260 from 1.3 to 3.0

Modified:
   branches/branch-3.0/src/fltk3gl/GLWindow.cxx

Modified: branches/branch-3.0/src/fltk3gl/GLWindow.cxx
===================================================================
--- branches/branch-3.0/src/fltk3gl/GLWindow.cxx        2012-03-05 08:46:30 UTC 
(rev 9264)
+++ branches/branch-3.0/src/fltk3gl/GLWindow.cxx        2012-03-05 09:04:36 UTC 
(rev 9265)
@@ -29,6 +29,9 @@
 #if HAVE_GL
 
 extern int fl_gl_load_plugin;
+#ifdef __APPLE__
+extern void gl_texture_reset();
+#endif
 
 static int temp = fl_gl_load_plugin;
 
@@ -177,6 +180,10 @@
     context_ = fl_create_gl_context(this, g);
     valid(0);
     context_valid(0);
+#ifdef __APPLE__
+    // resets the pile of string textures used to draw strings
+    gl_texture_reset();
+#endif
   }
   fl_set_gl_context(this, context_);
 
@@ -472,11 +479,6 @@
 fltk3::GLWindow::~GLWindow() {
   hide();
 //  delete overlay; this is done by ~Fl_Group
-#ifdef __APPLE__
-  // resets the pile of string textures used to draw strings
-  extern void gl_texture_reset();
-  gl_texture_reset();
-#endif
 }
 
 void fltk3::GLWindow::init() {
@@ -543,6 +545,18 @@
  */
 int fltk3::GLWindow::handle(int event) 
 {
+#ifdef __APPLE__
+  if (event == fltk3::HIDE) {
+    // if we are not hidden, just the parent was hidden, so we must throw away 
the context
+    if (!visible_r())
+      context(0); // remove context without setting the hidden flags
+  }
+  if (event == fltk3::SHOW) {
+    // if we are not hidden, just the parent was shown, so we must create a 
new context
+    if (visible_r())
+      show(); //
+  }
+#endif
   return Window::handle(event);
 }
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to