diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-07-26 23:27:32 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-07-26 23:27:32 +0000 |
| commit | 0043e7a44daa1b910d82d37a20c23b2b11245ed3 (patch) | |
| tree | 5a71f99e3ef5bf8a8b191f77bf45cdb0e402bb1d /fluid | |
| parent | 7e3daaf14589bfd7eca55d90a58db70b71ea60c2 (diff) | |
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
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 13 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 2 |
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(); } |
