GtkSpinButton Patch

I sent this a while ago, but it probably got lost.  Anyway it makes the
SpinButton control's size request seem more reasonable.  Try it out - it
should insure that the largest and smallest numbers the spin button can
have always fit in the spin button.  This would be really important if
someone changes the font size.

If this is better behaviour and reasonable for inclusion in say 1.4, I'll
also write the support for GtkText, GtkEntry, GtkLabel, GtkCombo and
whatever else I can find that is broken in this respect.

Ryan Willhoit
gtk-willhoit-000419-0.patch.gz		733
gtk-willhoit-000419-0.patch.README	2017
Ryan Willhoit <>


GtkSpinButton Size Requistion Patch

This patch corrects GtkSpinButtons size requesition behaviour.  Previously
it simply gave a stock value, which while okay for one or two digits
looked really poor and showed only a partial value for more complex
numbers.  Note the changes are contained to gtk_spin_button_size_request.

It utilizes the digits property and the upper and lower bounds to insure that
all possible values will fit in the space it asks for.  For the time being it
never asks for less space than the old minimum, though I think this should be

There are some issues:
1. There is no "good" way that I can find to determine which digit takes up
the most horizontal space.  Currently I'm using the average of "08-" which
works well.  I'm also not sure if there are i18n issues here (comma instead
of period, or maybe even more serious?)
2. I maintain the old minimum width which is almost the same as the computed
width for "000"!  That's almost 2 extra chars for a 0-9 spinbutton...  This
can be changed easily though I was unsure what might happen to the rest of the
code (drawing and such) if I changed it (and too lazy to check).


Unfortuanately this isn't the only widget that has a poor size_request method.
Next on my hit list is TextEntry which give a default that is completely
unreasonable for small entries.  If the text entry can only collect 3
characters its unattractive and misleading for it to be 10 characters long.
Additionally the "old" technique does not take into account different fonts,
while I don't use other themes myself I suspect it would look quite bad if I
used a much larger font.  Also the Label widget has a hardcoded length that
results in it not filling even half the allocated width under certain 
conditions with word-wrap on. Contact me if you want a glade file with examples
of the various bad behaviours.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]