mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-09 08:20:30 +01:00
touchpad: constify a couple of helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
e510bef3f2
commit
c96d11e531
6 changed files with 36 additions and 23 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue