diff options
author | JoseExposito <jose.exposito89@gmail.com> | 2021-03-11 08:30:45 +0100 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-17 03:23:56 +0000 |
commit | 0f79fe66779075e6bda85248e38ae61810b76241 (patch) | |
tree | bcff10f88fde26e87bea4722ddcc5ef1f05eeaa4 /src | |
parent | 06697b5e85e54965952bfd8efac67c8bde3ff4bc (diff) | |
download | libinput-0f79fe66779075e6bda85248e38ae61810b76241.tar.gz |
fallback: replace fallback_dispatch->wheel with an anonymous struct
The current fallback_dispatch wheel struct, a device_coords, doesn't allow to
save extra information.
The new anonymous struct will allow to add a is_inhibited field to disable mouse
scroll while the middle button is pressed and, potentially, any required extra
state in the future.
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/evdev-fallback.c | 28 | ||||
-rw-r--r-- | src/evdev-fallback.h | 5 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index b313d549..f24db171 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -215,22 +215,22 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch, if (device->model_flags & EVDEV_MODEL_LENOVO_SCROLLPOINT) { struct normalized_coords unaccel = { 0.0, 0.0 }; - dispatch->wheel.y *= -1; - normalize_delta(device, &dispatch->wheel, &unaccel); + dispatch->wheel.delta.y *= -1; + normalize_delta(device, &dispatch->wheel.delta, &unaccel); evdev_post_scroll(device, time, LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, &unaccel); - dispatch->wheel.x = 0; - dispatch->wheel.y = 0; + dispatch->wheel.delta.x = 0; + dispatch->wheel.delta.y = 0; return; } - if (dispatch->wheel.y != 0) { - wheel_degrees.y = -1 * dispatch->wheel.y * + if (dispatch->wheel.delta.y != 0) { + wheel_degrees.y = -1 * dispatch->wheel.delta.y * device->scroll.wheel_click_angle.y; - discrete.y = -1 * dispatch->wheel.y; + discrete.y = -1 * dispatch->wheel.delta.y; evdev_notify_axis( device, @@ -239,13 +239,13 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch, LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, &wheel_degrees, &discrete); - dispatch->wheel.y = 0; + dispatch->wheel.delta.y = 0; } - if (dispatch->wheel.x != 0) { - wheel_degrees.x = dispatch->wheel.x * + if (dispatch->wheel.delta.x != 0) { + wheel_degrees.x = dispatch->wheel.delta.x * device->scroll.wheel_click_angle.x; - discrete.x = dispatch->wheel.x; + discrete.x = dispatch->wheel.delta.x; evdev_notify_axis( device, @@ -254,7 +254,7 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch, LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, &wheel_degrees, &discrete); - dispatch->wheel.x = 0; + dispatch->wheel.delta.x = 0; } } @@ -827,11 +827,11 @@ fallback_process_relative(struct fallback_dispatch *dispatch, dispatch->pending_event |= EVDEV_RELATIVE_MOTION; break; case REL_WHEEL: - dispatch->wheel.y += e->value; + dispatch->wheel.delta.y += e->value; dispatch->pending_event |= EVDEV_WHEEL; break; case REL_HWHEEL: - dispatch->wheel.x += e->value; + dispatch->wheel.delta.x += e->value; dispatch->pending_event |= EVDEV_WHEEL; break; } diff --git a/src/evdev-fallback.h b/src/evdev-fallback.h index d1223ba5..5ab9d352 100644 --- a/src/evdev-fallback.h +++ b/src/evdev-fallback.h @@ -96,7 +96,10 @@ struct fallback_dispatch { } mt; struct device_coords rel; - struct device_coords wheel; + + struct { + struct device_coords delta; + } wheel; struct { /* The struct for the tablet mode switch device itself */ |