Author: manolo
Date: 2011-04-24 09:25:09 -0700 (Sun, 24 Apr 2011)
New Revision: 8622
Log:
Fix STR #2596: Fluid generated improper callback member functions for 
Fl_Menu_Item's in widget classes. Fixed with OP's patch.

Modified:
   branches/branch-1.3/fluid/Fl_Menu_Type.cxx

Modified: branches/branch-1.3/fluid/Fl_Menu_Type.cxx
===================================================================
--- branches/branch-1.3/fluid/Fl_Menu_Type.cxx  2011-04-23 15:46:30 UTC (rev 
8621)
+++ branches/branch-1.3/fluid/Fl_Menu_Type.cxx  2011-04-24 16:25:09 UTC (rev 
8622)
@@ -211,10 +211,14 @@
     write_c("\n}\n");
     if (k) {
       write_c("void %s::%s(Fl_Menu_* o, %s v) {\n", k, cn, ut);
-      write_c("  ((%s*)(o->", k);
+      write_c("  ((%s*)(o", k);
       Fl_Type* t = parent; while (t->is_menu_item()) t = t->parent;
-      for (t = t->parent; t && t->is_widget() && !is_class(); t = t->parent) 
write_c("parent()->");
-      write_c("user_data()))->%s_i(o,v);\n}\n", cn);
+      Fl_Type *q = 0;
+      for (t = t->parent; t && t->is_widget() && !is_class(); q = t, t = 
t->parent) 
+        write_c("->parent()");
+      if (!q || strcmp(q->type_name(), "widget_class"))
+        write_c("->user_data()");
+      write_c("))->%s_i(o,v);\n}\n", cn);
     }
   }
   if (image) {

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

Reply via email to