[PATCH libinput 2/2] touchpad: rename real_touches to num_slots

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 8 22:27:34 PDT 2015


Less ambiguous since real_touches can be interpreted to "current number of
real touches as opposed to fake touches". Which it isn't, this variable holds
the number of slots.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-gestures.c |  2 +-
 src/evdev-mt-touchpad.c          | 10 +++++-----
 src/evdev-mt-touchpad.h          |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 7dbf4c4..e01b921 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -39,7 +39,7 @@ tp_get_touches_delta(struct tp_dispatch *tp, bool average)
 	struct normalized_coords normalized;
 	struct normalized_coords delta = {0.0, 0.0};
 
-	for (i = 0; i < tp->real_touches; i++) {
+	for (i = 0; i < tp->num_slots; i++) {
 		t = &tp->touches[i];
 
 		if (tp_touch_active(tp, t) && t->dirty) {
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 0627056..68070c2 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -343,7 +343,7 @@ tp_process_fake_touches(struct tp_dispatch *tp,
 	if (nfake_touches == FAKE_FINGER_OVERFLOW)
 		return;
 
-	start = tp->has_mt ? tp->real_touches : 0;
+	start = tp->has_mt ? tp->num_slots : 0;
 	for (i = start; i < tp->ntouches; i++) {
 		t = tp_get_touch(tp, i);
 		if (i < nfake_touches)
@@ -577,7 +577,7 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
 		if (tp->semi_mt && tp->nfingers_down != tp->old_nfingers_down)
 			tp_motion_history_reset(t);
 
-		if (i >= tp->real_touches && t->state != TOUCH_NONE) {
+		if (i >= tp->num_slots && t->state != TOUCH_NONE) {
 			t->point = first->point;
 			if (!t->dirty)
 				t->dirty = first->dirty;
@@ -938,11 +938,11 @@ tp_init_slots(struct tp_dispatch *tp,
 
 	absinfo = libevdev_get_abs_info(device->evdev, ABS_MT_SLOT);
 	if (absinfo) {
-		tp->real_touches = absinfo->maximum + 1;
+		tp->num_slots = absinfo->maximum + 1;
 		tp->slot = absinfo->value;
 		tp->has_mt = true;
 	} else {
-		tp->real_touches = 1;
+		tp->num_slots = 1;
 		tp->slot = 0;
 		tp->has_mt = false;
 	}
@@ -958,7 +958,7 @@ tp_init_slots(struct tp_dispatch *tp,
 		}
 	}
 
-	tp->ntouches = max(tp->real_touches, n_btn_tool_touches);
+	tp->ntouches = max(tp->num_slots, n_btn_tool_touches);
 	tp->touches = calloc(tp->ntouches, sizeof(struct tp_touch));
 	if (!tp->touches)
 		return -1;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index b88dadd..6ab0981 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -183,7 +183,7 @@ struct tp_dispatch {
 	bool semi_mt;
 	enum touchpad_model model;
 
-	unsigned int real_touches;		/* number of slots */
+	unsigned int num_slots;			/* number of slots */
 	unsigned int ntouches;			/* no slots inc. fakes */
 	struct tp_touch *touches;		/* len == ntouches */
 	/* bit 0: BTN_TOUCH
-- 
2.3.4



More information about the wayland-devel mailing list