Fix pane constraint calculation for > 2 child widgets

This commit is contained in:
Robin Gareus 2025-10-11 22:22:44 +02:00
parent 882ed91f2f
commit f19e7c9ac9
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -434,6 +434,14 @@ Pane::constrain_fract (Dividers::size_type div, float fract)
float size = horizontal ? get_allocation().get_width() : get_allocation().get_height();
size = max<float> (0, size - (children.size() - 1) * divider_width);
/* compare to Pane::reallocate */
Dividers::iterator d = dividers.begin();
for (Dividers::size_type i = 0 ; i < div; ++i, ++d) {
if (children.at (i)->w->get_visible ()) {
size -= size * (*d)->fract;
}
}
// TODO: optimize: cache in Pane::on_size_request
Gtk::Requisition prev_req(children.at (div)->w->size_request ());
Gtk::Requisition next_req(children.at (div + 1)->w->size_request ());