mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
Name-space the scroll event types
To provide a generic naming system of type_direction. That will become more important once we add new axes as part of the ongoing work to support graphics tablets. [edit: and switch to the new defines] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
41f9176c0a
commit
55bf505807
5 changed files with 26 additions and 20 deletions
|
|
@ -466,11 +466,11 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
|
|||
/* Require at least three px scrolling to start */
|
||||
if (dy <= -3.0 || dy >= 3.0) {
|
||||
tp->scroll.state = SCROLL_STATE_SCROLLING;
|
||||
tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL);
|
||||
tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||
}
|
||||
if (dx <= -3.0 || dx >= 3.0) {
|
||||
tp->scroll.state = SCROLL_STATE_SCROLLING;
|
||||
tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL);
|
||||
tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
||||
}
|
||||
|
||||
if (tp->scroll.state == SCROLL_STATE_NONE)
|
||||
|
|
@ -481,18 +481,18 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
|
|||
t->is_pointer = false;
|
||||
|
||||
if (dy != 0.0 &&
|
||||
(tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL))) {
|
||||
(tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL))) {
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||
dy);
|
||||
}
|
||||
|
||||
if (dx != 0.0 &&
|
||||
(tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL))) {
|
||||
(tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL))) {
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
|
||||
dx);
|
||||
}
|
||||
}
|
||||
|
|
@ -504,15 +504,15 @@ tp_stop_scroll_events(struct tp_dispatch *tp, uint64_t time)
|
|||
return;
|
||||
|
||||
/* terminate scrolling with a zero scroll event */
|
||||
if (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL))
|
||||
if (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL))
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||
0);
|
||||
if (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL))
|
||||
if (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL))
|
||||
pointer_notify_axis(&tp->device->base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
|
||||
0);
|
||||
|
||||
tp->scroll.state = SCROLL_STATE_NONE;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ evdev_process_relative(struct evdev_device *device,
|
|||
pointer_notify_axis(
|
||||
base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||
-1 * e->value * DEFAULT_AXIS_STEP_DISTANCE);
|
||||
break;
|
||||
case REL_HWHEEL:
|
||||
|
|
@ -403,7 +403,7 @@ evdev_process_relative(struct evdev_device *device,
|
|||
pointer_notify_axis(
|
||||
base,
|
||||
time,
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
|
||||
e->value * DEFAULT_AXIS_STEP_DISTANCE);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -164,8 +164,14 @@ enum libinput_button_state {
|
|||
* Axes on a device that are not x or y coordinates.
|
||||
*/
|
||||
enum libinput_pointer_axis {
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL = 0,
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL = 1
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL = 0,
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL = 1,
|
||||
|
||||
|
||||
/** @deprecated Use @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL instead */
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||
/** @deprecated Use @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL instead */
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -595,8 +601,8 @@ libinput_event_pointer_get_axis(struct libinput_event_pointer *event);
|
|||
*
|
||||
* Return the axis value of the given axis. The interpretation of the value
|
||||
* is dependent on the axis. For the two scrolling axes
|
||||
* LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL and
|
||||
* LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL, the value of the event is in
|
||||
* LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and
|
||||
* LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in
|
||||
* relative scroll units, with the positive direction being down or right,
|
||||
* respectively. The dimension of a scroll unit is equal to one unit of
|
||||
* motion in the respective axis, where applicable (e.g. touchpad two-finger
|
||||
|
|
|
|||
|
|
@ -181,8 +181,8 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
|
|||
ck_assert(ptrev != NULL);
|
||||
ck_assert_int_eq(libinput_event_pointer_get_axis(ptrev),
|
||||
which == REL_WHEEL ?
|
||||
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL :
|
||||
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL);
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL :
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
||||
ck_assert_int_eq(libinput_event_pointer_get_axis_value(ptrev), expected);
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,10 +305,10 @@ print_axis_event(struct libinput_event *ev)
|
|||
double val;
|
||||
|
||||
switch (axis) {
|
||||
case LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
|
||||
ax = "vscroll";
|
||||
break;
|
||||
case LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
|
||||
ax = "hscroll";
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue