[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3ba3fdf7aa: Make C-mouse-3 on scroll bars work on Haiku
From: |
Po Lu |
Subject: |
master 3ba3fdf7aa: Make C-mouse-3 on scroll bars work on Haiku |
Date: |
Fri, 11 Mar 2022 21:55:00 -0500 (EST) |
branch: master
commit 3ba3fdf7aa8637afa4329bc17edfb034ee5c8162
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
src/haiku_support.cc | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 07e3ee2bb6..c95cd6d940 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 ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3ba3fdf7aa: Make C-mouse-3 on scroll bars work on Haiku,
Po Lu <=