Fix Fl_Flex::resize() and layout() (#811)

Remove "too optimistic optimization" in resize(). Resize must always
call layout() to recalculate widget positions.
This commit is contained in:
Albrecht Schlosser 2023-10-24 18:12:25 +02:00
parent 38b529c01b
commit e391dc1bf9

View File

@ -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() {