From e391dc1bf955cbcb7efe6fc268c0c565328ea5a5 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 24 Oct 2023 18:12:25 +0200 Subject: [PATCH] Fix Fl_Flex::resize() and layout() (#811) Remove "too optimistic optimization" in resize(). Resize must always call layout() to recalculate widget positions. --- src/Fl_Flex.cxx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Fl_Flex.cxx b/src/Fl_Flex.cxx index 81f200b14..20437783c 100644 --- a/src/Fl_Flex.cxx +++ b/src/Fl_Flex.cxx @@ -156,10 +156,8 @@ void Fl_Flex::on_remove(int index) { \see layout() */ void Fl_Flex::draw() { - if (need_layout()) { + if (need_layout()) layout(); - } - need_layout(0); Fl_Group::draw(); } @@ -170,14 +168,11 @@ void Fl_Flex::draw() { \param[in] w,h width and height */ void Fl_Flex::resize(int x, int y, int w, int h) { - Fl_Widget::resize(x, y, w, h); - need_layout(1); - + layout(); } // resize() - /** Calculates the layout of the widget and redraws it. @@ -193,7 +188,6 @@ void Fl_Flex::resize(int x, int y, int w, int h) { This method also calls redraw() on the Fl_Flex widget. */ void Fl_Flex::layout() { - resize(x(), y(), w(), h()); const int nc = children(); @@ -280,7 +274,7 @@ void Fl_Flex::layout() { widget to calculate its layout depending on all children and whether they have been assigned fix sizes or not right before it is drawn. - \see layout() + \see need_layout(int) \see draw() */ void Fl_Flex::end() {