aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-03-12 00:46:39 +0000
committerPo Lu2022-03-12 00:46:39 +0000
commitb279e1a5ece70c2b1bb1ab32572473d0cb667b52 (patch)
treeb03d355fb5023f1870a3fead521a2f358b8d62a3 /src
parent0470a4a939772c4bd25123b15f5eadab41f8bee5 (diff)
downloademacs-b279e1a5ece70c2b1bb1ab32572473d0cb667b52.tar.gz
emacs-b279e1a5ece70c2b1bb1ab32572473d0cb667b52.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/haiku_support.cc6
-rw-r--r--src/haikuterm.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index dcea69bb9a7..07e3ee2bb64 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1578,20 +1578,20 @@ public:
1578 MessageReceived (BMessage *msg) 1578 MessageReceived (BMessage *msg)
1579 { 1579 {
1580 int32 portion, range; 1580 int32 portion, range;
1581 double proportion; 1581 float proportion;
1582 1582
1583 if (msg->what == SCROLL_BAR_UPDATE) 1583 if (msg->what == SCROLL_BAR_UPDATE)
1584 { 1584 {
1585 old_value = msg->GetInt32 ("emacs:units", 0); 1585 old_value = msg->GetInt32 ("emacs:units", 0);
1586 portion = msg->GetInt32 ("emacs:portion", 0); 1586 portion = msg->GetInt32 ("emacs:portion", 0);
1587 range = msg->GetInt32 ("emacs:range", 0); 1587 range = msg->GetInt32 ("emacs:range", 0);
1588 proportion = (double) portion / range; 1588 proportion = (float) portion / range;
1589 1589
1590 if (!msg->GetBool ("emacs:dragging", false)) 1590 if (!msg->GetBool ("emacs:dragging", false))
1591 { 1591 {
1592 /* Unlike on Motif, PORTION isn't included in the total 1592 /* Unlike on Motif, PORTION isn't included in the total
1593 range of the scroll bar. */ 1593 range of the scroll bar. */
1594 this->SetRange (0, std::floor ((double) range - (range * proportion))); 1594 this->SetRange (0, range - portion);
1595 this->SetValue (old_value); 1595 this->SetValue (old_value);
1596 this->SetProportion (proportion); 1596 this->SetProportion (proportion);
1597 } 1597 }
diff --git a/src/haikuterm.c b/src/haikuterm.c
index 119c54b17ac..4ecc738898e 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -485,7 +485,7 @@ haiku_set_scroll_bar_thumb (struct scroll_bar *bar, int portion,
485 } 485 }
486 486
487 BView_scroll_bar_update (scroll_bar, lrint (size), 487 BView_scroll_bar_update (scroll_bar, lrint (size),
488 BE_SB_MAX, lrint (value), bar->dragging); 488 BE_SB_MAX, ceil (value), bar->dragging);
489} 489}
490 490
491static void 491static void