From 2a2071c381c188c9e94e64937e08e53a9658a199 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 17 Mar 2003 23:17:32 +0000 Subject: [PATCH] * gtkutil.c (xg_set_toolkit_scroll_bar_thumb): Check if new values equal old values before updating. --- src/ChangeLog | 3 +++ src/gtkutil.c | 31 ++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cd271f1b116..3dc416e6387 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2003-03-18 Jan Dj,Ad(Brv + * gtkutil.c (xg_set_toolkit_scroll_bar_thumb): Check if new values + equal old values before updating. + * xterm.c (xg_scroll_callback): Remove xg_ignore_next_thumb. * gtkutil.c (xg_initialize): Remove xg_ignore_next_thumb. diff --git a/src/gtkutil.c b/src/gtkutil.c index d66b8523b18..a95be3eb40d 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2625,6 +2625,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) gdouble shown; gdouble top; int size, value; + int new_upper, new_step; adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); @@ -2652,21 +2653,33 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) value = min (value, whole - size); value = max (value, XG_SB_MIN); - adj->page_size = (int)size; - /* gtk_range_set_value invokes the callback. Set ignore_gtk_scrollbar to make the callback do nothing */ xg_ignore_gtk_scrollbar = 1; - gtk_range_set_range (GTK_RANGE (wscroll), adj->lower, max (whole, size)); + new_upper = max (whole, size); + new_step = portion / max (1, FRAME_HEIGHT (f)); + + if ((int) adj->page_size != size + || (int) adj->upper != new_upper + || (int) adj->step_increment != new_step) + { + adj->page_size = (int) size; + + gtk_range_set_range (GTK_RANGE (wscroll), adj->lower, + (gdouble) new_upper); + + /* Assume all lines are of equal size. */ + /* Assume a page increment is about 95% of the page size */ + gtk_range_set_increments (GTK_RANGE (wscroll), + portion / max (1, FRAME_HEIGHT (f)), + (int) (0.95*adj->page_size)); + + } - /* Assume all lines are of equal size. */ - /* Assume a page increment is about 95% of the page size */ - gtk_range_set_increments (GTK_RANGE (wscroll), - portion / max (1, FRAME_HEIGHT (f)), - (int) (0.95*adj->page_size)); + if ((int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); - gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); xg_ignore_gtk_scrollbar = 0; /* Make GTK draw the new thumb. We are not using a pure GTK event -- 2.39.2