From 882ed91f2fd5a6362e8fec2f02edb07015226b6c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 11 Oct 2025 21:04:45 +0200 Subject: [PATCH] Fix pane allocation and size constraints Correctly divide the fractions of *available* requested child-space. This fixes issue with Trigger Page bottom attachment not showing Frame content. When calculating constraints the divider width/height was ignored. When setting child allocation, the divider girth was only subtracted *after* the first child, and iteratively subtracted after each subsequent child widget. This over-allocated the first child and later child widgets were increasingly too small (factor * remaining). --- libs/widgets/pane.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/widgets/pane.cc b/libs/widgets/pane.cc index ac2131c3ee..bb5ffaf727 100644 --- a/libs/widgets/pane.cc +++ b/libs/widgets/pane.cc @@ -257,6 +257,7 @@ Pane::reallocate (Gtk::Allocation const & alloc) } else { remaining = alloc.get_height (); } + remaining = max (0, remaining - (children.size() - 1) * divider_width); Children::iterator child; Children::iterator next; @@ -298,8 +299,6 @@ Pane::reallocate (Gtk::Allocation const & alloc) fract = (*div)->fract; } - Gtk::Requisition cr = (*child)->w->size_request (); - if (horizontal) { child_alloc.set_width ((gint) floor (remaining * fract)); child_alloc.set_height (alloc.get_height()); @@ -319,6 +318,7 @@ Pane::reallocate (Gtk::Allocation const & alloc) child_alloc.set_height (max (child_alloc.get_height(), (*child)->minsize)); } } else if (!check_fract && (*child)->w->get_visible ()) { + Gtk::Requisition cr = (*child)->w->size_request (); if (horizontal) { child_alloc.set_width (max (child_alloc.get_width(), cr.width)); } else { @@ -347,12 +347,10 @@ Pane::reallocate (Gtk::Allocation const & alloc) if (horizontal) { divider_allocation.set_width (divider_width); divider_allocation.set_height (alloc.get_height()); - remaining = max (0, remaining - divider_width); xpos += divider_width; } else { divider_allocation.set_width (alloc.get_width()); divider_allocation.set_height (divider_width); - remaining = max (0, remaining - divider_width); ypos += divider_width; } @@ -433,7 +431,8 @@ Pane::constrain_fract (Dividers::size_type div, float fract) if (children.size () <= div + 1) { return fract; } // XXX remove once hidden divs are skipped assert(children.size () > div + 1); - const float size = horizontal ? get_allocation().get_width() : get_allocation().get_height(); + float size = horizontal ? get_allocation().get_width() : get_allocation().get_height(); + size = max (0, size - (children.size() - 1) * divider_width); // TODO: optimize: cache in Pane::on_size_request Gtk::Requisition prev_req(children.at (div)->w->size_request ());