[PATCH libinput 11/14] evdev: switch three ints to booleans

Peter Hutterer peter.hutterer at who-t.net
Thu Jul 21 00:31:59 UTC 2016


And a minor rename to make it more obvious

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 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 263bb80..ff8ce39 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -1057,7 +1057,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 777914e..fa398e2 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;
 	}
@@ -2114,7 +2114,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
@@ -2138,7 +2138,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 39eef9e..44b0be5 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 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 7bc09d2..c56c76f 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;
-- 
2.7.4



More information about the wayland-devel mailing list