From: Po Lu Date: Sat, 12 Mar 2022 03:16:00 +0000 (+0000) Subject: Fix horizontal scroll bar updating on Haiku X-Git-Tag: emacs-29.0.90~1931^2~1189 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d0ff20f2e64d9247a5e0e26ddfd7e185e51d8c58;p=emacs.git Fix horizontal scroll bar updating on Haiku * src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Just take portion and position without adjustments. --- diff --git a/src/haikuterm.c b/src/haikuterm.c index 4ecc738898e..cd0dcb08342 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -493,20 +493,19 @@ haiku_set_horizontal_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole) { void *scroll_bar = bar->scroll_bar; - float shown, top; - int size, value; + double size, value, shown, top; - shown = (float) portion / whole; - top = (float) position / (whole - portion); + shown = (double) portion / whole; + top = (double) position / whole; - size = clip_to_bounds (1, shown * BE_SB_MAX, BE_SB_MAX); - value = clip_to_bounds (0, top * (BE_SB_MAX - size), BE_SB_MAX - size); + size = shown * BE_SB_MAX; + value = top * BE_SB_MAX; if (!bar->dragging) bar->page_size = size; - BView_scroll_bar_update (scroll_bar, shown, BE_SB_MAX, value, - bar->dragging); + BView_scroll_bar_update (scroll_bar, lrint (size), BE_SB_MAX, + ceil (value), bar->dragging); } static struct scroll_bar *