Fix #102347: Maximum Width for Status Bar Report Banners

This report shows a long report (measures 19,714 pixels) overflowing in
such a way that the banner shows nothing across the entire width of the
window. This PR just adds a maximum width to the banner size so it will
show a subset of the report correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/132307
This commit is contained in:
Harley Acheson
2024-12-24 19:28:49 +01:00
committed by Harley Acheson
parent 1098f434b0
commit 0ba91e9870

View File

@@ -115,6 +115,9 @@ using blender::Vector;
#define TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH (UI_UNIT_X * 4)
#define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y
/* Maximum width for a Status Bar report */
#define REPORT_BANNER_MAX_WIDTH (800.0f * UI_SCALE_FAC)
/* -------------------------------------------------------------------- */
/** \name Header Template
* \{ */
@@ -6443,6 +6446,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
UI_fontstyle_set(&style->widget);
int width = BLF_width(style->widget.uifont_id, report->message, report->len);
width = min_ii(width, int(REPORT_BANNER_MAX_WIDTH));
width = min_ii(int(rti->widthfac * width), width);
width = max_ii(width, 10 * UI_SCALE_FAC);