2014-02-07 13:39:27 +10:00
|
|
|
/*
|
2015-05-28 08:23:59 +10:00
|
|
|
* Copyright © 2014-2015 Red Hat, Inc.
|
2014-02-07 13:39:27 +10:00
|
|
|
*
|
2015-06-11 12:09:18 +10:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2014-02-07 13:39:27 +10:00
|
|
|
*
|
2015-06-11 12:09:18 +10:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2014-02-07 13:39:27 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef EVDEV_MT_TOUCHPAD_H
|
|
|
|
|
#define EVDEV_MT_TOUCHPAD_H
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
#include "evdev.h"
|
|
|
|
|
#include "filter.h"
|
2014-06-06 17:01:06 +02:00
|
|
|
#include "timer.h"
|
2014-02-07 13:39:27 +10:00
|
|
|
|
|
|
|
|
#define TOUCHPAD_HISTORY_LENGTH 4
|
2014-02-10 07:44:59 +10:00
|
|
|
#define TOUCHPAD_MIN_SAMPLES 4
|
2014-02-07 13:39:27 +10:00
|
|
|
|
2015-03-06 14:18:59 +10:00
|
|
|
/* Convert mm to a distance normalized to DEFAULT_MOUSE_DPI */
|
2015-03-13 13:56:14 +10:00
|
|
|
#define TP_MM_TO_DPI_NORMALIZED(mm) (DEFAULT_MOUSE_DPI/25.4 * mm)
|
2015-03-06 14:18:59 +10:00
|
|
|
|
2014-02-07 13:48:06 +10:00
|
|
|
enum touchpad_event {
|
|
|
|
|
TOUCHPAD_EVENT_NONE = 0,
|
|
|
|
|
TOUCHPAD_EVENT_MOTION = (1 << 0),
|
|
|
|
|
TOUCHPAD_EVENT_BUTTON_PRESS = (1 << 1),
|
|
|
|
|
TOUCHPAD_EVENT_BUTTON_RELEASE = (1 << 2),
|
2016-03-07 16:05:25 +10:00
|
|
|
TOUCHPAD_EVENT_OTHERAXIS = (1 << 3),
|
2014-02-07 13:48:06 +10:00
|
|
|
};
|
|
|
|
|
|
2014-11-24 12:16:05 +01:00
|
|
|
enum touchpad_model {
|
|
|
|
|
MODEL_UNKNOWN = 0,
|
|
|
|
|
MODEL_SYNAPTICS,
|
|
|
|
|
MODEL_ALPS,
|
|
|
|
|
MODEL_APPLETOUCH,
|
|
|
|
|
MODEL_ELANTECH,
|
|
|
|
|
MODEL_UNIBODY_MACBOOK
|
|
|
|
|
};
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
enum touch_state {
|
|
|
|
|
TOUCH_NONE = 0,
|
2014-12-11 16:39:04 +10:00
|
|
|
TOUCH_HOVERING,
|
2014-02-07 13:39:27 +10:00
|
|
|
TOUCH_BEGIN,
|
|
|
|
|
TOUCH_UPDATE,
|
|
|
|
|
TOUCH_END
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-20 16:09:31 +10:00
|
|
|
enum touch_palm_state {
|
|
|
|
|
PALM_NONE = 0,
|
|
|
|
|
PALM_EDGE,
|
2015-04-20 15:51:20 +10:00
|
|
|
PALM_TYPING,
|
2015-06-23 15:36:05 +10:00
|
|
|
PALM_TRACKPOINT,
|
2015-04-20 16:09:31 +10:00
|
|
|
};
|
|
|
|
|
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
enum button_event {
|
2014-06-02 13:44:59 +10:00
|
|
|
BUTTON_EVENT_IN_BOTTOM_R = 30,
|
2016-04-04 10:06:36 +10:00
|
|
|
BUTTON_EVENT_IN_BOTTOM_M,
|
2014-06-02 13:44:59 +10:00
|
|
|
BUTTON_EVENT_IN_BOTTOM_L,
|
|
|
|
|
BUTTON_EVENT_IN_TOP_R,
|
|
|
|
|
BUTTON_EVENT_IN_TOP_M,
|
|
|
|
|
BUTTON_EVENT_IN_TOP_L,
|
|
|
|
|
BUTTON_EVENT_IN_AREA,
|
|
|
|
|
BUTTON_EVENT_UP,
|
|
|
|
|
BUTTON_EVENT_PRESS,
|
|
|
|
|
BUTTON_EVENT_RELEASE,
|
|
|
|
|
BUTTON_EVENT_TIMEOUT,
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum button_state {
|
2014-06-02 13:44:59 +10:00
|
|
|
BUTTON_STATE_NONE,
|
|
|
|
|
BUTTON_STATE_AREA,
|
|
|
|
|
BUTTON_STATE_BOTTOM,
|
|
|
|
|
BUTTON_STATE_TOP,
|
|
|
|
|
BUTTON_STATE_TOP_NEW,
|
|
|
|
|
BUTTON_STATE_TOP_TO_IGNORE,
|
|
|
|
|
BUTTON_STATE_IGNORE,
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
};
|
|
|
|
|
|
2014-02-07 15:18:17 +10:00
|
|
|
enum tp_tap_state {
|
|
|
|
|
TAP_STATE_IDLE = 4,
|
|
|
|
|
TAP_STATE_TOUCH,
|
|
|
|
|
TAP_STATE_HOLD,
|
|
|
|
|
TAP_STATE_TAPPED,
|
|
|
|
|
TAP_STATE_TOUCH_2,
|
|
|
|
|
TAP_STATE_TOUCH_2_HOLD,
|
2015-08-31 11:10:58 +10:00
|
|
|
TAP_STATE_TOUCH_2_RELEASE,
|
2014-02-07 15:18:17 +10:00
|
|
|
TAP_STATE_TOUCH_3,
|
|
|
|
|
TAP_STATE_TOUCH_3_HOLD,
|
|
|
|
|
TAP_STATE_DRAGGING_OR_DOUBLETAP,
|
2015-04-30 00:13:51 +02:00
|
|
|
TAP_STATE_DRAGGING_OR_TAP,
|
2014-02-07 15:18:17 +10:00
|
|
|
TAP_STATE_DRAGGING,
|
|
|
|
|
TAP_STATE_DRAGGING_WAIT,
|
|
|
|
|
TAP_STATE_DRAGGING_2,
|
2015-04-16 10:19:11 +10:00
|
|
|
TAP_STATE_MULTITAP,
|
|
|
|
|
TAP_STATE_MULTITAP_DOWN,
|
2014-02-07 15:18:17 +10:00
|
|
|
TAP_STATE_DEAD, /**< finger count exceeded */
|
|
|
|
|
};
|
|
|
|
|
|
2014-06-20 14:16:13 +10:00
|
|
|
enum tp_tap_touch_state {
|
|
|
|
|
TAP_TOUCH_STATE_IDLE = 16, /**< not in touch */
|
|
|
|
|
TAP_TOUCH_STATE_TOUCH, /**< touching, may tap */
|
|
|
|
|
TAP_TOUCH_STATE_DEAD, /**< exceeded motion/timeout */
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-24 12:16:06 +01:00
|
|
|
/* For edge scrolling, so we only care about right and bottom */
|
|
|
|
|
enum tp_edge {
|
|
|
|
|
EDGE_NONE = 0,
|
|
|
|
|
EDGE_RIGHT = (1 << 0),
|
|
|
|
|
EDGE_BOTTOM = (1 << 1),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum tp_edge_scroll_touch_state {
|
|
|
|
|
EDGE_SCROLL_TOUCH_STATE_NONE,
|
|
|
|
|
EDGE_SCROLL_TOUCH_STATE_EDGE_NEW,
|
|
|
|
|
EDGE_SCROLL_TOUCH_STATE_EDGE,
|
|
|
|
|
EDGE_SCROLL_TOUCH_STATE_AREA,
|
|
|
|
|
};
|
|
|
|
|
|
2016-01-07 11:40:42 +10:00
|
|
|
enum tp_gesture_state {
|
|
|
|
|
GESTURE_STATE_NONE,
|
|
|
|
|
GESTURE_STATE_UNKNOWN,
|
|
|
|
|
GESTURE_STATE_SCROLL,
|
|
|
|
|
GESTURE_STATE_PINCH,
|
2016-01-07 11:37:20 +10:00
|
|
|
GESTURE_STATE_SWIPE,
|
2015-03-05 12:44:13 +01:00
|
|
|
};
|
|
|
|
|
|
2015-07-17 11:17:22 +10:00
|
|
|
enum tp_thumb_state {
|
|
|
|
|
THUMB_STATE_NO,
|
|
|
|
|
THUMB_STATE_YES,
|
|
|
|
|
THUMB_STATE_MAYBE,
|
|
|
|
|
};
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
struct tp_touch {
|
2014-06-06 17:01:06 +02:00
|
|
|
struct tp_dispatch *tp;
|
2014-02-07 13:39:27 +10:00
|
|
|
enum touch_state state;
|
2014-12-11 16:39:04 +10:00
|
|
|
bool has_ended; /* TRACKING_ID == -1 */
|
2014-02-07 13:39:27 +10:00
|
|
|
bool dirty;
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords point;
|
2014-04-08 12:29:45 +02:00
|
|
|
uint64_t millis;
|
2015-05-06 19:41:25 -04:00
|
|
|
int distance; /* distance == 0 means touch */
|
2015-05-27 18:25:49 +10:00
|
|
|
int pressure;
|
2014-02-07 13:39:27 +10:00
|
|
|
|
2015-07-20 13:10:29 +10:00
|
|
|
struct {
|
|
|
|
|
/* A quirk mostly used on Synaptics touchpads. In a
|
|
|
|
|
transition to/from fake touches > num_slots, the current
|
|
|
|
|
event data is likely garbage and the subsequent event
|
|
|
|
|
is likely too. This marker tells us to reset the motion
|
|
|
|
|
history again -> this effectively swallows any motion */
|
|
|
|
|
bool reset_motion_history;
|
|
|
|
|
} quirks;
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
struct {
|
2015-03-11 09:10:13 +10:00
|
|
|
struct device_coords samples[TOUCHPAD_HISTORY_LENGTH];
|
2014-02-07 13:39:27 +10:00
|
|
|
unsigned int index;
|
|
|
|
|
unsigned int count;
|
|
|
|
|
} history;
|
|
|
|
|
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords hysteresis_center;
|
2014-04-15 14:27:59 +02:00
|
|
|
|
|
|
|
|
/* A pinned touchpoint is the one that pressed the physical button
|
|
|
|
|
* on a clickpad. After the release, it won't move until the center
|
|
|
|
|
* moves more than a threshold away from the original coordinates
|
|
|
|
|
*/
|
|
|
|
|
struct {
|
|
|
|
|
bool is_pinned;
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords center;
|
2014-04-15 14:27:59 +02:00
|
|
|
} pinned;
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
|
|
|
|
|
/* Software-button state and timeout if applicable */
|
|
|
|
|
struct {
|
|
|
|
|
enum button_state state;
|
|
|
|
|
/* We use button_event here so we can use == on events */
|
|
|
|
|
enum button_event curr;
|
2014-06-06 17:01:06 +02:00
|
|
|
struct libinput_timer timer;
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
} button;
|
2014-06-20 14:16:13 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
enum tp_tap_touch_state state;
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords initial;
|
2015-05-27 18:25:49 +10:00
|
|
|
bool is_thumb;
|
2014-06-20 14:16:13 +10:00
|
|
|
} tap;
|
2014-07-14 16:06:51 +10:00
|
|
|
|
2014-11-24 12:16:06 +01:00
|
|
|
struct {
|
2014-12-18 10:21:48 +10:00
|
|
|
enum tp_edge_scroll_touch_state edge_state;
|
2014-11-24 12:16:06 +01:00
|
|
|
uint32_t edge;
|
|
|
|
|
int direction;
|
|
|
|
|
struct libinput_timer timer;
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords initial;
|
2014-11-24 12:16:06 +01:00
|
|
|
} scroll;
|
|
|
|
|
|
2014-07-14 16:06:51 +10:00
|
|
|
struct {
|
2015-04-20 16:09:31 +10:00
|
|
|
enum touch_palm_state state;
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords first; /* first coordinates if is_palm == true */
|
2015-07-27 11:52:44 +08:00
|
|
|
uint64_t time; /* first timestamp if is_palm == true */
|
2014-07-14 16:06:51 +10:00
|
|
|
} palm;
|
2015-03-05 12:44:13 +01:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
struct device_coords initial;
|
|
|
|
|
} gesture;
|
2015-07-17 11:17:22 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
enum tp_thumb_state state;
|
|
|
|
|
uint64_t first_touch_time;
|
2015-07-22 11:53:22 +10:00
|
|
|
struct device_coords initial;
|
2015-07-17 11:17:22 +10:00
|
|
|
} thumb;
|
2014-02-07 13:39:27 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct tp_dispatch {
|
|
|
|
|
struct evdev_dispatch base;
|
|
|
|
|
struct evdev_device *device;
|
|
|
|
|
unsigned int nfingers_down; /* number of fingers down */
|
2014-07-21 15:25:47 +02:00
|
|
|
unsigned int old_nfingers_down; /* previous no fingers down */
|
2014-02-07 13:39:27 +10:00
|
|
|
unsigned int slot; /* current slot */
|
2014-02-14 14:18:27 +10:00
|
|
|
bool has_mt;
|
2014-07-21 15:25:47 +02:00
|
|
|
bool semi_mt;
|
2015-05-06 19:41:25 -04:00
|
|
|
bool reports_distance; /* does the device support true hovering */
|
2014-02-07 13:39:27 +10:00
|
|
|
|
2015-04-09 15:27:34 +10:00
|
|
|
unsigned int num_slots; /* number of slots */
|
2014-07-18 11:06:38 +02:00
|
|
|
unsigned int ntouches; /* no slots inc. fakes */
|
2014-02-07 13:39:27 +10:00
|
|
|
struct tp_touch *touches; /* len == ntouches */
|
2014-12-12 10:31:12 +10:00
|
|
|
/* bit 0: BTN_TOUCH
|
|
|
|
|
* bit 1: BTN_TOOL_FINGER
|
|
|
|
|
* bit 2: BTN_TOOL_DOUBLETAP
|
|
|
|
|
* ...
|
|
|
|
|
*/
|
|
|
|
|
unsigned int fake_touches;
|
2014-02-07 13:39:27 +10:00
|
|
|
|
2015-03-11 09:24:52 +10:00
|
|
|
struct device_coords hysteresis_margin;
|
2014-02-07 13:39:27 +10:00
|
|
|
|
2016-05-31 14:52:57 +10:00
|
|
|
struct {
|
|
|
|
|
struct device_coords min, max;
|
|
|
|
|
struct ratelimit range_warn_limit;
|
|
|
|
|
} warning_range;
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
struct {
|
2014-05-24 16:53:45 +02:00
|
|
|
double x_scale_coeff;
|
|
|
|
|
double y_scale_coeff;
|
2014-02-07 13:39:27 +10:00
|
|
|
} accel;
|
2014-02-07 13:48:06 +10:00
|
|
|
|
2015-02-16 13:30:24 +01:00
|
|
|
struct {
|
2015-07-30 10:48:39 +10:00
|
|
|
bool enabled;
|
2015-02-16 13:30:24 +01:00
|
|
|
bool started;
|
|
|
|
|
unsigned int finger_count;
|
|
|
|
|
unsigned int finger_count_pending;
|
|
|
|
|
struct libinput_timer finger_count_switch_timer;
|
2016-01-07 11:40:42 +10:00
|
|
|
enum tp_gesture_state state;
|
2015-03-05 12:44:13 +01:00
|
|
|
struct tp_touch *touches[2];
|
|
|
|
|
uint64_t initial_time;
|
|
|
|
|
double initial_distance;
|
|
|
|
|
double prev_scale;
|
|
|
|
|
double angle;
|
|
|
|
|
struct device_float_coords center;
|
2015-02-16 13:30:24 +01:00
|
|
|
} gesture;
|
|
|
|
|
|
2014-02-07 13:59:38 +10:00
|
|
|
struct {
|
2014-04-07 13:44:07 +02:00
|
|
|
bool is_clickpad; /* true for clickpads */
|
2014-05-27 15:08:35 +02:00
|
|
|
bool has_topbuttons;
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
bool use_clickfinger; /* number of fingers decides button number */
|
2014-04-07 16:49:36 +02:00
|
|
|
bool click_pending;
|
2014-02-07 13:59:38 +10:00
|
|
|
uint32_t state;
|
|
|
|
|
uint32_t old_state;
|
2015-06-12 17:29:41 +10:00
|
|
|
struct {
|
|
|
|
|
double x_scale_coeff;
|
|
|
|
|
double y_scale_coeff;
|
|
|
|
|
} motion_dist; /* for pinned touches */
|
2014-03-27 15:51:12 +10:00
|
|
|
unsigned int active; /* currently active button, for release event */
|
2014-09-16 16:22:39 +02:00
|
|
|
bool active_is_topbutton; /* is active a top button? */
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
|
2014-05-27 15:08:35 +02:00
|
|
|
/* Only used for clickpads. The software button areas are
|
|
|
|
|
* always 2 horizontal stripes across the touchpad.
|
|
|
|
|
* The buttons are split according to the edge settings.
|
2014-04-07 13:44:07 +02:00
|
|
|
*/
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
struct {
|
2015-03-06 12:35:56 +10:00
|
|
|
int32_t top_edge; /* in device coordinates */
|
|
|
|
|
int32_t rightbutton_left_edge; /* in device coordinates */
|
2016-04-04 10:06:36 +10:00
|
|
|
int32_t middlebutton_left_edge; /* in device coordinates */
|
2014-05-27 15:17:26 +02:00
|
|
|
} bottom_area;
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
|
2014-05-27 15:08:35 +02:00
|
|
|
struct {
|
2015-03-06 12:35:56 +10:00
|
|
|
int32_t bottom_edge; /* in device coordinates */
|
|
|
|
|
int32_t rightbutton_left_edge; /* in device coordinates */
|
|
|
|
|
int32_t leftbutton_right_edge; /* in device coordinates */
|
2014-05-27 15:08:35 +02:00
|
|
|
} top_area;
|
2014-09-16 16:22:38 +02:00
|
|
|
|
|
|
|
|
struct evdev_device *trackpoint;
|
2015-01-14 14:54:43 +01:00
|
|
|
|
|
|
|
|
enum libinput_config_click_method click_method;
|
|
|
|
|
struct libinput_device_config_click_method config_method;
|
|
|
|
|
} buttons;
|
2014-02-07 13:59:38 +10:00
|
|
|
|
2014-09-18 15:51:53 +10:00
|
|
|
struct {
|
2014-11-19 12:16:28 +10:00
|
|
|
struct libinput_device_config_scroll_method config_method;
|
|
|
|
|
enum libinput_config_scroll_method method;
|
2015-03-06 12:35:56 +10:00
|
|
|
int32_t right_edge; /* in device coordinates */
|
|
|
|
|
int32_t bottom_edge; /* in device coordinates */
|
2014-09-18 15:51:53 +10:00
|
|
|
} scroll;
|
|
|
|
|
|
2014-02-07 13:48:06 +10:00
|
|
|
enum touchpad_event queued;
|
2014-02-07 15:18:17 +10:00
|
|
|
|
|
|
|
|
struct {
|
2014-02-04 10:38:21 +10:00
|
|
|
struct libinput_device_config_tap config;
|
2014-02-07 15:18:17 +10:00
|
|
|
bool enabled;
|
2014-09-28 13:21:05 +02:00
|
|
|
bool suspended;
|
2014-06-06 17:01:07 +02:00
|
|
|
struct libinput_timer timer;
|
2014-02-07 15:18:17 +10:00
|
|
|
enum tp_tap_state state;
|
2014-09-28 13:21:04 +02:00
|
|
|
uint32_t buttons_pressed;
|
2016-01-22 17:59:19 +10:00
|
|
|
uint64_t first_press_time;
|
2015-06-22 11:06:25 +10:00
|
|
|
|
2016-07-21 14:03:28 +10:00
|
|
|
enum libinput_config_tap_button_map map;
|
|
|
|
|
enum libinput_config_tap_button_map want_map;
|
|
|
|
|
|
2016-01-22 17:59:19 +10:00
|
|
|
bool drag_enabled;
|
2015-06-22 11:06:25 +10:00
|
|
|
bool drag_lock_enabled;
|
2014-02-07 15:18:17 +10:00
|
|
|
} tap;
|
2014-07-10 17:34:08 +10:00
|
|
|
|
|
|
|
|
struct {
|
2015-03-06 12:35:56 +10:00
|
|
|
int32_t right_edge; /* in device coordinates */
|
|
|
|
|
int32_t left_edge; /* in device coordinates */
|
2015-06-24 11:22:29 +10:00
|
|
|
|
|
|
|
|
bool trackpoint_active;
|
|
|
|
|
struct libinput_event_listener trackpoint_listener;
|
|
|
|
|
struct libinput_timer trackpoint_timer;
|
2015-06-23 15:36:05 +10:00
|
|
|
uint64_t trackpoint_last_event_time;
|
2015-06-24 11:41:47 +10:00
|
|
|
bool monitor_trackpoint;
|
2014-07-10 17:34:08 +10:00
|
|
|
} palm;
|
2014-09-01 17:17:18 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
struct libinput_device_config_send_events config;
|
|
|
|
|
enum libinput_config_send_events_mode current_mode;
|
2015-05-25 10:07:51 +10:00
|
|
|
} sendevents;
|
2015-04-20 15:51:20 +10:00
|
|
|
|
2015-05-25 10:07:51 +10:00
|
|
|
struct {
|
2015-07-09 08:14:35 +10:00
|
|
|
struct libinput_device_config_dwt config;
|
|
|
|
|
bool dwt_enabled;
|
|
|
|
|
|
2015-04-20 15:51:20 +10:00
|
|
|
bool keyboard_active;
|
|
|
|
|
struct libinput_event_listener keyboard_listener;
|
|
|
|
|
struct libinput_timer keyboard_timer;
|
|
|
|
|
struct evdev_device *keyboard;
|
2016-02-04 08:31:25 +10:00
|
|
|
unsigned long key_mask[NLONGS(KEY_CNT)];
|
2016-08-04 10:43:25 +10:00
|
|
|
unsigned long mod_mask[NLONGS(KEY_CNT)];
|
2015-05-21 16:32:42 +10:00
|
|
|
|
|
|
|
|
uint64_t keyboard_last_press_time;
|
2015-05-25 10:07:51 +10:00
|
|
|
} dwt;
|
2015-05-27 18:25:49 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
bool detect_thumbs;
|
|
|
|
|
int threshold;
|
2015-07-17 11:17:22 +10:00
|
|
|
int upper_thumb_line;
|
|
|
|
|
int lower_thumb_line;
|
2015-05-27 18:25:49 +10:00
|
|
|
} thumb;
|
2016-03-07 16:05:25 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
/* A quirk used on the T450 series Synaptics hardware.
|
|
|
|
|
* Slowly moving the finger causes multiple events with only
|
|
|
|
|
* ABS_MT_PRESSURE but no x/y information. When the x/y
|
|
|
|
|
* event comes, it will be a jump of ~20 units. We use the
|
|
|
|
|
* below to count non-motion events to discard that first
|
|
|
|
|
* event with the jump.
|
|
|
|
|
*/
|
|
|
|
|
unsigned int nonmotion_event_count;
|
|
|
|
|
} quirks;
|
2014-02-07 13:39:27 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define tp_for_each_touch(_tp, _t) \
|
|
|
|
|
for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
|
|
|
|
|
|
2015-05-22 15:16:31 +10:00
|
|
|
static inline struct libinput*
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_libinput_context(const struct tp_dispatch *tp)
|
2015-05-22 15:16:31 +10:00
|
|
|
{
|
2016-06-09 08:54:00 +10:00
|
|
|
return evdev_libinput_context(tp->device);
|
2015-05-22 15:16:31 +10:00
|
|
|
}
|
|
|
|
|
|
2015-03-24 13:14:18 +01:00
|
|
|
static inline struct normalized_coords
|
2015-03-25 11:01:04 +01:00
|
|
|
tp_normalize_delta(struct tp_dispatch *tp, struct device_float_coords delta)
|
2015-03-05 16:48:47 +10:00
|
|
|
{
|
2015-03-24 13:14:18 +01:00
|
|
|
struct normalized_coords normalized;
|
|
|
|
|
|
2015-03-25 11:01:04 +01:00
|
|
|
normalized.x = delta.x * tp->accel.x_scale_coeff;
|
|
|
|
|
normalized.y = delta.y * tp->accel.y_scale_coeff;
|
2015-03-24 13:14:18 +01:00
|
|
|
|
|
|
|
|
return normalized;
|
2015-03-05 16:48:47 +10:00
|
|
|
}
|
|
|
|
|
|
2015-06-26 09:07:24 +10:00
|
|
|
/**
|
|
|
|
|
* Takes a dpi-normalized set of coordinates, returns a set of coordinates
|
|
|
|
|
* in the x-axis' coordinate space.
|
|
|
|
|
*/
|
|
|
|
|
static inline struct device_float_coords
|
|
|
|
|
tp_unnormalize_for_xaxis(struct tp_dispatch *tp, struct normalized_coords delta)
|
|
|
|
|
{
|
|
|
|
|
struct device_float_coords raw;
|
|
|
|
|
|
|
|
|
|
raw.x = delta.x / tp->accel.x_scale_coeff;
|
|
|
|
|
raw.y = delta.y / tp->accel.x_scale_coeff; /* <--- not a typo */
|
|
|
|
|
|
|
|
|
|
return raw;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-11 09:58:11 +10:00
|
|
|
struct normalized_coords
|
|
|
|
|
tp_get_delta(struct tp_touch *t);
|
2014-02-07 14:39:21 +10:00
|
|
|
|
2015-03-24 16:43:24 +01:00
|
|
|
struct normalized_coords
|
2014-11-24 12:16:06 +01:00
|
|
|
tp_filter_motion(struct tp_dispatch *tp,
|
2015-03-24 16:43:24 +01:00
|
|
|
const struct normalized_coords *unaccelerated,
|
2014-12-04 11:44:09 +08:00
|
|
|
uint64_t time);
|
2016-01-13 08:48:12 +10:00
|
|
|
|
2015-08-06 14:59:38 +10:00
|
|
|
struct normalized_coords
|
|
|
|
|
tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
|
|
|
|
const struct normalized_coords *unaccelerated,
|
|
|
|
|
uint64_t time);
|
2014-11-24 12:16:06 +01:00
|
|
|
|
2016-07-12 11:03:03 +10:00
|
|
|
bool
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
2015-02-16 13:30:24 +01:00
|
|
|
|
2014-02-07 15:18:17 +10:00
|
|
|
int
|
2014-04-08 12:29:45 +02:00
|
|
|
tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
|
2014-02-07 15:18:17 +10:00
|
|
|
|
2016-07-21 14:03:28 +10:00
|
|
|
void
|
|
|
|
|
tp_tap_post_process_state(struct tp_dispatch *tp);
|
|
|
|
|
|
2016-07-13 07:55:13 +10:00
|
|
|
void
|
2014-02-07 15:18:17 +10:00
|
|
|
tp_init_tap(struct tp_dispatch *tp);
|
|
|
|
|
|
2014-03-25 12:14:39 +10:00
|
|
|
void
|
2014-12-05 12:50:39 +01:00
|
|
|
tp_remove_tap(struct tp_dispatch *tp);
|
2014-03-25 12:14:39 +10:00
|
|
|
|
2016-07-13 07:55:13 +10:00
|
|
|
void
|
2014-03-27 13:09:06 +10:00
|
|
|
tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device);
|
|
|
|
|
|
2014-09-04 12:55:02 +10:00
|
|
|
void
|
2015-01-14 14:54:43 +01:00
|
|
|
tp_init_top_softbuttons(struct tp_dispatch *tp,
|
|
|
|
|
struct evdev_device *device,
|
|
|
|
|
double topbutton_size_mult);
|
2014-09-04 12:55:02 +10:00
|
|
|
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
void
|
2014-12-05 12:50:39 +01:00
|
|
|
tp_remove_buttons(struct tp_dispatch *tp);
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
|
2016-07-13 07:55:13 +10:00
|
|
|
void
|
2014-03-27 13:09:06 +10:00
|
|
|
tp_process_button(struct tp_dispatch *tp,
|
|
|
|
|
const struct input_event *e,
|
2014-04-08 12:29:45 +02:00
|
|
|
uint64_t time);
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2014-09-01 17:17:18 +10:00
|
|
|
void
|
|
|
|
|
tp_release_all_buttons(struct tp_dispatch *tp,
|
|
|
|
|
uint64_t time);
|
|
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
int
|
2014-04-08 12:29:45 +02:00
|
|
|
tp_post_button_events(struct tp_dispatch *tp, uint64_t time);
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2016-07-13 07:55:13 +10:00
|
|
|
void
|
2014-04-08 12:29:45 +02:00
|
|
|
tp_button_handle_state(struct tp_dispatch *tp, uint64_t time);
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
|
2016-07-12 11:03:03 +10:00
|
|
|
bool
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_button_touch_active(const struct tp_dispatch *tp,
|
|
|
|
|
const struct tp_touch *t);
|
2014-04-04 17:22:02 +02:00
|
|
|
|
2014-07-10 17:34:08 +10:00
|
|
|
bool
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp,
|
|
|
|
|
const struct tp_touch *t);
|
2014-07-10 17:34:08 +10:00
|
|
|
|
2014-09-01 17:17:18 +10:00
|
|
|
void
|
|
|
|
|
tp_release_all_taps(struct tp_dispatch *tp,
|
|
|
|
|
uint64_t time);
|
|
|
|
|
|
2014-09-28 13:21:05 +02:00
|
|
|
void
|
|
|
|
|
tp_tap_suspend(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_tap_resume(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
2014-09-25 15:58:04 +02:00
|
|
|
bool
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_tap_dragging(const struct tp_dispatch *tp);
|
2014-09-25 15:58:04 +02:00
|
|
|
|
2016-07-13 07:55:13 +10:00
|
|
|
void
|
2014-11-24 12:16:06 +01:00
|
|
|
tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device);
|
|
|
|
|
|
|
|
|
|
void
|
2014-12-05 12:50:39 +01:00
|
|
|
tp_remove_edge_scroll(struct tp_dispatch *tp);
|
2014-11-24 12:16:06 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
int
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_edge_scroll_touch_active(const struct tp_dispatch *tp,
|
|
|
|
|
const struct tp_touch *t);
|
2014-11-24 12:16:06 +01:00
|
|
|
|
2015-06-16 15:39:48 +10:00
|
|
|
uint32_t
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t);
|
2015-06-16 15:39:48 +10:00
|
|
|
|
2016-07-13 07:55:13 +10:00
|
|
|
void
|
2015-02-16 13:30:24 +01:00
|
|
|
tp_init_gesture(struct tp_dispatch *tp);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_remove_gesture(struct tp_dispatch *tp);
|
|
|
|
|
|
|
|
|
|
void
|
2015-05-22 10:09:22 +10:00
|
|
|
tp_gesture_stop(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time);
|
2015-02-16 13:30:24 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time);
|
|
|
|
|
|
2015-04-15 15:21:08 +10:00
|
|
|
bool
|
2016-01-07 13:04:58 +10:00
|
|
|
tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t);
|
2015-04-15 15:21:08 +10:00
|
|
|
|
2016-06-30 15:49:40 +10:00
|
|
|
void
|
|
|
|
|
tp_clickpad_middlebutton_apply_config(struct evdev_device *device);
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
#endif
|