emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d0ff20f2e6: Fix horizontal scroll bar updating on Haiku


From: Po Lu
Subject: master d0ff20f2e6: Fix horizontal scroll bar updating on Haiku
Date: Fri, 11 Mar 2022 22:17:18 -0500 (EST)

branch: master
commit d0ff20f2e64d9247a5e0e26ddfd7e185e51d8c58
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix horizontal scroll bar updating on Haiku
    
    * src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Just
    take portion and position without adjustments.
---
 src/haikuterm.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/haikuterm.c b/src/haikuterm.c
index 4ecc738898..cd0dcb0834 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 *



reply via email to

[Prev in Thread] Current Thread [Next in Thread]