DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2627
Version: 1.4-feature


Attached file "destroynotify3.patch"...


Link: http://www.fltk.org/str.php?L2627
Version: 1.4-feature
Index: src/Fl_x.cxx
===================================================================
--- src/Fl_x.cxx        (revision 8658)
+++ src/Fl_x.cxx        (working copy)
@@ -858,6 +858,7 @@
 
 }
 
+Window fl_destroynotified_xid = 0; // communication with Fl_Window::hide() 
from file src/Fl.cxx
 
 int fl_handle(const XEvent& thisevent)
 {
@@ -1070,6 +1071,20 @@
 
   if (window) switch (xevent.type) {
 
+  case DestroyNotify:
+    {
+      Fl::handle(FL_CLOSE, window);
+      if (Fl_X::i(window)) {
+       fl_destroynotified_xid = xid;
+       window->hide();
+       fl_destroynotified_xid = 0;
+       int oldx = window->x(), oldy = window->y();
+       window->position(0, 0);
+       window->position(oldx, oldy);
+       window->show();
+       }
+      return 1;
+    }
   case ClientMessage: {
     Atom message = fl_xevent->xclient.message_type;
     const long* data = fl_xevent->xclient.data.l;
Index: src/Fl.cxx
===================================================================
--- src/Fl.cxx  (revision 8658)
+++ src/Fl.cxx  (working copy)
@@ -1423,7 +1423,11 @@
 # if USE_XFT
   fl_destroy_xft_draw(ip->xid);
 # endif
-  XDestroyWindow(fl_display, ip->xid);
+  // this test makes sure ip->xid has not been destroyed already
+  extern Window fl_destroynotified_xid; // declared in file src/Fl_x.cxx
+  if ( fl_destroynotified_xid != ip->xid ) {
+    XDestroyWindow(fl_display, ip->xid);
+    }
 #elif defined(WIN32)
   // this little trickery seems to avoid the popup window stacking problem
   HWND p = GetForegroundWindow();
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to