summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-10-24 18:12:25 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-10-24 18:13:11 +0200
commite391dc1bf955cbcb7efe6fc268c0c565328ea5a5 (patch)
tree20bd23a7f1ce8bb65ce00eda80a16b6a45587b92
parent38b529c01b085a5e23f5fdd9664e41245d3947a8 (diff)
Fix Fl_Flex::resize() and layout() (#811)
Remove "too optimistic optimization" in resize(). Resize must always call layout() to recalculate widget positions.
-rw-r--r--src/Fl_Flex.cxx12
1 files 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() {