summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-04-26 19:30:47 +0200
committerMatthias Melcher <github@matthiasm.com>2024-04-26 19:30:47 +0200
commit445dcb829dd22f0e809538cdfe4a6c3535b2057f (patch)
tree5c2f3f8c706c4ae64cf404f7393f89858e951dbd
parent1408a87425162f4523d3a4f6c1b9615c1c62ea0f (diff)
FLUID: Fix live resize for windows and tabs
-rw-r--r--fluid/Fl_Group_Type.cxx11
-rw-r--r--fluid/Fl_Window_Type.cxx2
2 files changed, 8 insertions, 5 deletions
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index 6c098252f..f42607b2d 100644
--- a/fluid/Fl_Group_Type.cxx
+++ b/fluid/Fl_Group_Type.cxx
@@ -720,10 +720,13 @@ void Fl_Tabs_Type::remove_child(Fl_Type* cc) {
}
Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) {
- Fl_Tabs *grp = new Fl_Tabs(o->x(), o->y(), o->w(), o->h());
- propagate_live_mode(grp);
- grp->value(((Fl_Tabs*)o)->value());
- return grp;
+ Fl_Tabs *original = static_cast<Fl_Tabs*>(o);
+ Fl_Tabs *clone = new Fl_Tabs(o->x(), o->y(), o->w(), o->h());
+ propagate_live_mode(clone);
+ int tab_index = original->find(original->value());
+ if ((tab_index>=0) && (tab_index<clone->children()))
+ clone->value(clone->child(tab_index));
+ return clone;
}
// ---- Fl_Scroll_Type ------------------------------------------------- MARK: -
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index b68af4406..2e77d386c 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -1519,7 +1519,7 @@ void Fl_Widget_Class_Type::write_code2(Fd_Code_Writer& f) {
// live mode support
Fl_Widget *Fl_Window_Type::enter_live_mode(int) {
- Fl_Window *win = new Fl_Window(o->x(), o->y(), o->w(), o->h());
+ Fl_Window *win = new Fl_Window(10, 10, o->w(), o->h());
return propagate_live_mode(win);
}