summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-03-12 02:47:03 +0000
committerPo Lu <luangruo@yahoo.com>2022-03-12 02:47:03 +0000
commit3ba3fdf7aa8637afa4329bc17edfb034ee5c8162 (patch)
treebbbf13a1fb50d655ded47d3c28bbada3015b1477
parentb279e1a5ece70c2b1bb1ab32572473d0cb667b52 (diff)
downloademacs-3ba3fdf7aa8637afa4329bc17edfb034ee5c8162.tar.gz
emacs-3ba3fdf7aa8637afa4329bc17edfb034ee5c8162.tar.bz2
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.
-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:
float old_value;
scroll_bar_info info;
+ /* True if button events should be passed to the parent. */
+ bool handle_button = false;
+
EmacsScrollBar (int x, int y, int x1, int y1, bool horizontal_p) :
BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ?
B_HORIZONTAL : B_VERTICAL)
@@ -1703,9 +1706,11 @@ public:
BRegion r;
BLooper *looper;
BMessage *message;
- int32 buttons;
+ int32 buttons, mods;
+ BView *parent;
looper = Looper ();
+ message = NULL;
if (!looper)
GetMouse (&pt, (uint32 *) &buttons, false);
@@ -1717,6 +1722,18 @@ public:
GetMouse (&pt, (uint32 *) &buttons, false);
}
+ if (message && (message->FindInt32 ("modifiers", &mods)
+ == B_OK)
+ && mods & B_CONTROL_KEY)
+ {
+ /* Allow C-mouse-3 to split the window on a scroll bar. */
+ handle_button = true;
+ parent = Parent ();
+ parent->MouseDown (ConvertToParent (pt));
+
+ return;
+ }
+
if (buttons == B_PRIMARY_MOUSE_BUTTON)
{
r = ButtonRegionFor (HAIKU_SCROLL_BAR_UP_BUTTON);
@@ -1762,6 +1779,17 @@ public:
MouseUp (BPoint pt)
{
struct haiku_scroll_bar_drag_event rq;
+ BView *parent;
+
+ if (handle_button)
+ {
+ handle_button = false;
+ parent = Parent ();
+ parent->MouseUp (ConvertToParent (pt));
+
+ return;
+ }
+
rq.dragging_p = 0;
rq.scroll_bar = this;
rq.window = Window ();