Commit 677859b7 authored by Po Lu's avatar Po Lu
Browse files

Add pixel delta support for wheel events on Haiku

* src/haiku_support.cc (EmacsWindow.MessageReceived): Stop
adjusting scroll deltas.
* src/haikuterm.c (haiku_read_socket): Handle pixel deltas
correctly.
parent b6570602
Pipeline #14087 passed with stages
in 125 minutes and 56 seconds
......@@ -631,8 +631,8 @@ class EmacsWindow : public BDirectWindow
if (msg->FindFloat ("be:wheel_delta_x", &dx) == B_OK &&
msg->FindFloat ("be:wheel_delta_y", &dy) == B_OK)
{
rq.delta_x = dx * 10;
rq.delta_y = dy * 10;
rq.delta_x = dx;
rq.delta_y = dy;
haiku_write (WHEEL_MOVE_EVENT, &rq);
};
......
......@@ -3005,34 +3005,26 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
if (signbit (py) != signbit (b->delta_y))
py = 0;
px += b->delta_x;
py += b->delta_y;
px += b->delta_x * pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0);
py += b->delta_y * pow (FRAME_PIXEL_HEIGHT (f), 2.0 / 3.0);
if (fabsf (py) >= FRAME_LINE_HEIGHT (f))
if (fabsf (py) >= FRAME_LINE_HEIGHT (f)
|| fabsf (px) >= FRAME_COLUMN_WIDTH (f)
|| !x_coalesce_scroll_events)
{
inev.kind = WHEEL_EVENT;
inev.kind = (fabsf (px) > fabs (py)
? HORIZ_WHEEL_EVENT
: WHEEL_EVENT);
inev.code = 0;
XSETINT (inev.x, x);
XSETINT (inev.y, y);
XSETINT (inev.arg, lrint (fabsf (py) / FRAME_LINE_HEIGHT (f)));
inev.arg = list3 (Qnil, make_float (px),
make_float (py));
XSETFRAME (inev.frame_or_window, f);
inev.modifiers |= signbit (py) ? up_modifier : down_modifier;
py = 0.0f;
}
if (fabsf (px) >= FRAME_COLUMN_WIDTH (f))
{
inev2.kind = HORIZ_WHEEL_EVENT;
inev2.code = 0;
XSETINT (inev2.x, x);
XSETINT (inev2.y, y);
XSETINT (inev2.arg, lrint (fabsf (px) / FRAME_COLUMN_WIDTH (f)));
XSETFRAME (inev2.frame_or_window, f);
inev2.modifiers |= signbit (px) ? up_modifier : down_modifier;
px = 0.0f;
}
......@@ -3548,6 +3540,10 @@ syms_of_haikuterm (void)
doc: /* SKIP: real doc in xterm.c. */);
Vx_toolkit_scroll_bars = Qt;
DEFVAR_BOOL ("x-coalesce-scroll-events", x_coalesce_scroll_events,
doc: /* SKIP: real doc in xterm.c. */);
x_coalesce_scroll_events = true;
DEFVAR_BOOL ("haiku-debug-on-fatal-error", haiku_debug_on_fatal_error,
doc: /* If non-nil, Emacs will launch the system debugger upon a fatal error. */);
haiku_debug_on_fatal_error = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment