diff options
| author | Po Lu | 2022-03-24 05:32:34 +0000 |
|---|---|---|
| committer | Po Lu | 2022-03-24 05:32:34 +0000 |
| commit | 97f9eeaaefebf5f3852b062535f7c041831609bd (patch) | |
| tree | b8707c40ef61b0ce6b3502e3133b8d747888a519 /src | |
| parent | ebd5725e0b2f7e1dcf6dcb068bef638edd7f0cb4 (diff) | |
| download | emacs-97f9eeaaefebf5f3852b062535f7c041831609bd.tar.gz emacs-97f9eeaaefebf5f3852b062535f7c041831609bd.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haiku_support.cc | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 5ad3c7c794d..b58420fcb99 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc | |||
| @@ -422,6 +422,10 @@ public: | |||
| 422 | B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS) | 422 | B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS) |
| 423 | { | 423 | { |
| 424 | window_id = current_window_id++; | 424 | window_id = current_window_id++; |
| 425 | |||
| 426 | /* This pulse rate is used by scroll bars for repeating a button | ||
| 427 | action while a button is held down. */ | ||
| 428 | SetPulseRate (30000); | ||
| 425 | } | 429 | } |
| 426 | 430 | ||
| 427 | ~EmacsWindow () | 431 | ~EmacsWindow () |
| @@ -1766,10 +1770,35 @@ public: | |||
| 1766 | } | 1770 | } |
| 1767 | 1771 | ||
| 1768 | void | 1772 | void |
| 1773 | Pulse (void) | ||
| 1774 | { | ||
| 1775 | struct haiku_scroll_bar_part_event rq; | ||
| 1776 | BPoint point; | ||
| 1777 | uint32 buttons; | ||
| 1778 | |||
| 1779 | if (!dragging) | ||
| 1780 | { | ||
| 1781 | SetFlags (Flags () & ~B_PULSE_NEEDED); | ||
| 1782 | return; | ||
| 1783 | } | ||
| 1784 | |||
| 1785 | GetMouse (&point, &buttons, false); | ||
| 1786 | |||
| 1787 | if (ButtonRegionFor (current_part).Contains (point)) | ||
| 1788 | { | ||
| 1789 | rq.scroll_bar = this; | ||
| 1790 | rq.window = Window (); | ||
| 1791 | rq.part = current_part; | ||
| 1792 | haiku_write (SCROLL_BAR_PART_EVENT, &rq); | ||
| 1793 | } | ||
| 1794 | |||
| 1795 | BScrollBar::Pulse (); | ||
| 1796 | } | ||
| 1797 | |||
| 1798 | void | ||
| 1769 | ValueChanged (float new_value) | 1799 | ValueChanged (float new_value) |
| 1770 | { | 1800 | { |
| 1771 | struct haiku_scroll_bar_value_event rq; | 1801 | struct haiku_scroll_bar_value_event rq; |
| 1772 | struct haiku_scroll_bar_part_event part; | ||
| 1773 | 1802 | ||
| 1774 | new_value = Value (); | 1803 | new_value = Value (); |
| 1775 | 1804 | ||
| @@ -1780,11 +1809,7 @@ public: | |||
| 1780 | if (dragging > 1) | 1809 | if (dragging > 1) |
| 1781 | { | 1810 | { |
| 1782 | SetValue (old_value); | 1811 | SetValue (old_value); |
| 1783 | 1812 | SetFlags (Flags () | B_PULSE_NEEDED); | |
| 1784 | part.scroll_bar = this; | ||
| 1785 | part.window = Window (); | ||
| 1786 | part.part = current_part; | ||
| 1787 | haiku_write (SCROLL_BAR_PART_EVENT, &part); | ||
| 1788 | } | 1813 | } |
| 1789 | else | 1814 | else |
| 1790 | dragging++; | 1815 | dragging++; |
| @@ -1924,6 +1949,12 @@ public: | |||
| 1924 | dragging = 1; | 1949 | dragging = 1; |
| 1925 | current_part = HAIKU_SCROLL_BAR_DOWN_BUTTON; | 1950 | current_part = HAIKU_SCROLL_BAR_DOWN_BUTTON; |
| 1926 | 1951 | ||
| 1952 | if (Value () == max_value) | ||
| 1953 | { | ||
| 1954 | SetFlags (Flags () | B_PULSE_NEEDED); | ||
| 1955 | dragging = 2; | ||
| 1956 | } | ||
| 1957 | |||
| 1927 | haiku_write (SCROLL_BAR_PART_EVENT, &part); | 1958 | haiku_write (SCROLL_BAR_PART_EVENT, &part); |
| 1928 | goto out; | 1959 | goto out; |
| 1929 | } | 1960 | } |
| @@ -1967,7 +1998,7 @@ public: | |||
| 1967 | rq.window = Window (); | 1998 | rq.window = Window (); |
| 1968 | 1999 | ||
| 1969 | haiku_write (SCROLL_BAR_DRAG_EVENT, &rq); | 2000 | haiku_write (SCROLL_BAR_DRAG_EVENT, &rq); |
| 1970 | dragging = false; | 2001 | dragging = 0; |
| 1971 | 2002 | ||
| 1972 | BScrollBar::MouseUp (pt); | 2003 | BScrollBar::MouseUp (pt); |
| 1973 | } | 2004 | } |