2014-02-07 13:39:27 +10:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2014 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
|
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software
|
|
|
|
|
* without specific, written prior permission. The copyright holders make
|
|
|
|
|
* no representations about the suitability of this software for any
|
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
|
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
2014-07-21 14:20:35 +10:00
|
|
|
#define VENDOR_ID_APPLE 0x5ac
|
|
|
|
|
|
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),
|
|
|
|
|
};
|
|
|
|
|
|
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,
|
|
|
|
|
TOUCH_BEGIN,
|
|
|
|
|
TOUCH_UPDATE,
|
|
|
|
|
TOUCH_END
|
|
|
|
|
};
|
|
|
|
|
|
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,
|
|
|
|
|
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,
|
|
|
|
|
TAP_STATE_TOUCH_3,
|
|
|
|
|
TAP_STATE_TOUCH_3_HOLD,
|
|
|
|
|
TAP_STATE_DRAGGING_OR_DOUBLETAP,
|
|
|
|
|
TAP_STATE_DRAGGING,
|
|
|
|
|
TAP_STATE_DRAGGING_WAIT,
|
|
|
|
|
TAP_STATE_DRAGGING_2,
|
|
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-18 10:37:38 +10:00
|
|
|
enum tp_twofinger_scroll_state {
|
|
|
|
|
TWOFINGER_SCROLL_STATE_NONE,
|
|
|
|
|
TWOFINGER_SCROLL_STATE_ACTIVE,
|
|
|
|
|
};
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
struct tp_motion {
|
|
|
|
|
int32_t x;
|
|
|
|
|
int32_t y;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
bool dirty;
|
2014-02-14 13:59:41 +10:00
|
|
|
bool is_pointer; /* the pointer-controlling touch */
|
2014-02-07 13:39:27 +10:00
|
|
|
int32_t x;
|
|
|
|
|
int32_t y;
|
2014-04-08 12:29:45 +02:00
|
|
|
uint64_t millis;
|
2014-02-07 13:39:27 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
struct tp_motion samples[TOUCHPAD_HISTORY_LENGTH];
|
|
|
|
|
unsigned int index;
|
|
|
|
|
unsigned int count;
|
|
|
|
|
} history;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
int32_t center_x;
|
|
|
|
|
int32_t center_y;
|
|
|
|
|
} hysteresis;
|
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;
|
|
|
|
|
int32_t center_x;
|
|
|
|
|
int32_t center_y;
|
|
|
|
|
} 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;
|
|
|
|
|
} 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;
|
|
|
|
|
double threshold;
|
|
|
|
|
struct libinput_timer timer;
|
|
|
|
|
} scroll;
|
|
|
|
|
|
2014-07-14 16:06:51 +10:00
|
|
|
struct {
|
|
|
|
|
bool is_palm;
|
2014-07-14 16:38:46 +10:00
|
|
|
int32_t x, y; /* first coordinates if is_palm == true */
|
2014-07-14 16:06:51 +10:00
|
|
|
uint32_t time; /* first timestamp if is_palm == true */
|
|
|
|
|
} palm;
|
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;
|
2014-11-24 12:16:05 +01:00
|
|
|
enum touchpad_model model;
|
2014-02-07 13:39:27 +10:00
|
|
|
|
2014-07-18 11:06:38 +02:00
|
|
|
unsigned int real_touches; /* number of slots */
|
|
|
|
|
unsigned int ntouches; /* no slots inc. fakes */
|
2014-02-07 13:39:27 +10:00
|
|
|
struct tp_touch *touches; /* len == ntouches */
|
2014-02-14 15:12:22 +10:00
|
|
|
unsigned int fake_touches; /* fake touch mask */
|
2014-02-07 13:39:27 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
int32_t margin_x;
|
|
|
|
|
int32_t margin_y;
|
|
|
|
|
} hysteresis;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
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;
|
2014-04-15 14:27:59 +02:00
|
|
|
uint32_t 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 {
|
|
|
|
|
int32_t top_edge;
|
|
|
|
|
int32_t rightbutton_left_edge;
|
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 {
|
|
|
|
|
int32_t bottom_edge;
|
|
|
|
|
int32_t rightbutton_left_edge;
|
|
|
|
|
int32_t leftbutton_right_edge;
|
|
|
|
|
} top_area;
|
2014-09-16 16:22:38 +02:00
|
|
|
|
|
|
|
|
struct evdev_device *trackpoint;
|
2014-02-07 13:59:38 +10:00
|
|
|
} buttons; /* physical buttons */
|
|
|
|
|
|
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;
|
2014-11-24 12:16:06 +01:00
|
|
|
int32_t right_edge;
|
|
|
|
|
int32_t bottom_edge;
|
2014-12-18 10:37:38 +10:00
|
|
|
enum tp_twofinger_scroll_state twofinger_state;
|
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;
|
2014-02-07 15:18:17 +10:00
|
|
|
} tap;
|
2014-07-10 17:34:08 +10:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
int32_t right_edge;
|
|
|
|
|
int32_t left_edge;
|
|
|
|
|
} 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;
|
2014-09-28 13:21:08 +02:00
|
|
|
bool trackpoint_active;
|
|
|
|
|
struct libinput_event_listener trackpoint_listener;
|
|
|
|
|
struct libinput_timer trackpoint_timer;
|
2014-09-01 17:17:18 +10:00
|
|
|
} sendevents;
|
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++)
|
|
|
|
|
|
2014-02-07 14:39:21 +10:00
|
|
|
void
|
|
|
|
|
tp_get_delta(struct tp_touch *t, double *dx, double *dy);
|
|
|
|
|
|
2014-04-04 17:22:02 +02:00
|
|
|
void
|
|
|
|
|
tp_set_pointer(struct tp_dispatch *tp, struct tp_touch *t);
|
|
|
|
|
|
2014-11-24 12:16:06 +01:00
|
|
|
void
|
|
|
|
|
tp_filter_motion(struct tp_dispatch *tp,
|
2014-12-04 11:44:09 +08:00
|
|
|
double *dx, double *dy,
|
|
|
|
|
double *dx_unaccel, double *dy_unaccel,
|
|
|
|
|
uint64_t time);
|
2014-11-24 12:16:06 +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
|
|
|
|
|
|
|
|
int
|
|
|
|
|
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
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
int
|
|
|
|
|
tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device);
|
|
|
|
|
|
2014-09-04 12:55:02 +10:00
|
|
|
void
|
2014-09-17 15:35:30 +02:00
|
|
|
tp_init_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
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
int
|
|
|
|
|
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
|
|
|
|
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
|
|
|
int
|
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
|
|
|
|
2014-04-04 17:22:02 +02:00
|
|
|
int
|
|
|
|
|
tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
|
|
|
|
|
|
2014-07-10 17:34:08 +10:00
|
|
|
bool
|
|
|
|
|
tp_button_is_inside_softbutton_area(struct tp_dispatch *tp, struct tp_touch *t);
|
|
|
|
|
|
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
|
|
|
|
|
tp_tap_dragging(struct tp_dispatch *tp);
|
|
|
|
|
|
2014-11-24 12:16:06 +01:00
|
|
|
int
|
|
|
|
|
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
|
|
|
|
|
tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
|
|
|
|
|
|
2014-02-07 13:39:27 +10:00
|
|
|
#endif
|