1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-10 05:30:45 -08:00

Allow holding down scroll bar buttons on Haiku when overscrolling

* src/haiku_support.cc (EmacsWindow): Set appropriate pulse
rate.
(class EmacsScrollBar, ValueChanged): Don't send any part events
here.
(MouseDown): Set dragging to a value larger than 1 if the scroll
bar is at the end.
(Pulse): New method.
This commit is contained in:
Po Lu 2022-03-24 05:32:34 +00:00
parent ebd5725e0b
commit 97f9eeaaef

View file

@ -422,6 +422,10 @@ public:
B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS)
{
window_id = current_window_id++;
/* This pulse rate is used by scroll bars for repeating a button
action while a button is held down. */
SetPulseRate (30000);
}
~EmacsWindow ()
@ -1765,11 +1769,36 @@ public:
BScrollBar::MessageReceived (msg);
}
void
Pulse (void)
{
struct haiku_scroll_bar_part_event rq;
BPoint point;
uint32 buttons;
if (!dragging)
{
SetFlags (Flags () & ~B_PULSE_NEEDED);
return;
}
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 ();
}
void
ValueChanged (float new_value)
{
struct haiku_scroll_bar_value_event rq;
struct haiku_scroll_bar_part_event part;
new_value = Value ();
@ -1780,11 +1809,7 @@ public:
if (dragging > 1)
{
SetValue (old_value);
part.scroll_bar = this;
part.window = Window ();
part.part = current_part;
haiku_write (SCROLL_BAR_PART_EVENT, &part);
SetFlags (Flags () | B_PULSE_NEEDED);
}
else
dragging++;
@ -1924,6 +1949,12 @@ public:
dragging = 1;
current_part = HAIKU_SCROLL_BAR_DOWN_BUTTON;
if (Value () == max_value)
{
SetFlags (Flags () | B_PULSE_NEEDED);
dragging = 2;
}
haiku_write (SCROLL_BAR_PART_EVENT, &part);
goto out;
}
@ -1967,7 +1998,7 @@ public:
rq.window = Window ();
haiku_write (SCROLL_BAR_DRAG_EVENT, &rq);
dragging = false;
dragging = 0;
BScrollBar::MouseUp (pt);
}