GNOME Bugzilla – Bug 729532
GTK 3.12 breaks text line wrapping in non-resizeable modal dialogs
Last modified: 2018-04-15 00:34:52 UTC
I noticed that unresizeable dialogs where text used to nicely wrap (so that you don't end up with lines 1km-long) do not wrap the text anymore... since this affects apps all over the place, I'm suspecting maybe this is a regression bug in gtk?
Created attachment 275839 [details] screenshot - Gedit's "unsaved changes" dialog
Created attachment 275840 [details] screenshot - Evolution's mail composer closing confirmation dialog
Created attachment 275841 [details] screenshot - Pitivi's rendering dialog The text below the header used to wrap onto at least two lines, which was way easier to read (and nicer to look at).
The change that is causing this is that we no longer set an implicit default size of 640x480 on newly created windows, so they grow to fill the monitor. To prevent this, set a suitable default size on your windows.
Alright, so follow up is bug 728218, bug 730693, bug 730694
(In reply to comment #4) > The change that is causing this is that we no longer set an implicit default > size of 640x480 on newly created windows, so they grow to fill the monitor. > > To prevent this, set a suitable default size on your windows. That is slightly against bug #681937, isn't it? What is the gain, when you remove it on one place, then everyone else will add it on thousands places?
I'm sorry, but I'm reopening this. I tried to use gtk_window_set_default_size (window, 640, -1); which is honoured, but only if the window is resizable. Turning off resizable makes the defined default width forgotten (not honoured). The problem is that if the window contains a GtkLabel with line-wrap set to TRUE, then the window content is broken, as described in bug #681937. Evolution has a workaround for this with the set of resizable to FALSE, but as the two properties doesn't cooperate properly together, then this cannot be fixed. Matthias, maybe you meant a different default size for the window?
I can confirm what Milan observed in comment 7. Pitivi's rendering progress dialog already had a set default width, but the "resizable" property was False, with the result that text was not wrapping at all. Setting the "resizable" property to True makes the text wrap, however the height is then incorrectly calculated and you have a huge empty space below the text label.
Matthias, I tried working around this in Pitivi with the solution you suggested; however, as it seems in the last two comments, this can't be worked around by apps because of bugs in GTK+. So Pitivi's bug #728218 is blocked on this.
To fix non-breaking labels in non-resizable dialogs, set max-width-chars on the label to a reasonable number, like 50. That works in my testing.
*** Bug 723204 has been marked as a duplicate of this bug. ***
*** Bug 642406 has been marked as a duplicate of this bug. ***
I've now collected all my knowledge about wrapping labels vs. windows in https://wiki.gnome.org/HowDoI/Labels
Updating the title to reflect the fact that there's still a bug; the only way to get it to work is to set the window to resizable, set a width for the window, and then set the char-width property of the label; but this approach doesn't work if the window is not resizeable.
the howdoi also contains advice for resizable windows
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new