Drop the AS_MASK macro, replace with bit
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 7 Feb 2019 04:15:38 +0000 (14:15 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 11 Feb 2019 03:46:31 +0000 (13:46 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-fallback.c
src/evdev-mt-touchpad-edge-scroll.c
src/evdev.c
src/libinput-util.h
src/libinput.c

index 3470a77..d50b9c5 100644 (file)
@@ -238,7 +238,7 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch,
                evdev_notify_axis(
                        device,
                        time,
-                       AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL),
+                       bit(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL),
                        source,
                        &wheel_degrees,
                        &discrete);
@@ -257,7 +257,7 @@ fallback_flush_wheels(struct fallback_dispatch *dispatch,
                evdev_notify_axis(
                        device,
                        time,
-                       AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL),
+                       bit(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL),
                        source,
                        &wheel_degrees,
                        &discrete);
index b218415..497e4bd 100644 (file)
@@ -412,7 +412,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
                                if (t->scroll.direction != -1) {
                                        /* Send stop scroll event */
                                        evdev_notify_axis(device, time,
-                                               AS_MASK(t->scroll.direction),
+                                               bit(t->scroll.direction),
                                                LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
                                                &zero,
                                                &zero_discrete);
@@ -462,7 +462,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
                        continue;
 
                evdev_notify_axis(device, time,
-                                 AS_MASK(axis),
+                                 bit(axis),
                                  LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
                                  &normalized,
                                  &zero_discrete);
@@ -485,7 +485,7 @@ tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time)
        tp_for_each_touch(tp, t) {
                if (t->scroll.direction != -1) {
                        evdev_notify_axis(device, time,
-                                           AS_MASK(t->scroll.direction),
+                                           bit(t->scroll.direction),
                                            LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
                                            &zero,
                                            &zero_discrete);
index 53efcb2..11e750e 100644 (file)
@@ -2398,7 +2398,7 @@ evdev_is_scrolling(const struct evdev_device *device,
        assert(axis == LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL ||
               axis == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
 
-       return (device->scroll.direction & AS_MASK(axis)) != 0;
+       return (device->scroll.direction & bit(axis)) != 0;
 }
 
 static inline void
@@ -2408,7 +2408,7 @@ evdev_start_scrolling(struct evdev_device *device,
        assert(axis == LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL ||
               axis == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
 
-       device->scroll.direction |= AS_MASK(axis);
+       device->scroll.direction |= bit(axis);
 }
 
 void
@@ -2473,9 +2473,9 @@ evdev_post_scroll(struct evdev_device *device,
                uint32_t axes = device->scroll.direction;
 
                if (event.y == 0.0)
-                       axes &= ~AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
+                       axes &= ~bit(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
                if (event.x == 0.0)
-                       axes &= ~AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
+                       axes &= ~bit(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
 
                evdev_notify_axis(device,
                                  time,
index 13af403..270c05e 100644 (file)
@@ -124,7 +124,6 @@ bool list_empty(const struct list *list);
 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
 #define ARRAY_FOR_EACH(_arr, _elem) \
        for (size_t _i = 0; _i < ARRAY_LENGTH(_arr) && (_elem = &_arr[_i]); _i++)
-#define AS_MASK(v) (1 << (v))
 
 #define min(a, b) (((a) < (b)) ? (a) : (b))
 #define max(a, b) (((a) > (b)) ? (a) : (b))
index c17cc1a..60286a6 100644 (file)
@@ -685,7 +685,7 @@ libinput_event_pointer_has_axis(struct libinput_event_pointer *event,
        switch (axis) {
        case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
        case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
-               return !!(event->axes & AS_MASK(axis));
+               return !!(event->axes & bit(axis));
        }
 
        return 0;