emacs-diffs
[Top][All Lists]
Advanced

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

master b279e1a5ec: Slightly improve scrollbar position accounting on Hai


From: Po Lu
Subject: master b279e1a5ec: Slightly improve scrollbar position accounting on Haiku
Date: Fri, 11 Mar 2022 19:47:47 -0500 (EST)

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

    Slightly improve scrollbar position accounting on Haiku
    
    * src/haiku_support.cc (MessageReceived): Use floats for
    calculating portion and subtract proportion directly.
    * src/haikuterm.c (haiku_set_scroll_bar_thumb): Take ceiling of
    value instead of rounding it.
---
 src/haiku_support.cc | 6 +++---
 src/haikuterm.c      | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index dcea69bb9a..07e3ee2bb6 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1578,20 +1578,20 @@ public:
   MessageReceived (BMessage *msg)
   {
     int32 portion, range;
-    double proportion;
+    float proportion;
 
     if (msg->what == SCROLL_BAR_UPDATE)
       {
        old_value = msg->GetInt32 ("emacs:units", 0);
        portion = msg->GetInt32 ("emacs:portion", 0);
        range = msg->GetInt32 ("emacs:range", 0);
-       proportion = (double) portion / range;
+       proportion = (float) portion / range;
 
        if (!msg->GetBool ("emacs:dragging", false))
          {
            /* Unlike on Motif, PORTION isn't included in the total
               range of the scroll bar.  */
-           this->SetRange (0, std::floor ((double) range - (range * 
proportion)));
+           this->SetRange (0, range - portion);
            this->SetValue (old_value);
            this->SetProportion (proportion);
          }
diff --git a/src/haikuterm.c b/src/haikuterm.c
index 119c54b17a..4ecc738898 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -485,7 +485,7 @@ haiku_set_scroll_bar_thumb (struct scroll_bar *bar, int 
portion,
     }
 
   BView_scroll_bar_update (scroll_bar, lrint (size),
-                          BE_SB_MAX, lrint (value), bar->dragging);
+                          BE_SB_MAX, ceil (value), bar->dragging);
 }
 
 static void



reply via email to

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