evdev: switch three ints to booleans

And a minor rename to make it more obvious

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2016-07-04 15:41:37 +10:00
parent 4b94fc6273
commit 5af236a022
4 changed files with 16 additions and 15 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;