2 * Copyright © 2014 Red Hat, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the copyright holders not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The copyright holders make
11 * no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 #ifndef EVDEV_MT_TOUCHPAD_H
25 #define EVDEV_MT_TOUCHPAD_H
32 #define TOUCHPAD_HISTORY_LENGTH 4
33 #define TOUCHPAD_MIN_SAMPLES 4
36 TOUCHPAD_EVENT_NONE = 0,
37 TOUCHPAD_EVENT_MOTION = (1 << 0),
38 TOUCHPAD_EVENT_BUTTON_PRESS = (1 << 1),
39 TOUCHPAD_EVENT_BUTTON_RELEASE = (1 << 2),
51 SCROLL_STATE_SCROLLING
60 TAP_STATE_TOUCH_2_HOLD,
62 TAP_STATE_TOUCH_3_HOLD,
63 TAP_STATE_DRAGGING_OR_DOUBLETAP,
65 TAP_STATE_DRAGGING_WAIT,
67 TAP_STATE_DEAD, /**< finger count exceeded */
76 enum touch_state state;
83 struct tp_motion samples[TOUCHPAD_HISTORY_LENGTH];
95 struct evdev_dispatch base;
96 struct evdev_device *device;
97 unsigned int nfingers_down; /* number of fingers down */
98 unsigned int slot; /* current slot */
100 unsigned int ntouches; /* number of slots */
101 struct tp_touch *touches; /* len == ntouches */
108 struct motion_filter *filter;
111 double constant_factor;
119 } buttons; /* physical buttons */
122 enum scroll_state state;
123 enum libinput_pointer_axis direction;
126 enum touchpad_event queued;
131 struct libinput_source *source;
132 unsigned int timeout;
133 enum tp_tap_state state;
137 #define tp_for_each_touch(_tp, _t) \
138 for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
141 tp_get_delta(struct tp_touch *t, double *dx, double *dy);
144 tp_tap_handle_state(struct tp_dispatch *tp, uint32_t time);
147 tp_tap_handle_timeout(struct tp_dispatch *tp, uint32_t time);
150 tp_init_tap(struct tp_dispatch *tp);