From 7db3233f116a58e6ef36d36adc9b59dd732d2c16 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 7 Feb 2019 14:15:38 +1000 Subject: [PATCH] Drop the AS_MASK macro, replace with bit Signed-off-by: Peter Hutterer --- src/evdev-fallback.c | 4 ++-- src/evdev-mt-touchpad-edge-scroll.c | 6 +++--- src/evdev.c | 8 ++++---- src/libinput-util.h | 1 - src/libinput.c | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 3470a77..d50b9c5 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -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); diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index b218415..497e4bd 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -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); diff --git a/src/evdev.c b/src/evdev.c index 53efcb2..11e750e 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -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, diff --git a/src/libinput-util.h b/src/libinput-util.h index 13af403..270c05e 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -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)) diff --git a/src/libinput.c b/src/libinput.c index c17cc1a..60286a6 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -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; -- 2.7.4