summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-01-07 13:04:58 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-01-20 15:38:12 +1000
commitc96d11e531bece3487eaff01be9709ace8dbad0f (patch)
treef68b24577fb45f2a36e6c2abbc272ed9e2e03e7b /src
parente510bef3f2566b82f0f7c1ad52d1ec4cb9768622 (diff)
touchpad: constify a couple of helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad-buttons.c27
-rw-r--r--src/evdev-mt-touchpad-edge-scroll.c5
-rw-r--r--src/evdev-mt-touchpad-gestures.c2
-rw-r--r--src/evdev-mt-touchpad-tap.c2
-rw-r--r--src/evdev-mt-touchpad.c4
-rw-r--r--src/evdev-mt-touchpad.h19
6 files changed, 36 insertions, 23 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 8822e08c..82c99c76 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -78,47 +78,54 @@ button_event_to_str(enum button_event event) {
}
static inline bool
-is_inside_bottom_button_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_bottom_button_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return t->point.y >= tp->buttons.bottom_area.top_edge;
}
static inline bool
-is_inside_bottom_right_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_bottom_right_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return is_inside_bottom_button_area(tp, t) &&
t->point.x > tp->buttons.bottom_area.rightbutton_left_edge;
}
static inline bool
-is_inside_bottom_left_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_bottom_left_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return is_inside_bottom_button_area(tp, t) &&
!is_inside_bottom_right_area(tp, t);
}
static inline bool
-is_inside_top_button_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_top_button_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return t->point.y <= tp->buttons.top_area.bottom_edge;
}
static inline bool
-is_inside_top_right_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_top_right_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return is_inside_top_button_area(tp, t) &&
t->point.x > tp->buttons.top_area.rightbutton_left_edge;
}
static inline bool
-is_inside_top_left_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_top_left_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return is_inside_top_button_area(tp, t) &&
t->point.x < tp->buttons.top_area.leftbutton_right_edge;
}
static inline bool
-is_inside_top_middle_area(struct tp_dispatch *tp, struct tp_touch *t)
+is_inside_top_middle_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return is_inside_top_button_area(tp, t) &&
t->point.x >= tp->buttons.top_area.leftbutton_right_edge &&
@@ -1042,13 +1049,15 @@ tp_post_button_events(struct tp_dispatch *tp, uint64_t time)
}
int
-tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
+tp_button_touch_active(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return t->button.state == BUTTON_STATE_AREA;
}
bool
-tp_button_is_inside_softbutton_area(struct tp_dispatch *tp, struct tp_touch *t)
+tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return is_inside_top_button_area(tp, t) ||
is_inside_bottom_button_area(tp, t);
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
index b572a9fb..fcc05121 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -73,7 +73,7 @@ edge_event_to_str(enum scroll_event event)
}
uint32_t
-tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t)
+tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t)
{
uint32_t edge = EDGE_NONE;
@@ -455,7 +455,8 @@ tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time)
}
int
-tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
+tp_edge_scroll_touch_active(const struct tp_dispatch *tp,
+ const struct tp_touch *t)
{
return t->scroll.edge_state == EDGE_SCROLL_TOUCH_STATE_AREA;
}
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index a7ef72f7..fc51c547 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -148,7 +148,7 @@ tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time)
}
static unsigned int
-tp_gesture_get_active_touches(struct tp_dispatch *tp,
+tp_gesture_get_active_touches(const struct tp_dispatch *tp,
struct tp_touch **touches,
unsigned int count)
{
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index dda528a8..a4c38a81 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -1022,7 +1022,7 @@ tp_tap_resume(struct tp_dispatch *tp, uint64_t time)
}
bool
-tp_tap_dragging(struct tp_dispatch *tp)
+tp_tap_dragging(const struct tp_dispatch *tp)
{
switch (tp->tap.state) {
case TAP_STATE_DRAGGING:
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index d78a54b0..b2461fd0 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -510,7 +510,7 @@ tp_pin_fingers(struct tp_dispatch *tp)
}
int
-tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
+tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t)
{
return (t->state == TOUCH_BEGIN || t->state == TOUCH_UPDATE) &&
t->palm.state == PALM_NONE &&
@@ -521,7 +521,7 @@ tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
}
bool
-tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t)
+tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t)
{
if (t->state != TOUCH_BEGIN)
return false;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 9cc11ac0..690feb55 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -358,7 +358,7 @@ struct tp_dispatch {
for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
static inline struct libinput*
-tp_libinput_context(struct tp_dispatch *tp)
+tp_libinput_context(const struct tp_dispatch *tp)
{
return tp->device->base.seat->libinput;
}
@@ -402,7 +402,7 @@ tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
uint64_t time);
int
-tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
+tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
int
tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
@@ -440,10 +440,12 @@ int
tp_button_handle_state(struct tp_dispatch *tp, uint64_t time);
int
-tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
+tp_button_touch_active(const struct tp_dispatch *tp,
+ const struct tp_touch *t);
bool
-tp_button_is_inside_softbutton_area(struct tp_dispatch *tp, struct tp_touch *t);
+tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp,
+ const struct tp_touch *t);
void
tp_release_all_taps(struct tp_dispatch *tp,
@@ -456,7 +458,7 @@ void
tp_tap_resume(struct tp_dispatch *tp, uint64_t time);
bool
-tp_tap_dragging(struct tp_dispatch *tp);
+tp_tap_dragging(const struct tp_dispatch *tp);
int
tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device);
@@ -474,10 +476,11 @@ void
tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time);
int
-tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
+tp_edge_scroll_touch_active(const struct tp_dispatch *tp,
+ const struct tp_touch *t);
uint32_t
-tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t);
+tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t);
int
tp_init_gesture(struct tp_dispatch *tp);
@@ -501,6 +504,6 @@ void
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time);
bool
-tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t);
+tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t);
#endif