Author: matt
Date: 2010-11-14 09:28:48 -0800 (Sun, 14 Nov 2010)
New Revision: 7831
Log:
Fixed OpenGL hide/show issue in OS X (STR #2260)

Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/FL/Fl_Gl_Window.H
   branches/branch-1.3/src/Fl_Gl_Window.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2010-11-14 16:37:34 UTC (rev 7830)
+++ branches/branch-1.3/CHANGES 2010-11-14 17:28:48 UTC (rev 7831)
@@ -1,5 +1,6 @@
 CHANGES IN FLTK 1.3.0
 
+       - Fixed OpenGL hide/show issue in OS X (STR #2260)
        - Added visual feedback for button shortcuts (STR #2372)
        - Fixed internationalisation of menus using FLuid (STR #2246)
        - Fixed blinking of selection when the mouse was dragged 

Modified: branches/branch-1.3/FL/Fl_Gl_Window.H
===================================================================
--- branches/branch-1.3/FL/Fl_Gl_Window.H       2010-11-14 16:37:34 UTC (rev 
7830)
+++ branches/branch-1.3/FL/Fl_Gl_Window.H       2010-11-14 17:28:48 UTC (rev 
7831)
@@ -87,7 +87,8 @@
   void flush();
   void hide();
   void resize(int,int,int,int);
-
+  int handle(int);
+  
   /**
     Is turned off when FLTK creates a new context for this window or 
     when the window resizes, and is turned on \e after draw() is called.

Modified: branches/branch-1.3/src/Fl_Gl_Window.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Gl_Window.cxx    2010-11-14 16:37:34 UTC (rev 
7830)
+++ branches/branch-1.3/src/Fl_Gl_Window.cxx    2010-11-14 17:28:48 UTC (rev 
7831)
@@ -522,6 +522,28 @@
 void Fl_Gl_Window::draw() {
     Fl::fatal("Fl_Gl_Window::draw() *must* be overriden. Please refer to the 
documentation.");
 }
+
+
+/**
+ Handle some FLTK events as needed.
+ */
+int Fl_Gl_Window::handle(int event) 
+{
+#if (__APPLE_QUARTZ__)
+  if (event==FL_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 wthout setting the hidden flags
+  }
+  if (event==FL_SHOW) {
+    // if we are not hidden, just the parent was shown, so we must create a 
new context
+    if (visible_r())
+      show(); //
+  }
+#endif
+  return Fl_Window::handle(event);
+}
+
 //
 // End of "$Id$".
 //

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

Reply via email to