aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-03-12 02:47:03 +0000
committerPo Lu2022-03-12 02:47:03 +0000
commit3ba3fdf7aa8637afa4329bc17edfb034ee5c8162 (patch)
treebbbf13a1fb50d655ded47d3c28bbada3015b1477 /src
parentb279e1a5ece70c2b1bb1ab32572473d0cb667b52 (diff)
downloademacs-3ba3fdf7aa8637afa4329bc17edfb034ee5c8162.tar.gz
emacs-3ba3fdf7aa8637afa4329bc17edfb034ee5c8162.zip
Make C-mouse-3 on scroll bars work on Haiku
* src/haiku_support.cc (class EmacsScrollBar): New field `handle_button'. (MouseDown, MouseUp): Pass button events with ControlMask to parent view.
Diffstat (limited to 'src')
-rw-r--r--src/haiku_support.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 07e3ee2bb64..c95cd6d940f 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1563,6 +1563,9 @@ public:
1563 float old_value; 1563 float old_value;
1564 scroll_bar_info info; 1564 scroll_bar_info info;
1565 1565
1566 /* True if button events should be passed to the parent. */
1567 bool handle_button = false;
1568
1566 EmacsScrollBar (int x, int y, int x1, int y1, bool horizontal_p) : 1569 EmacsScrollBar (int x, int y, int x1, int y1, bool horizontal_p) :
1567 BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ? 1570 BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ?
1568 B_HORIZONTAL : B_VERTICAL) 1571 B_HORIZONTAL : B_VERTICAL)
@@ -1703,9 +1706,11 @@ public:
1703 BRegion r; 1706 BRegion r;
1704 BLooper *looper; 1707 BLooper *looper;
1705 BMessage *message; 1708 BMessage *message;
1706 int32 buttons; 1709 int32 buttons, mods;
1710 BView *parent;
1707 1711
1708 looper = Looper (); 1712 looper = Looper ();
1713 message = NULL;
1709 1714
1710 if (!looper) 1715 if (!looper)
1711 GetMouse (&pt, (uint32 *) &buttons, false); 1716 GetMouse (&pt, (uint32 *) &buttons, false);
@@ -1717,6 +1722,18 @@ public:
1717 GetMouse (&pt, (uint32 *) &buttons, false); 1722 GetMouse (&pt, (uint32 *) &buttons, false);
1718 } 1723 }
1719 1724
1725 if (message && (message->FindInt32 ("modifiers", &mods)
1726 == B_OK)
1727 && mods & B_CONTROL_KEY)
1728 {
1729 /* Allow C-mouse-3 to split the window on a scroll bar. */
1730 handle_button = true;
1731 parent = Parent ();
1732 parent->MouseDown (ConvertToParent (pt));
1733
1734 return;
1735 }
1736
1720 if (buttons == B_PRIMARY_MOUSE_BUTTON) 1737 if (buttons == B_PRIMARY_MOUSE_BUTTON)
1721 { 1738 {
1722 r = ButtonRegionFor (HAIKU_SCROLL_BAR_UP_BUTTON); 1739 r = ButtonRegionFor (HAIKU_SCROLL_BAR_UP_BUTTON);
@@ -1762,6 +1779,17 @@ public:
1762 MouseUp (BPoint pt) 1779 MouseUp (BPoint pt)
1763 { 1780 {
1764 struct haiku_scroll_bar_drag_event rq; 1781 struct haiku_scroll_bar_drag_event rq;
1782 BView *parent;
1783
1784 if (handle_button)
1785 {
1786 handle_button = false;
1787 parent = Parent ();
1788 parent->MouseUp (ConvertToParent (pt));
1789
1790 return;
1791 }
1792
1765 rq.dragging_p = 0; 1793 rq.dragging_p = 0;
1766 rq.scroll_bar = this; 1794 rq.scroll_bar = this;
1767 rq.window = Window (); 1795 rq.window = Window ();