scrolledwindow: Fix measuring non-overlay, always visible scrollbars
The last part of logic in gtk_scrolled_window_measure () that accounted
for scrollbars was handling the hscrollbar first, and vscrollbar second.
For each of them, it looked at the orientation we're being measured in,
and either added or MAX'ed scrollbar's size request into ours (or not,
depending on scrollbar policy and whether overlay scrolling is used).
In case of GTK_ORIENTATION_HORIZONTAL, this resulted in
// MAX in hscrollbar width.
minimum_req = MAX (minimum_req, min_scrollbar_width + sborder.left + sborder.right);
// Add in vscrollbar width.
minimum_req += min_scrollbar_width;
whereas for GTK_ORIENTATION_VERTICAL, it was
// Add in hscrollbar height.
minimum_req += min_scrollbar_height;
// MAX in vscrollbar height.
minimum_req = MAX (minimum_req, min_scrollbar_height + sborder.top + sborder.bottom);
The former is correct and the latter is wrong: we should be adding the
size requests of the scrollbars together, and MAX'ing them with the
content size request.
Fix this by refactoring the logic to first handle the MAX'ing, and then
the addition.
This fixes the following criticals:
Gtk-CRITICAL **: 17:26:51.406: Allocation height too small. Tried to allocate 15x31, but GtkScrollbar 0x2a00fac0 needs at least 15x46.
that were happening when all of:
- scrollbar policy was set to ALWAYS,
- overlay scrolling was disabled,
- the scrollable child was really small.
Signed-off-by:
Sergey Bugaev <bugaevc@gmail.com>
Loading
Please register or sign in to comment