emacs-diffs
[Top][All Lists]
Advanced

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

master 17fd48efab 2/2: Enable overscroll on Haiku horizontal scroll bars


From: Po Lu
Subject: master 17fd48efab 2/2: Enable overscroll on Haiku horizontal scroll bars
Date: Sun, 13 Mar 2022 20:55:12 -0400 (EDT)

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

    Enable overscroll on Haiku horizontal scroll bars
    
    * src/haiku_support.cc (MouseMoved): Handle horizontal
    directions correctly.
    * src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb):
    Enable overscrolling on scroll bar widget.
---
 src/haiku_support.cc | 17 +++++++++++++----
 src/haikuterm.c      |  2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 3941dc0409..1c1be178d2 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1882,7 +1882,10 @@ public:
 
     if (in_overscroll)
       {
-       diff = point.y - last_overscroll.y;
+       if (horizontal)
+         diff = point.x - last_overscroll.x;
+       else
+         diff = point.y - last_overscroll.y;
 
        if (diff < 0)
          {
@@ -1894,10 +1897,16 @@ public:
        bounds = Bounds ();
        bounds.InsetBy (1.0, 1.0);
        value = overscroll_start_value;
-       trough_size = BE_RECT_HEIGHT (bounds);
-       trough_size -= BE_RECT_WIDTH (bounds) / 2;
+       trough_size = (horizontal
+                      ? BE_RECT_WIDTH (bounds)
+                      : BE_RECT_HEIGHT (bounds));
+       trough_size -= (horizontal
+                       ? BE_RECT_HEIGHT (bounds)
+                       : BE_RECT_WIDTH (bounds)) / 2;
        if (info.double_arrows)
-         trough_size -= BE_RECT_WIDTH (bounds) / 2;
+         trough_size -= (horizontal
+                         ? BE_RECT_HEIGHT (bounds)
+                         : BE_RECT_WIDTH (bounds)) / 2;
 
        value += ((double) range / trough_size) * diff;
 
diff --git a/src/haikuterm.c b/src/haikuterm.c
index 7982869589..52846fc145 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -503,7 +503,7 @@ haiku_set_horizontal_scroll_bar_thumb (struct scroll_bar 
*bar, int portion,
     bar->page_size = size;
 
   BView_scroll_bar_update (scroll_bar, lrint (size), BE_SB_MAX,
-                          ceil (value), bar->dragging, false);
+                          ceil (value), bar->dragging ? -1 : 0, true);
 }
 
 static struct scroll_bar *



reply via email to

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