Fix return of window widget - use "w" or the name of the window, as

appropriate.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5268 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2006-07-26 23:27:32 +00:00
parent 7e3daaf145
commit 0043e7a44d
2 changed files with 11 additions and 4 deletions

View File

@ -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;
}

View File

@ -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();
}