summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/Fl_Function_Type.cxx13
-rw-r--r--fluid/Fl_Widget_Type.cxx2
2 files changed, 11 insertions, 4 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index 5167657e5..6638c235d 100644
--- a/fluid/Fl_Function_Type.cxx
+++ b/fluid/Fl_Function_Type.cxx
@@ -334,7 +334,8 @@ void Fl_Function_Type::write_code1() {
write_c("%s%s %s {\n", rtype, star, s);
}
}
-// if (havewidgets) write_c(" %s* w;\n",subclassname(child));
+
+ if (havewidgets && !child->name()) write_c(" %s* w;\n", subclassname(child));
indentation += 2;
}
@@ -342,8 +343,14 @@ void Fl_Function_Type::write_code2() {
if (ismain()) {
if (havewidgets) write_c(" w->show(argc, argv);\n");
write_c(" return Fl::run();\n");
- } else if (havewidgets && !constructor && !return_type)
- write_c(" return w;\n");
+ } else if (havewidgets && !constructor && !return_type) {
+ Fl_Type *child;
+ const char *var = "w";
+ for (child = next; child && child->level > level; child = child->next)
+ if (child->is_window() && child->name()) var = child->name();
+
+ write_c(" return %s;\n", var);
+ }
write_c("}\n");
indentation = 0;
}
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index b799fc173..b5f7441dc 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -2010,7 +2010,7 @@ void Fl_Widget_Type::write_code1() {
if (oused)
indentation += 2;
- if (wused) write_c("%s%s* w = o;\n",indent(), subclassname(this));
+ if (wused) write_c("%sw = o;\n", indent());
write_widget_code();
}