summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-05-03 12:19:39 +0000
committerManolo Gouy <Manolo>2014-05-03 12:19:39 +0000
commitf8852ab51dd7d847e9b1594aba4a6b51cde7be9d (patch)
tree7677f7e11a5c31d6ea3ef463a3611ec79f817200
parent315fcfa57abd7564f7defc9f778175d90bb14a7f (diff)
Fix for STR#3079 (WIN32 only).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10144 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 1916052ce..91376fdcf 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1420,6 +1420,30 @@ extern void fl_destroy_xft_draw(Window);
#endif
void Fl_Window::hide() {
+#ifdef WIN32
+ // STR#3079: if there remains a window and a non-modal window, and the window is deleted,
+ // the app remains running without any apparent window.
+ // Bug mechanism: hiding an owner window unmaps the owned (non-modal) window(s)
+ // but does not delete it(them) in FLTK.
+ // Fix for it:
+ // when hiding a window, build list of windows it owns, and do hide/show on them.
+ int count = 0;
+ Fl_Window *win, **doit = NULL;
+ for (win = Fl::first_window(); win; win = Fl::next_window(win)) {
+ if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
+ count++;
+ }
+ }
+ if (count) {
+ doit = new Fl_Window*[count];
+ count = 0;
+ for (win = Fl::first_window(); win; win = Fl::next_window(win)) {
+ if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
+ doit[count++] = win;
+ }
+ }
+ }
+#endif
clear_visible();
if (!shown()) return;
@@ -1499,6 +1523,12 @@ void Fl_Window::hide() {
ShowWindow(p, SW_SHOWNA);
}
XDestroyWindow(fl_display, ip->xid);
+ // end of fix for STR#3079
+ for (int ii = 0; ii < count; ii++) {
+ doit[ii]->hide();
+ doit[ii]->show();
+ }
+ if (count) delete[] doit;
#elif defined(__APPLE_QUARTZ__)
ip->destroy();
#else