1/*
2 * Copyright © 2014-2015 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef EVDEV_MT_TOUCHPAD_H
25#define EVDEV_MT_TOUCHPAD_H
26
27#include <stdbool.h>
28
29#include "evdev.h"
30#include "timer.h"
31
32#define TOUCHPAD_HISTORY_LENGTH 4
33#define TOUCHPAD_MIN_SAMPLES 4
34
35/* Convert mm to a distance normalized to DEFAULT_MOUSE_DPI */
36#define TP_MM_TO_DPI_NORMALIZED(mm) (DEFAULT_MOUSE_DPI/25.4 * mm)
37
38enum touchpad_event {
39	TOUCHPAD_EVENT_NONE		= 0,
40	TOUCHPAD_EVENT_MOTION		= bit(0),
41	TOUCHPAD_EVENT_BUTTON_PRESS	= bit(1),
42	TOUCHPAD_EVENT_BUTTON_RELEASE	= bit(2),
43	TOUCHPAD_EVENT_OTHERAXIS	= bit(3),
44	TOUCHPAD_EVENT_TIMESTAMP	= bit(4),
45};
46
47enum touch_state {
48	TOUCH_NONE = 0,
49	TOUCH_HOVERING = 1,
50	TOUCH_BEGIN = 2,
51	TOUCH_UPDATE = 3,
52	TOUCH_MAYBE_END = 4,
53	TOUCH_END = 5,
54};
55
56static inline const char *
57touch_state_to_str(enum touch_state state)
58{
59	switch(state) {
60	CASE_RETURN_STRING(TOUCH_NONE);
61	CASE_RETURN_STRING(TOUCH_HOVERING);
62	CASE_RETURN_STRING(TOUCH_BEGIN);
63	CASE_RETURN_STRING(TOUCH_UPDATE);
64	CASE_RETURN_STRING(TOUCH_MAYBE_END);
65	CASE_RETURN_STRING(TOUCH_END);
66	}
67	return NULL;
68}
69
70enum touch_palm_state {
71	PALM_NONE = 0,
72	PALM_EDGE,
73	PALM_TYPING,
74	PALM_TRACKPOINT,
75	PALM_TOOL_PALM,
76	PALM_PRESSURE,
77	PALM_TOUCH_SIZE,
78	PALM_ARBITRATION,
79};
80
81enum button_event {
82	BUTTON_EVENT_IN_BOTTOM_R = 30,
83	BUTTON_EVENT_IN_BOTTOM_M,
84	BUTTON_EVENT_IN_BOTTOM_L,
85	BUTTON_EVENT_IN_TOP_R,
86	BUTTON_EVENT_IN_TOP_M,
87	BUTTON_EVENT_IN_TOP_L,
88	BUTTON_EVENT_IN_AREA,
89	BUTTON_EVENT_UP,
90	BUTTON_EVENT_PRESS,
91	BUTTON_EVENT_RELEASE,
92	BUTTON_EVENT_TIMEOUT,
93};
94
95enum button_state {
96	BUTTON_STATE_NONE,
97	BUTTON_STATE_AREA,
98	BUTTON_STATE_BOTTOM,
99	BUTTON_STATE_TOP,
100	BUTTON_STATE_TOP_NEW,
101	BUTTON_STATE_TOP_TO_IGNORE,
102	BUTTON_STATE_IGNORE,
103};
104
105enum tp_tap_state {
106	TAP_STATE_IDLE = 4,
107	TAP_STATE_TOUCH,
108	TAP_STATE_HOLD,
109	TAP_STATE_1FGTAP_TAPPED,
110	TAP_STATE_2FGTAP_TAPPED,
111	TAP_STATE_3FGTAP_TAPPED,
112	TAP_STATE_TOUCH_2,
113	TAP_STATE_TOUCH_2_HOLD,
114	TAP_STATE_TOUCH_2_RELEASE,
115	TAP_STATE_TOUCH_3,
116	TAP_STATE_TOUCH_3_HOLD,
117	TAP_STATE_TOUCH_3_RELEASE,
118	TAP_STATE_TOUCH_3_RELEASE_2,
119	TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP,
120	TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP,
121	TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP,
122	TAP_STATE_1FGTAP_DRAGGING_OR_TAP,
123	TAP_STATE_2FGTAP_DRAGGING_OR_TAP,
124	TAP_STATE_3FGTAP_DRAGGING_OR_TAP,
125	TAP_STATE_1FGTAP_DRAGGING,
126	TAP_STATE_2FGTAP_DRAGGING,
127	TAP_STATE_3FGTAP_DRAGGING,
128	TAP_STATE_1FGTAP_DRAGGING_WAIT,
129	TAP_STATE_2FGTAP_DRAGGING_WAIT,
130	TAP_STATE_3FGTAP_DRAGGING_WAIT,
131	TAP_STATE_1FGTAP_DRAGGING_2,
132	TAP_STATE_2FGTAP_DRAGGING_2,
133	TAP_STATE_3FGTAP_DRAGGING_2,
134	TAP_STATE_DEAD, /**< finger count exceeded */
135};
136
137enum tp_tap_touch_state {
138	TAP_TOUCH_STATE_IDLE = 16,	/**< not in touch */
139	TAP_TOUCH_STATE_TOUCH,		/**< touching, may tap */
140	TAP_TOUCH_STATE_DEAD,		/**< exceeded motion/timeout */
141};
142
143/* For edge scrolling, so we only care about right and bottom */
144enum tp_edge {
145	EDGE_NONE	= 0,
146	EDGE_RIGHT	= bit(0),
147	EDGE_BOTTOM	= bit(1),
148};
149
150enum tp_edge_scroll_touch_state {
151	EDGE_SCROLL_TOUCH_STATE_NONE,
152	EDGE_SCROLL_TOUCH_STATE_EDGE_NEW,
153	EDGE_SCROLL_TOUCH_STATE_EDGE,
154	EDGE_SCROLL_TOUCH_STATE_AREA,
155};
156
157enum tp_gesture_state {
158	GESTURE_STATE_NONE,
159	GESTURE_STATE_UNKNOWN,
160	GESTURE_STATE_HOLD,
161	GESTURE_STATE_HOLD_AND_MOTION,
162	GESTURE_STATE_POINTER_MOTION,
163	GESTURE_STATE_SCROLL,
164	GESTURE_STATE_PINCH,
165	GESTURE_STATE_SWIPE,
166};
167
168enum tp_thumb_state {
169	THUMB_STATE_FINGER,
170	THUMB_STATE_JAILED,
171	THUMB_STATE_PINCH,
172	THUMB_STATE_SUPPRESSED,
173	THUMB_STATE_REVIVED,
174	THUMB_STATE_REVIVED_JAILED,
175	THUMB_STATE_DEAD,
176};
177
178enum tp_jump_state {
179	JUMP_STATE_IGNORE = 0,
180	JUMP_STATE_EXPECT_FIRST,
181	JUMP_STATE_EXPECT_DELAY,
182};
183
184struct tp_touch {
185	struct tp_dispatch *tp;
186	unsigned int index;
187	enum touch_state state;
188	bool has_ended;				/* TRACKING_ID == -1 */
189	bool dirty;
190	struct device_coords point;
191	uint64_t initial_time;
192	int pressure;
193	bool is_tool_palm; /* MT_TOOL_PALM */
194	int major, minor;
195
196	bool was_down; /* if distance == 0, false for pure hovering
197			  touches */
198
199	struct {
200		/* A quirk mostly used on Synaptics touchpads. In a
201		   transition to/from fake touches > num_slots, the current
202		   event data is likely garbage and the subsequent event
203		   is likely too. This marker tells us to reset the motion
204		   history again -> this effectively swallows any motion */
205		bool reset_motion_history;
206	} quirks;
207
208	struct {
209		struct tp_history_point {
210			uint64_t time;
211			struct device_coords point;
212		} samples[TOUCHPAD_HISTORY_LENGTH];
213		unsigned int index;
214		unsigned int count;
215	} history;
216
217	struct {
218		double last_delta_mm;
219	} jumps;
220
221	struct {
222		struct device_coords center;
223		uint8_t x_motion_history;
224	} hysteresis;
225
226	/* A pinned touchpoint is the one that pressed the physical button
227	 * on a clickpad. After the release, it won't move until the center
228	 * moves more than a threshold away from the original coordinates
229	 */
230	struct {
231		bool is_pinned;
232		struct device_coords center;
233	} pinned;
234
235	/* Software-button state and timeout if applicable */
236	struct {
237		enum button_state state;
238		/* We use button_event here so we can use == on events */
239		enum button_event current;
240		struct libinput_timer timer;
241		struct device_coords initial;
242		bool has_moved; /* has moved more than threshold */
243		uint64_t initial_time;
244	} button;
245
246	struct {
247		enum tp_tap_touch_state state;
248		struct device_coords initial;
249		bool is_thumb;
250		bool is_palm;
251	} tap;
252
253	struct {
254		enum tp_edge_scroll_touch_state edge_state;
255		uint32_t edge;
256		int direction;
257		struct libinput_timer timer;
258		struct device_coords initial;
259	} scroll;
260
261	struct {
262		enum touch_palm_state state;
263		struct device_coords first; /* first coordinates if is_palm == true */
264		uint64_t time; /* first timestamp if is_palm == true */
265	} palm;
266
267	struct {
268		struct device_coords initial;
269	} gesture;
270
271	struct {
272		double last_speed; /* speed in mm/s at last sample */
273		unsigned int exceeded_count;
274	} speed;
275};
276
277enum suspend_trigger {
278	SUSPEND_NO_FLAG         = 0x0,
279	SUSPEND_EXTERNAL_MOUSE  = 0x1,
280	SUSPEND_SENDEVENTS      = 0x2,
281	SUSPEND_LID             = 0x4,
282	SUSPEND_TABLET_MODE     = 0x8,
283};
284
285struct tp_dispatch {
286	struct evdev_dispatch base;
287	struct evdev_device *device;
288	unsigned int nfingers_down;		/* number of fingers down */
289	unsigned int old_nfingers_down;		/* previous no fingers down */
290	unsigned int slot;			/* current slot */
291	bool has_mt;
292	bool semi_mt;
293
294	uint32_t suspend_reason;
295
296	/* pen/touch arbitration */
297	struct {
298		enum evdev_arbitration_state state;
299		struct libinput_timer arbitration_timer;
300	} arbitration;
301
302	unsigned int nactive_slots;		/* number of active slots */
303	unsigned int num_slots;			/* number of slots */
304	unsigned int ntouches;			/* no slots inc. fakes */
305	struct tp_touch *touches;		/* len == ntouches */
306	/* bit 0: BTN_TOUCH
307	 * bit 1: BTN_TOOL_FINGER
308	 * bit 2: BTN_TOOL_DOUBLETAP
309	 * ...
310	 */
311	unsigned int fake_touches;
312
313	struct {
314		bool detection_disabled;
315		struct ratelimit warning;
316	} jump;
317
318	/* if pressure goes above high -> touch down,
319	   if pressure then goes below low -> touch up */
320	struct {
321		bool use_pressure;
322		int high;
323		int low;
324	} pressure;
325
326	/* If touch size (either axis) goes above high -> touch down,
327	   if touch size (either axis) goes below low -> touch up */
328	struct  {
329		bool use_touch_size;
330		int high;
331		int low;
332
333		/* convert device units to angle */
334		double orientation_to_angle;
335	} touch_size;
336
337	struct {
338		bool enabled;
339		struct device_coords margin;
340		unsigned int other_event_count;
341		uint64_t last_motion_time;
342	} hysteresis;
343
344	struct {
345		double x_scale_coeff;
346		double y_scale_coeff;
347		double xy_scale_coeff;
348	} accel;
349
350	struct {
351		struct libinput_device_config_gesture config;
352		bool enabled;
353		bool started;
354		unsigned int finger_count;
355		unsigned int finger_count_pending;
356		struct libinput_timer finger_count_switch_timer;
357		enum tp_gesture_state state;
358		struct tp_touch *touches[2];
359		uint64_t initial_time;
360		double initial_distance;
361		double prev_scale;
362		double angle;
363		struct device_float_coords center;
364		struct libinput_timer hold_timer;
365		bool hold_enabled;
366	} gesture;
367
368	struct {
369		bool is_clickpad;		/* true for clickpads */
370		bool has_topbuttons;
371		bool use_clickfinger;		/* number of fingers decides button number */
372		bool click_pending;
373		uint32_t state;
374		uint32_t old_state;
375		struct {
376			double x_scale_coeff;
377			double y_scale_coeff;
378		} motion_dist;			/* for pinned touches */
379		unsigned int active;		/* currently active button, for release event */
380		bool active_is_topbutton;	/* is active a top button? */
381
382		/* Only used for clickpads. The software button areas are
383		 * always 2 horizontal stripes across the touchpad.
384		 * The buttons are split according to the edge settings.
385		 */
386		struct {
387			int32_t top_edge;	/* in device coordinates */
388			int32_t rightbutton_left_edge; /* in device coordinates */
389			int32_t middlebutton_left_edge; /* in device coordinates */
390		} bottom_area;
391
392		struct {
393			int32_t bottom_edge;	/* in device coordinates */
394			int32_t rightbutton_left_edge; /* in device coordinates */
395			int32_t leftbutton_right_edge; /* in device coordinates */
396		} top_area;
397
398		struct evdev_device *trackpoint;
399
400		enum libinput_config_click_method click_method;
401		struct libinput_device_config_click_method config_method;
402	} buttons;
403
404	struct {
405		struct libinput_device_config_scroll_method config_method;
406		enum libinput_config_scroll_method method;
407		int32_t right_edge;		/* in device coordinates */
408		int32_t bottom_edge;		/* in device coordinates */
409		struct {
410			bool h, v;
411		} active;
412		struct phys_coords vector;
413		uint64_t time_prev;
414		struct {
415			uint64_t h, v;
416		} duration;
417	} scroll;
418
419	enum touchpad_event queued;
420
421	struct {
422		struct libinput_device_config_tap config;
423		bool enabled;
424		bool suspended;
425		struct libinput_timer timer;
426		enum tp_tap_state state;
427		uint32_t buttons_pressed;
428		uint64_t saved_press_time,
429			 saved_release_time;
430
431		enum libinput_config_tap_button_map map;
432		enum libinput_config_tap_button_map want_map;
433
434		bool drag_enabled;
435		bool drag_lock_enabled;
436
437		unsigned int nfingers_down;	/* number of fingers down for tapping (excl. thumb/palm) */
438	} tap;
439
440	struct {
441		struct libinput_device_config_dwtp config;
442		bool dwtp_enabled;
443
444		int32_t right_edge;		/* in device coordinates */
445		int32_t left_edge;		/* in device coordinates */
446		int32_t upper_edge;		/* in device coordinates */
447
448		bool trackpoint_active;
449		struct libinput_event_listener trackpoint_listener;
450		struct libinput_timer trackpoint_timer;
451		uint64_t trackpoint_last_event_time;
452		uint32_t trackpoint_event_count;
453		bool monitor_trackpoint;
454
455		bool use_mt_tool;
456
457		bool use_pressure;
458		int pressure_threshold;
459
460		bool use_size;
461		int size_threshold;
462	} palm;
463
464	struct {
465		struct libinput_device_config_send_events config;
466		enum libinput_config_send_events_mode current_mode;
467	} sendevents;
468
469	struct {
470		struct libinput_device_config_dwt config;
471		bool dwt_enabled;
472
473		/* We have to allow for more than one device node to be the
474		 * internal dwt keyboard (Razer Blade). But they're the same
475		 * physical device, so we don't care about per-keyboard
476		 * key/modifier masks.
477		 */
478		struct list paired_keyboard_list;
479
480		unsigned long key_mask[NLONGS(KEY_CNT)];
481		unsigned long mod_mask[NLONGS(KEY_CNT)];
482		bool keyboard_active;
483		struct libinput_timer keyboard_timer;
484		uint64_t keyboard_last_press_time;
485	} dwt;
486
487	struct {
488		bool detect_thumbs;
489		int upper_thumb_line;
490		int lower_thumb_line;
491
492		bool use_pressure;
493		int pressure_threshold;
494
495		bool use_size;
496		int size_threshold;
497
498		enum tp_thumb_state state;
499		unsigned int index;
500		bool pinch_eligible;
501	} thumb;
502
503	struct {
504		/* A quirk used on the T450 series Synaptics hardware.
505		 * Slowly moving the finger causes multiple events with only
506		 * ABS_MT_PRESSURE but no x/y information. When the x/y
507		 * event comes, it will be a jump of ~20 units. We use the
508		 * below to count non-motion events to discard that first
509		 * event with the jump.
510		 */
511		unsigned int nonmotion_event_count;
512
513		struct msc_timestamp {
514			enum tp_jump_state state;
515			uint32_t interval;
516			uint32_t now;
517		} msc_timestamp;
518	} quirks;
519
520	struct {
521		struct libinput_event_listener listener;
522		struct evdev_device *lid_switch;
523	} lid_switch;
524
525	struct {
526		struct libinput_event_listener listener;
527		struct evdev_device *tablet_mode_switch;
528	} tablet_mode_switch;
529
530	struct {
531		bool rotate;
532		bool want_rotate;
533
534		bool must_rotate; /* true if we should rotate when applicable */
535		struct evdev_device *tablet_device;
536		bool tablet_left_handed_state;
537	} left_handed;
538};
539
540static inline struct tp_dispatch*
541tp_dispatch(struct evdev_dispatch *dispatch)
542{
543	evdev_verify_dispatch_type(dispatch, DISPATCH_TOUCHPAD);
544
545	return container_of(dispatch, struct tp_dispatch, base);
546}
547
548#define tp_for_each_touch(_tp, _t) \
549	for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
550
551static inline struct libinput*
552tp_libinput_context(const struct tp_dispatch *tp)
553{
554	return evdev_libinput_context(tp->device);
555}
556
557static inline struct normalized_coords
558tp_normalize_delta(const struct tp_dispatch *tp,
559		   struct device_float_coords delta)
560{
561	struct normalized_coords normalized;
562
563	normalized.x = delta.x * tp->accel.x_scale_coeff;
564	normalized.y = delta.y * tp->accel.y_scale_coeff;
565
566	return normalized;
567}
568
569static inline struct phys_coords
570tp_phys_delta(const struct tp_dispatch *tp,
571	      struct device_float_coords delta)
572{
573	struct phys_coords mm;
574
575	mm.x = delta.x / tp->device->abs.absinfo_x->resolution;
576	mm.y = delta.y / tp->device->abs.absinfo_y->resolution;
577
578	return mm;
579}
580
581/**
582 * Takes a set of device coordinates, returns that set of coordinates in the
583 * x-axis' resolution.
584 */
585static inline struct device_float_coords
586tp_scale_to_xaxis(const struct tp_dispatch *tp,
587		  struct device_float_coords delta)
588{
589	struct device_float_coords raw;
590
591	raw.x = delta.x;
592	raw.y = delta.y * tp->accel.xy_scale_coeff;
593
594	return raw;
595}
596
597struct device_coords
598tp_get_delta(struct tp_touch *t);
599
600struct normalized_coords
601tp_filter_motion(struct tp_dispatch *tp,
602		 const struct device_float_coords *unaccelerated,
603		 uint64_t time);
604
605struct normalized_coords
606tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
607			       const struct device_float_coords *unaccelerated,
608			       uint64_t time);
609
610struct normalized_coords
611tp_filter_scroll(struct tp_dispatch *tp,
612		 const struct device_float_coords *unaccelerated,
613		 uint64_t time);
614
615bool
616tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
617
618bool
619tp_touch_active_for_gesture(const struct tp_dispatch *tp,
620			    const struct tp_touch *t);
621
622int
623tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
624
625void
626tp_tap_post_process_state(struct tp_dispatch *tp);
627
628void
629tp_init_tap(struct tp_dispatch *tp);
630
631void
632tp_remove_tap(struct tp_dispatch *tp);
633
634void
635tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device);
636
637void
638tp_init_top_softbuttons(struct tp_dispatch *tp,
639			struct evdev_device *device,
640			double topbutton_size_mult);
641
642void
643tp_remove_buttons(struct tp_dispatch *tp);
644
645void
646tp_process_button(struct tp_dispatch *tp,
647		  const struct input_event *e,
648		  uint64_t time);
649
650void
651tp_release_all_buttons(struct tp_dispatch *tp,
652		       uint64_t time);
653
654int
655tp_post_button_events(struct tp_dispatch *tp, uint64_t time);
656
657void
658tp_button_handle_state(struct tp_dispatch *tp, uint64_t time);
659
660bool
661tp_button_touch_active(const struct tp_dispatch *tp,
662		       const struct tp_touch *t);
663
664bool
665tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp,
666				    const struct tp_touch *t);
667
668void
669tp_release_all_taps(struct tp_dispatch *tp,
670		    uint64_t now);
671
672void
673tp_tap_suspend(struct tp_dispatch *tp, uint64_t time);
674
675void
676tp_tap_resume(struct tp_dispatch *tp, uint64_t time);
677
678bool
679tp_tap_dragging(const struct tp_dispatch *tp);
680
681bool
682tp_tap_dragging_or_double_tapping(const struct tp_dispatch *tp);
683
684void
685tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device);
686
687void
688tp_remove_edge_scroll(struct tp_dispatch *tp);
689
690void
691tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time);
692
693int
694tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time);
695
696void
697tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time);
698
699int
700tp_edge_scroll_touch_active(const struct tp_dispatch *tp,
701			    const struct tp_touch *t);
702
703uint32_t
704tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t);
705
706void
707tp_init_gesture(struct tp_dispatch *tp);
708
709void
710tp_remove_gesture(struct tp_dispatch *tp);
711
712void
713tp_gesture_stop(struct tp_dispatch *tp, uint64_t time);
714
715void
716tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time);
717
718void
719tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, uint64_t time);
720
721void
722tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time);
723
724void
725tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time,
726		       bool ignore_motion);
727
728void
729tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time);
730
731void
732tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time);
733
734void
735tp_clickpad_middlebutton_apply_config(struct evdev_device *device);
736
737bool
738tp_thumb_ignored(const struct tp_dispatch *tp, const struct tp_touch *t);
739
740void
741tp_thumb_reset(struct tp_dispatch *tp);
742
743bool
744tp_thumb_ignored_for_gesture(const struct tp_dispatch *tp, const struct tp_touch *t);
745
746bool
747tp_thumb_ignored_for_tap(const struct tp_dispatch *tp,
748			 const struct tp_touch *t);
749
750void
751tp_thumb_suppress(struct tp_dispatch *tp, struct tp_touch *t);
752
753void
754tp_thumb_update_touch(struct tp_dispatch *tp,
755		      struct tp_touch *t,
756		      uint64_t time);
757
758void
759tp_detect_thumb_while_moving(struct tp_dispatch *tp);
760
761void
762tp_thumb_update_multifinger(struct tp_dispatch *tp);
763
764void
765tp_init_thumb(struct tp_dispatch *tp);
766
767struct tp_touch*
768tp_thumb_get_touch(struct tp_dispatch *tp);
769
770#endif
771