touchpad: Rename some variables and functions
authorHans de Goede <hdegoede@redhat.com>
Tue, 27 May 2014 13:17:26 +0000 (15:17 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 2 Jun 2014 04:01:14 +0000 (14:01 +1000)
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@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad-buttons.c
src/evdev-mt-touchpad.h

index a3220c5b6e19359135bf581eabd0b5f183c5795c..fa6d4a797c11cc8a2221cf6eb1637bcf1c3e2292 100644 (file)
@@ -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;
index 653914957406bdfa21af5657c3fb294a73954934..bcb84dc4294e4fe4b362b39fceb3c6fa52f74e48 100644 (file)
@@ -173,7 +173,7 @@ struct tp_dispatch {
                struct {
                        int32_t top_edge;
                        int32_t rightbutton_left_edge;
-               } area;
+               } bottom_area;
 
                unsigned int timeout;           /* current timeout in ms */