summarylogtreecommitdiffstats
path: root/fixes__labels-wrapping.patch
blob: 290cc2ae037f414abb70037039071f5d0625e4a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --color -U 5 -r -Z -B ./org/gtk/gtklabel.c ./mod/gtk/gtklabel.c
--- ./org/gtk/gtklabel.c	2018-02-17 23:30:46.000000000 +0100
+++ ./mod/gtk/gtklabel.c	2018-06-01 01:03:02.506927146 +0200
@@ -3683,10 +3683,18 @@
                                      PangoRectangle *widest)
 {
   GtkLabelPrivate *priv = label->priv;
   PangoLayout *layout;
   gint char_pixels;
+  GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (label));
+  if (GTK_IS_WINDOW (toplevel))
+    {
+      gint default_window_width;
+      gtk_window_get_default_size (GTK_WINDOW (toplevel), &default_window_width, NULL);
+      if (default_window_width == -1 && priv->max_width_chars == -1 && priv->ellipsize == PANGO_ELLIPSIZE_NONE)
+        priv->max_width_chars = 56;
+    }

   /* "width-chars" Hard-coded minimum width:
    *    - minimum size should be MAX (width-chars, strlen ("..."));
    *    - natural size should be MAX (width-chars, strlen (priv->text));
    *