]> git.eshelyaron.com Git - emacs.git/commitdiff
Make Haiku scroll bar behave more like other programs
authorPo Lu <luangruo@yahoo.com>
Fri, 15 Apr 2022 02:38:19 +0000 (02:38 +0000)
committerPo Lu <luangruo@yahoo.com>
Fri, 15 Apr 2022 02:38:35 +0000 (02:38 +0000)
* haiku_support.cc (class EmacsScrollBar): New field
`repeater_start'.
(Pulse): Wait for time to pass repeater_delay.
(MouseDown): Set it to the current time + the system repeater
delay.

src/haiku_support.cc

index 0642dbacff729c90241c31f6620da495201ee2c1..d92e3d95ac32a5c6cd7b1c7916cd0d2382407c85 100644 (file)
@@ -1787,6 +1787,7 @@ public:
   int last_reported_overscroll_value;
   int max_value, real_max_value;
   int overscroll_start_value;
+  bigtime_t repeater_start;
 
   EmacsScrollBar (int x, int y, int x1, int y1, bool horizontal_p) :
     BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ?
@@ -1874,14 +1875,17 @@ public:
        return;
       }
 
-    GetMouse (&point, &buttons, false);
-
-    if (ButtonRegionFor (current_part).Contains (point))
+    if (repeater_start < system_time ())
       {
-       rq.scroll_bar = this;
-       rq.window = Window ();
-       rq.part = current_part;
-       haiku_write (SCROLL_BAR_PART_EVENT, &rq);
+       GetMouse (&point, &buttons, false);
+
+       if (ButtonRegionFor (current_part).Contains (point))
+         {
+           rq.scroll_bar = this;
+           rq.window = Window ();
+           rq.part = current_part;
+           haiku_write (SCROLL_BAR_PART_EVENT, &rq);
+         }
       }
 
     BScrollBar::Pulse ();
@@ -2015,6 +2019,8 @@ public:
        return;
       }
 
+    repeater_start = system_time () + 300000;
+
     if (buttons == B_PRIMARY_MOUSE_BUTTON)
       {
        r = ButtonRegionFor (HAIKU_SCROLL_BAR_UP_BUTTON);