diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index ba1541bd3..5d05ecd5d 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -1384,8 +1384,6 @@ void Fl_Widget_Class_Type::write_code2() { if (((Fl_Window*)o)->resizable() == o) write_c("%sresizable(this);\n", indent()); write_c("}\n"); - - write_h("};\n"); } diff --git a/fluid/code.cxx b/fluid/code.cxx index f8fd58e6e..d04d390fd 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -250,8 +250,26 @@ static Fl_Type* write_code(Fl_Type* p) { if (!(p==Fl_Type::last && p->is_comment())) p->write_code1(); Fl_Type* q; - for (q = p->next; q && q->level > p->level;) q = write_code(q); - p->write_code2(); + if (p->is_widget() && p->is_class()) { + // Handle widget classes specially + for (q = p->next; q && q->level > p->level;) { + if (strcmp(q->type_name(), "Function")) q = write_code(q); + else q = q->next; + } + + p->write_code2(); + + for (q = p->next; q && q->level > p->level;) { + if (!strcmp(q->type_name(), "Function")) q = write_code(q); + else q = q->next; + } + + write_h("};\n"); + } else { + for (q = p->next; q && q->level > p->level;) q = write_code(q); + + p->write_code2(); + } return q; }