summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-11-14 17:28:48 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-11-14 17:28:48 +0000
commit6e863f844dca65c5d4506c9040cd075a31e72212 (patch)
treee1a1d5dbf9596ca5424c45f587a38a2673c385c4
parent6d2f0273f34811741fa7e99d9347b9ecd2044a0f (diff)
Fixed OpenGL hide/show issue in OS X (STR #2260)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7831 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES1
-rw-r--r--FL/Fl_Gl_Window.H3
-rw-r--r--src/Fl_Gl_Window.cxx22
3 files changed, 25 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 6266c03bc..f60d03cfa 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H
index 9842aed41..30a54a5a9 100644
--- a/FL/Fl_Gl_Window.H
+++ b/FL/Fl_Gl_Window.H
@@ -87,7 +87,8 @@ public:
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.
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index f3622508b..d77f15472 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -522,6 +522,28 @@ void Fl_Gl_Window::draw_overlay() {}
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$".
//