summaryrefslogtreecommitdiff
path: root/gtk/gtkspinbutton.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2003-08-20 23:47:19 +0000
committerKristian Rietveld <kristian@src.gnome.org>2003-08-20 23:47:19 +0000
commit5ff0e3fabe5ef4c9ee232c9f6ae4d775787eda85 (patch)
treefd96acd32eb2b1115f7e4c3bdfe6ca35f5458713 /gtk/gtkspinbutton.c
parent4983f3adc5f747d3f35d233de3297e40312ac212 (diff)
downloadgtk+-5ff0e3fabe5ef4c9ee232c9f6ae4d775787eda85.tar.gz
Merge from stable.
Thu Aug 21 01:33:51 2003 Kristian Rietveld <kris@gtk.org> Merge from stable. * gtk/gtkspinbutton.c (gtk_spin_button_size_request): always round approximate digit widths up, to avoid truncation, convert to pango pixels when we have the full string width instead of converting the approx digit width to pango pixels, take inner border and interior focus into account correctly. (Fixes #116368, patch from Morten Welinder).
Diffstat (limited to 'gtk/gtkspinbutton.c')
-rw-r--r--gtk/gtkspinbutton.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 67de310d10..cf4565ecf5 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -652,7 +652,8 @@ gtk_spin_button_size_request (GtkWidget *widget,
pango_context_get_language (context));
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
- digit_width = PANGO_PIXELS (digit_width);
+ digit_width = PANGO_SCALE *
+ ((digit_width + PANGO_SCALE - 1) / PANGO_SCALE);
pango_font_metrics_unref (metrics);
@@ -664,15 +665,15 @@ gtk_spin_button_size_request (GtkWidget *widget,
string_len = compute_double_length (spin_button->adjustment->upper,
spin_button->digits);
- w = MIN (string_len, max_string_len) * digit_width;
+ w = PANGO_PIXELS (MIN (string_len, max_string_len) * digit_width);
width = MAX (width, w);
string_len = compute_double_length (spin_button->adjustment->lower,
spin_button->digits);
- w = MIN (string_len, max_string_len) * digit_width;
+ w = PANGO_PIXELS (MIN (string_len, max_string_len) * digit_width);
width = MAX (width, w);
- requisition->width = width;
- if (interior_focus)
+ requisition->width = width + /* INNER_BORDER */ 2 * 2;
+ if (!interior_focus)
requisition->width += 2 * focus_width;
}