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

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.
This commit is contained in:
Po Lu 2022-03-12 02:47:03 +00:00
parent b279e1a5ec
commit 3ba3fdf7aa

View file

@ -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 ();