]> git.eshelyaron.com Git - emacs.git/commitdiff
Enable overscroll on Haiku horizontal scroll bars
authorPo Lu <luangruo@yahoo.com>
Mon, 14 Mar 2022 00:54:10 +0000 (00:54 +0000)
committerPo Lu <luangruo@yahoo.com>
Mon, 14 Mar 2022 00:54:10 +0000 (00:54 +0000)
* 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
src/haikuterm.c

index 3941dc0409da5c092373d6c1b94a643ed7e6feb1..1c1be178d20fd3232c573782c7e62f561ef0632b 100644 (file)
@@ -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;
 
index 798286958996a37b0c3884730f9a4543dc750cce..52846fc14507ff0196df00a528321f0cda93a5a7 100644 (file)
@@ -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 *