]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix horizontal scroll bar updating on Haiku
authorPo Lu <luangruo@yahoo.com>
Sat, 12 Mar 2022 03:16:00 +0000 (03:16 +0000)
committerPo Lu <luangruo@yahoo.com>
Sat, 12 Mar 2022 03:16:00 +0000 (03:16 +0000)
* src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb): Just
take portion and position without adjustments.

src/haikuterm.c

index 4ecc738898ec97df014760a61f6636d7bf80731c..cd0dcb083422ac2b0717f970a3c01501d44aa395 100644 (file)
@@ -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 *