Name-space the scroll event types
authorPeter Hutterer <peter.hutterer@who-t.net>
Sat, 26 Apr 2014 10:01:22 +0000 (20:01 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 23 Jun 2014 04:31:56 +0000 (14:31 +1000)
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>
src/evdev-mt-touchpad.c
src/evdev.c
src/libinput.h
test/pointer.c
tools/event-debug.c

index 787afa4..4811bf3 100644 (file)
@@ -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;
index 70c232c..b6412d0 100644 (file)
@@ -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:
index fe75f87..b1b1124 100644 (file)
@@ -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
index fd76ffe..346e59b 100644 (file)
@@ -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);
 }
index 0f0d033..34acfce 100644 (file)
@@ -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: