summaryrefslogtreecommitdiff
path: root/src/Fl_Window.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-23 13:13:00 +0000
committerManolo Gouy <Manolo>2016-03-23 13:13:00 +0000
commita114e3ab4d9fa408061003c04a95b293b3842f24 (patch)
treee2aed2f3ecaba5b38290700159cef16c01fab292 /src/Fl_Window.cxx
parent270b437500552cba0d082363f9124456f16a1fda (diff)
Rewrite Fl_Window::handle(int) under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11403 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Window.cxx')
-rw-r--r--src/Fl_Window.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index df6f97259..8cf091427 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -514,6 +514,46 @@ void Fl_Window::hide() {
pWindowDriver->hide();
}
+
+// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
+// or any parent changes. We must correctly map/unmap the system's window.
+
+// For top-level windows it is assumed the window has already been
+// mapped or unmapped!!! This is because this should only happen when
+// Fl_Window::show() or Fl_Window::hide() is called, or in response to
+// iconize/deiconize events from the system.
+int Fl_Window::handle(int ev)
+{
+ if (parent()) {
+ switch (ev) {
+ case FL_SHOW:
+ if (!shown()) show();
+ else {
+ pWindowDriver->map();
+ }
+ break;
+ case FL_HIDE:
+ if (shown()) {
+ // Find what really turned invisible, if it was a parent window
+ // we do nothing. We need to avoid unnecessary unmap calls
+ // because they cause the display to blink when the parent is
+ // remapped. However if this or any intermediate non-window
+ // widget has really had hide() called directly on it, we must
+ // unmap because when the parent window is remapped we don't
+ // want to reappear.
+ if (visible()) {
+ Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
+ if (p->type() >= FL_WINDOW) break; // don't do the unmap
+ }
+ pWindowDriver->unmap();
+ }
+ break;
+ }
+ }
+
+ return Fl_Group::handle(ev);
+}
+
//
// End of "$Id$".
//