From a16bbd60f79ebb2b6355467dc58bb8b1fb28d203 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Wed, 20 Aug 2003 23:44:16 +0000 Subject: [PATCH] always round approximate digit widths up, to avoid truncation, convert to Thu Aug 21 01:33:51 2003 Kristian Rietveld * 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). --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gtk/gtkspinbutton.c | 11 ++++++----- 6 files changed, 51 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f251cc184e..9032ba2b80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Aug 21 01:33:51 2003 Kristian Rietveld + + * 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). + 2003-08-20 Noah Levitt * gtk/queryimmodules.c: Don't look at the same directory twice (in diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f251cc184e..9032ba2b80 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Thu Aug 21 01:33:51 2003 Kristian Rietveld + + * 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). + 2003-08-20 Noah Levitt * gtk/queryimmodules.c: Don't look at the same directory twice (in diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f251cc184e..9032ba2b80 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Thu Aug 21 01:33:51 2003 Kristian Rietveld + + * 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). + 2003-08-20 Noah Levitt * gtk/queryimmodules.c: Don't look at the same directory twice (in diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f251cc184e..9032ba2b80 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Thu Aug 21 01:33:51 2003 Kristian Rietveld + + * 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). + 2003-08-20 Noah Levitt * gtk/queryimmodules.c: Don't look at the same directory twice (in diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f251cc184e..9032ba2b80 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Thu Aug 21 01:33:51 2003 Kristian Rietveld + + * 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). + 2003-08-20 Noah Levitt * gtk/queryimmodules.c: Don't look at the same directory twice (in diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 9104b83caa..755d978268 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -650,7 +650,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); @@ -662,15 +663,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; }