On Tue, Dec 6, 2011 at 1:15 AM, John Lindgren <john.lindg...@aol.com> wrote: > Hi Tristan, > > This makes a bit more sense now. > > > On 12/05/2011 09:27 AM, Tristan Van Berkom wrote: >> >> On Mon, Dec 5, 2011 at 11:18 PM, John Lindgren<john.lindg...@aol.com> >> wrote: >>> >>> It looks to me as though there are 3 separate problems contributing here: >>> >>> 1. GtkLabel does not take into account gtk_widget_set_size_request() when >>> reporting its "natural" size: >>> https://bugzilla.gnome.org/show_bug.cgi?id=662043 >> >> Not a bug. >> >> No widgets should ever peek at the explicit user set size request to >> implement the size negotiation vfuncs. >> >> Those are handled in GtkWidgetClass.adjust_size_request() base class >> implementation. > > > So using gtk_widget_set_size_request() as a way to set the width of a label > is no longer valid in GTK+ 3. Fair enough.
That is true, GtkLabel in GTK+2 did do some sneaky things like peeking at the user set size request, it no longer does this. gtk_widget_set_size_request() should still succeed with the expected behaviour of setting the minimum size of a widget, however it does not limit the size of any widget. > > >>> 2. Nor does it take into account gtk_label_set_width_chars(): >>> https://bugzilla.gnome.org/show_bug.cgi?id=665560 >> >> It does, width-chars, as always, only effects the minimum size, not >> the natural size. > > > I get it now. You set the minimum width of a label with > gtk_label_set_width_chars() and the natural/default width with > gtk_label_set_max_width_chars(). > > The documentation is very misleading; actually, the entire documentation for > gtk_label_set_width_chars() consists of the sentence fragment, "Sets the > desired width in characters of label to n_chars." I do not think that most > people would make the connection between "desired width" and "minimum > width". > > Likewise, the documentation for gtk_label_set_max_width_chars() is, "Sets > the desired maximum width in characters of label to n_chars." I do not > think that most people would make the connection between "desired maximum > width" and "natural/default width". > I couldn't agree more, and I'm sorry for lack of time and patience for documenting GtkLabel properties better. Would you like to re-phrase that documentation yourself and send it back to the list ? I'll take that and correct anything that might be inaccurate and send it back to this list... (perhaps we should CC gtk-devel-list in this case). Others will have a (short) chance to interject... and if there are no objections to the new documentation within a short time I'll go ahead and commit that to GTK+ so that next time around the online docs will be better. Reasonable plan ? > >>> 3. GtkWindow ignores gtk_window_set_default_size() and instead goes to >>> its >>> "natural" size if the window is not resizable: >>> https://bugzilla.gnome.org/show_bug.cgi?id=665596 >> >> As I mentioned in the previous mail, I believe this has *always* been the >> case, >> GtkWindow always shrinks down to minimum size (or now in GTK+3 'natural >> size') >> >> This is how you get the shrinking dialogs when closing the expander in >> them >> (for non-resizable windows). >> >> However, it could be considered a bug, one would expect GtkWindow to make >> an attempt to honor a user set default size for a non-resizable window. >> >> Perhaps it's even a regression from GTK+2, not so sure. > > > I think it should be considered a bug; however, I do not care so much about > gtk_window_set_default_size() now that I can set the size of the label > directly. Using gtk_window_set_default_size(), you might recall, was your > suggestion from an earlier mail: Yes, whether it is a regression or not I think it's a valid bug, apis in GTK+ should definitely make an attempt at succeeding ;-) However, GtkWindow itself is a very tricky object to not break (on X11 platform it has to deal with this 'window constraint' api to cooperate with the X server), it's possible that it just doesn't make sense to implement this properly. In which case the fix might be adding documentation to gtk_window_set_resizable() to indicate that the window will always be forced to the natural size requests of its content, regardless of any previously set default size. >> So I'm attaching my version of your test case, actually except for >> the label being somehow severely broken here, your code works >> nicely... I added a line that says gtk_window_set_default_size() >> and I think that will fix all your problems. > > > Thanks for your help. I will close #662043 and #665560 but add a comment > that the documentation is wrong and needs to be updated. > > -- John _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list