]> git.eshelyaron.com Git - emacs.git/commitdiff
Slightly improve scrollbar position accounting on Haiku
authorPo Lu <luangruo@yahoo.com>
Sat, 12 Mar 2022 00:46:39 +0000 (00:46 +0000)
committerPo Lu <luangruo@yahoo.com>
Sat, 12 Mar 2022 00:46:39 +0000 (00:46 +0000)
* 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
src/haikuterm.c

index dcea69bb9a7014b48434e8a64ce46bbf04bf2320..07e3ee2bb649380833a4659c2e6e057375275a80 100644 (file)
@@ -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);
          }
index 119c54b17ac5bae402d865c5aee3395df779070e..4ecc738898ec97df014760a61f6636d7bf80731c 100644 (file)
@@ -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