From 5af236a022e4838fe598ecce3328d0000418397c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 4 Jul 2016 15:41:37 +1000 Subject: evdev: switch three ints to booleans And a minor rename to make it more obvious Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-buttons.c | 2 +- src/evdev-mt-touchpad.c | 6 +++--- src/evdev.c | 17 +++++++++-------- src/evdev.h | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index d8ce10b..b59cf13 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -1056,7 +1056,7 @@ tp_notify_clickpadbutton(struct tp_dispatch *tp, } /* Ignore button events not for the trackpoint while suspended */ - if (tp->device->suspended) + if (tp->device->is_suspended) return 0; /* A button click always terminates edge scrolling, even if we diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 2c73428..bb88964 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -1118,7 +1118,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) int filter_motion = 0; /* Only post (top) button events while suspended */ - if (tp->device->suspended) { + if (tp->device->is_suspended) { tp_post_button_events(tp, time); return; } @@ -2166,7 +2166,7 @@ tp_init_default_resolution(struct tp_dispatch *tp, touchpad_height_mm = 50; int xres, yres; - if (!device->abs.fake_resolution) + if (!device->abs.is_fake_resolution) return; /* we only get here if @@ -2190,7 +2190,7 @@ tp_init_default_resolution(struct tp_dispatch *tp, libevdev_set_abs_resolution(device->evdev, ABS_Y, yres); libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_X, xres); libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_Y, yres); - device->abs.fake_resolution = 0; + device->abs.is_fake_resolution = false; } static inline void diff --git a/src/evdev.c b/src/evdev.c index aec08ee..3cc0f21 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2170,7 +2170,7 @@ evdev_extract_abs_axes(struct evdev_device *device) return; if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) - device->abs.fake_resolution = 1; + device->abs.is_fake_resolution = true; device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); device->abs.point.x = device->abs.absinfo_x->value; @@ -2188,7 +2188,7 @@ evdev_extract_abs_axes(struct evdev_device *device) if (evdev_fix_abs_resolution(device, ABS_MT_POSITION_X, ABS_MT_POSITION_Y)) - device->abs.fake_resolution = 1; + device->abs.is_fake_resolution = true; device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y); @@ -2374,7 +2374,8 @@ evdev_notify_added_device(struct evdev_device *device) device->dispatch->interface->device_added(device, d); /* Notify new device if existing device d is suspended */ - if (d->suspended && device->dispatch->interface->device_suspended) + if (d->is_suspended && + device->dispatch->interface->device_suspended) device->dispatch->interface->device_suspended(device, d); } @@ -2722,7 +2723,7 @@ evdev_device_get_size(const struct evdev_device *device, x = libevdev_get_abs_info(device->evdev, ABS_X); y = libevdev_get_abs_info(device->evdev, ABS_Y); - if (!x || !y || device->abs.fake_resolution || + if (!x || !y || device->abs.is_fake_resolution || !x->resolution || !y->resolution) return -1; @@ -2872,7 +2873,7 @@ evdev_notify_suspended_device(struct evdev_device *device) { struct libinput_device *it; - if (device->suspended) + if (device->is_suspended) return; list_for_each(it, &device->base.seat->devices_list, link) { @@ -2884,7 +2885,7 @@ evdev_notify_suspended_device(struct evdev_device *device) d->dispatch->interface->device_suspended(d, device); } - device->suspended = 1; + device->is_suspended = true; } void @@ -2892,7 +2893,7 @@ evdev_notify_resumed_device(struct evdev_device *device) { struct libinput_device *it; - if (!device->suspended) + if (!device->is_suspended) return; list_for_each(it, &device->base.seat->devices_list, link) { @@ -2904,7 +2905,7 @@ evdev_notify_resumed_device(struct evdev_device *device) d->dispatch->interface->device_resumed(d, device); } - device->suspended = 0; + device->is_suspended = false; } void diff --git a/src/evdev.h b/src/evdev.h index 778998e..51c9ae0 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -140,8 +140,8 @@ struct evdev_device { int fd; enum evdev_device_seat_capability seat_caps; enum evdev_device_tags tags; - int is_mt; - int suspended; + bool is_mt; + bool is_suspended; int dpi; /* HW resolution */ struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */ struct ratelimit nonpointer_rel_limit; /* ratelimit for REL_* events from non-pointer devices */ @@ -150,7 +150,7 @@ struct evdev_device { struct { const struct input_absinfo *absinfo_x, *absinfo_y; - int fake_resolution; + bool is_fake_resolution; struct device_coords point; int32_t seat_slot; -- cgit v1.2.3