Mercurial > emacs
changeset 50178:61194aef8668
* gtkutil.c (xg_set_toolkit_scroll_bar_thumb): Check if new values
equal old values before updating.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Mon, 17 Mar 2003 23:17:32 +0000 |
parents | 297925dd73b1 |
children | 65bb5afb37ef |
files | src/ChangeLog src/gtkutil.c |
diffstat | 2 files changed, 27 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Mon Mar 17 23:03:53 2003 +0000 +++ b/src/ChangeLog Mon Mar 17 23:17:32 2003 +0000 @@ -1,5 +1,8 @@ 2003-03-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + * 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.
--- a/src/gtkutil.c Mon Mar 17 23:03:53 2003 +0000 +++ b/src/gtkutil.c Mon Mar 17 23:17:32 2003 +0000 @@ -2625,6 +2625,7 @@ gdouble shown; gdouble top; int size, value; + int new_upper, new_step; adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); @@ -2652,21 +2653,33 @@ 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)); - - /* 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)); - - gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); + 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)); + + } + + if ((int) gtk_range_get_value (GTK_RANGE (wscroll)) != 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