Author: manolo
Date: 2011-03-28 02:28:05 -0700 (Mon, 28 Mar 2011)
New Revision: 8540
Log:
Mac OS: added field subwindow to Fl_X class that is true if this is a subwindow.
Useful when deleting a window because subwindows share their xid with their 
parent
window (unlike under MSWIn or Xlib), so subwindows should not delete their xid.


Modified:
   branches/branch-1.3/FL/mac.H
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/FL/mac.H
===================================================================
--- branches/branch-1.3/FL/mac.H        2011-03-27 15:18:54 UTC (rev 8539)
+++ branches/branch-1.3/FL/mac.H        2011-03-28 09:28:05 UTC (rev 8540)
@@ -155,6 +155,7 @@
   static void *get_carbon_function(const char *name);
 private:
   static void relink(Fl_Window*, Fl_Window*);
+  bool subwindow;
 };
 
 extern struct Fl_XMap {

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-03-27 15:18:54 UTC (rev 8539)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-03-28 09:28:05 UTC (rev 8540)
@@ -1895,6 +1895,7 @@
     Fl_Group::current(0);
     // our subwindow needs this structure to know about its clipping. 
     Fl_X* x = new Fl_X;
+    x->subwindow = true;
     x->other_xid = 0;
     x->region = 0;
     x->subRegion = 0;
@@ -1994,6 +1995,7 @@
     const char *name = w->label();
     
     Fl_X* x = new Fl_X;
+    x->subwindow = false;
     x->other_xid = 0; // room for doublebuffering image map. On OS X this is 
only used by overlay windows
     x->region = 0;
     x->subRegion = 0;
@@ -2572,16 +2574,8 @@
 }
 
 void Fl_X::destroy() {
-  if (w && !w->parent() && xid) {
-    /* Fix for STR #2595: don't delete the xid of a subwindow because it is 
shared
-     with the xid of its parent window.
-     The link from subwindow to parent may have been removed already.
-     This algorithm makes sure that none of the windows of the window list 
uses this xid.
-     Is there a better algorithm ?
-     */
-    for (Fl_X *xo = Fl_X::first; xo; xo = xo->next) {
-      if (xo->xid == xid) return;
-      }
+  // subwindows share their xid with their parent window, so should not close 
it
+  if (!subwindow && w && !w->parent() && xid) {
     [[(NSWindow *)xid contentView] release];
     [(NSWindow *)xid close];
   }

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

Reply via email to