[PATCH libinput 1/2] evdev-mt-touchpad-buttons: Rename some variables and functions

Hans de Goede hdegoede at redhat.com
Wed May 28 06:19:55 PDT 2014


Rename some clickpad softbutton area variables to have bottom in their
name, this is a preperation patch for adding top softbutton area support.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/evdev-mt-touchpad-buttons.c | 26 +++++++++++++-------------
 src/evdev-mt-touchpad.h         |  2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 65fa21b..b4d3920 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -75,23 +75,23 @@ button_event_to_str(enum button_event event) {
 }
 
 static inline bool
-is_inside_button_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_bottom_button_area(struct tp_dispatch *tp, struct tp_touch *t)
 {
-	return t->y >= tp->buttons.area.top_edge;
+	return t->y >= tp->buttons.bottom_area.top_edge;
 }
 
 static inline bool
-is_inside_right_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_bottom_right_area(struct tp_dispatch *tp, struct tp_touch *t)
 {
-	return is_inside_button_area(tp, t) &&
-	       t->x > tp->buttons.area.rightbutton_left_edge;
+	return is_inside_bottom_button_area(tp, t) &&
+	       t->x > tp->buttons.bottom_area.rightbutton_left_edge;
 }
 
 static inline bool
-is_inside_left_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_bottom_left_area(struct tp_dispatch *tp, struct tp_touch *t)
 {
-	return is_inside_button_area(tp, t) &&
-	       !is_inside_right_area(tp, t);
+	return is_inside_bottom_button_area(tp, t) &&
+	       !is_inside_bottom_right_area(tp, t);
 }
 
 static void
@@ -327,9 +327,9 @@ tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
 		if (t->state == TOUCH_END) {
 			tp_button_handle_event(tp, t, BUTTON_EVENT_UP, time);
 		} else if (t->dirty) {
-			if (is_inside_right_area(tp, t))
+			if (is_inside_bottom_right_area(tp, t))
 				tp_button_handle_event(tp, t, BUTTON_EVENT_IN_BOTTOM_R, time);
-			else if (is_inside_left_area(tp, t))
+			else if (is_inside_bottom_left_area(tp, t))
 				tp_button_handle_event(tp, t, BUTTON_EVENT_IN_BOTTOM_L, time);
 			else
 				tp_button_handle_event(tp, t, BUTTON_EVENT_IN_AREA, time);
@@ -432,8 +432,8 @@ tp_init_buttons(struct tp_dispatch *tp,
 		tp->buttons.use_clickfinger = true;
 
 	if (tp->buttons.is_clickpad && !tp->buttons.use_clickfinger) {
-		tp->buttons.area.top_edge = height * .8 + device->abs.min_y;
-		tp->buttons.area.rightbutton_left_edge = width/2 + device->abs.min_x;
+		tp->buttons.bottom_area.top_edge = height * .8 + device->abs.min_y;
+		tp->buttons.bottom_area.rightbutton_left_edge = width/2 + device->abs.min_x;
 		tp->buttons.timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
 
 		if (tp->buttons.timer_fd == -1)
@@ -447,7 +447,7 @@ tp_init_buttons(struct tp_dispatch *tp,
 		if (tp->buttons.source == NULL)
 			return -1;
 	} else {
-		tp->buttons.area.top_edge = INT_MAX;
+		tp->buttons.bottom_area.top_edge = INT_MAX;
 	}
 
 	return 0;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 41e3ca4..62abe59 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -170,7 +170,7 @@ struct tp_dispatch {
 		struct {
 			int32_t top_edge;
 			int32_t rightbutton_left_edge;
-		} area;
+		} bottom_area;
 
 		unsigned int timeout;		/* current timeout in ms */
 
-- 
1.9.3



More information about the wayland-devel mailing list