From: Peter Hutterer Date: Sat, 26 Apr 2014 10:01:22 +0000 (+1000) Subject: Name-space the scroll event types X-Git-Tag: 0.4.0~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55bf5058077fe66f42c2bf104df98139ab5d9303;p=platform%2Fupstream%2Flibinput.git 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 Reviewed-by: Hans de Goede --- diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 787afa4c..4811bf31 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -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; diff --git a/src/evdev.c b/src/evdev.c index 70c232ce..b6412d01 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -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: diff --git a/src/libinput.h b/src/libinput.h index fe75f87d..b1b1124e 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -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 diff --git a/test/pointer.c b/test/pointer.c index fd76ffe7..346e59b7 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -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); } diff --git a/tools/event-debug.c b/tools/event-debug.c index 0f0d0339..34acfce2 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -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: