fix(overlay): enforce text wrap width to prevent overflow beyond screen
Add `gtk_label_set_width_chars` to set a concrete width for label allocation, ensuring long sentences wrap within the configured max-chars bubble width instead of extending off-screen.
This commit is contained in:
@@ -354,6 +354,9 @@ static CaptioneerOverlay *captioneer_overlay_new(
|
||||
gtk_label_set_xalign(GTK_LABEL(labels[i]), 0.0f);
|
||||
gtk_label_set_wrap(GTK_LABEL(labels[i]), TRUE);
|
||||
gtk_label_set_wrap_mode(GTK_LABEL(labels[i]), PANGO_WRAP_WORD_CHAR);
|
||||
// width-chars gives GTK a concrete allocation width, so wrapping happens
|
||||
// before a long sentence can widen the bubble beyond the screen.
|
||||
gtk_label_set_width_chars(GTK_LABEL(labels[i]), max_chars);
|
||||
gtk_label_set_max_width_chars(GTK_LABEL(labels[i]), max_chars);
|
||||
gtk_widget_set_halign(labels[i], GTK_ALIGN_FILL);
|
||||
gtk_box_append(GTK_BOX(box), labels[i]);
|
||||
|
||||
Reference in New Issue
Block a user