summaryrefslogtreecommitdiff
path: root/fluid/Fl_Widget_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-07-27 20:22:50 +0200
committerMatthias Melcher <github@matthiasm.com>2024-07-27 20:22:50 +0200
commitd265009b66cbc69ca6edf502dc23199a01d62220 (patch)
tree85afd145bfd05c152371ea00388bf71f745ab1fe /fluid/Fl_Widget_Type.cxx
parent8cffbd694106a2371d297caa008f2290185fed2f (diff)
FLUID: fixes crash bug in Fl_Sys_Men_Bar inside a Class. #977
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
-rw-r--r--fluid/Fl_Widget_Type.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 5864b6ab6..160234aa4 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -54,6 +54,11 @@ int Fl_Widget_Type::is_widget() const {return 1;}
int Fl_Widget_Type::is_public() const {return public_;}
const char* subclassname(Fl_Type* l) {
+ if (l->is_a(ID_Menu_Bar)) {
+ Fl_Menu_Bar_Type *mb = static_cast<Fl_Menu_Bar_Type*>(l);
+ if (mb->is_sys_menu_bar())
+ return mb->sys_menubar_name();
+ }
if (l->is_widget()) {
Fl_Widget_Type* p = (Fl_Widget_Type*)l;
const char* c = p->subclass();
@@ -2991,6 +2996,12 @@ void Fl_Widget_Type::write_code1(Fd_Code_Writer& f) {
f.write_c("new %s(0, 0, %d, %d", t, o->w(), o->h());
else
f.write_c("new %s(%d, %d", t, o->w(), o->h());
+ } else if (is_a(ID_Menu_Bar)
+ && ((Fl_Menu_Bar_Type*)this)->is_sys_menu_bar()
+ && is_in_class()) {
+ f.write_c("(%s*)new %s(%d, %d, %d, %d",
+ t, ((Fl_Menu_Bar_Type*)this)->sys_menubar_proxy_name(),
+ o->x(), o->y(), o->w(), o->h());
} else {
f.write_c("new %s(%d, %d, %d, %d", t, o->x(), o->y(), o->w(), o->h());
}