2014-03-27 13:09:06 +10:00
|
|
|
/*
|
2015-05-28 08:23:59 +10:00
|
|
|
* Copyright © 2014-2015 Red Hat, Inc.
|
2014-03-27 13:09:06 +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-03-27 13:09:06 +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-03-27 13:09:06 +10:00
|
|
|
*/
|
|
|
|
|
|
2015-06-01 08:09:26 +10:00
|
|
|
#include "config.h"
|
|
|
|
|
|
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
|
|
|
#include <errno.h>
|
|
|
|
|
#include <limits.h>
|
2014-03-27 13:09:06 +10:00
|
|
|
#include <math.h>
|
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
|
|
|
#include <string.h>
|
|
|
|
|
#include <unistd.h>
|
2014-06-03 07:51:37 +10:00
|
|
|
#include "linux/input.h"
|
2014-03-27 13:09:06 +10:00
|
|
|
|
|
|
|
|
#include "evdev-mt-touchpad.h"
|
|
|
|
|
|
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
|
|
|
#define DEFAULT_BUTTON_ENTER_TIMEOUT 100 /* ms */
|
|
|
|
|
#define DEFAULT_BUTTON_LEAVE_TIMEOUT 300 /* ms */
|
|
|
|
|
|
|
|
|
|
/*****************************************
|
|
|
|
|
* BEFORE YOU EDIT THIS FILE, look at the state diagram in
|
|
|
|
|
* doc/touchpad-softbutton-state-machine.svg, or online at
|
|
|
|
|
* https://drive.google.com/file/d/0B1NwWmji69nocUs1cVJTbkdwMFk/edit?usp=sharing
|
|
|
|
|
* (it's a http://draw.io diagram)
|
|
|
|
|
*
|
|
|
|
|
* Any changes in this file must be represented in the diagram.
|
|
|
|
|
*
|
|
|
|
|
* The state machine only affects the soft button area code.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define CASE_RETURN_STRING(a) case a: return #a;
|
|
|
|
|
|
|
|
|
|
static inline const char*
|
|
|
|
|
button_state_to_str(enum button_state state) {
|
|
|
|
|
switch(state) {
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_NONE);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_AREA);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_BOTTOM);
|
2014-05-27 15:08:35 +02:00
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_TOP);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_TOP_NEW);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_TOP_TO_IGNORE);
|
|
|
|
|
CASE_RETURN_STRING(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
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline const char*
|
|
|
|
|
button_event_to_str(enum button_event event) {
|
|
|
|
|
switch(event) {
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_R);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_L);
|
2014-05-27 15:08:35 +02:00
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_R);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_M);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_L);
|
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
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_IN_AREA);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_UP);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_PRESS);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_RELEASE);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_EVENT_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
2014-05-27 15:17:26 +02:00
|
|
|
is_inside_bottom_button_area(struct tp_dispatch *tp, struct tp_touch *t)
|
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
|
|
|
{
|
2015-03-11 09:24:52 +10:00
|
|
|
return t->point.y >= tp->buttons.bottom_area.top_edge;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
2014-05-27 15:17:26 +02:00
|
|
|
is_inside_bottom_right_area(struct tp_dispatch *tp, struct tp_touch *t)
|
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:17:26 +02:00
|
|
|
return is_inside_bottom_button_area(tp, t) &&
|
2015-03-11 09:24:52 +10:00
|
|
|
t->point.x > tp->buttons.bottom_area.rightbutton_left_edge;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
2014-05-27 15:17:26 +02:00
|
|
|
is_inside_bottom_left_area(struct tp_dispatch *tp, struct tp_touch *t)
|
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:17:26 +02:00
|
|
|
return is_inside_bottom_button_area(tp, t) &&
|
|
|
|
|
!is_inside_bottom_right_area(tp, t);
|
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
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_button_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
2015-03-11 09:24:52 +10:00
|
|
|
return t->point.y <= tp->buttons.top_area.bottom_edge;
|
2014-05-27 15:08:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_right_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return is_inside_top_button_area(tp, t) &&
|
2015-03-11 09:24:52 +10:00
|
|
|
t->point.x > tp->buttons.top_area.rightbutton_left_edge;
|
2014-05-27 15:08:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_left_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return is_inside_top_button_area(tp, t) &&
|
2015-03-11 09:24:52 +10:00
|
|
|
t->point.x < tp->buttons.top_area.leftbutton_right_edge;
|
2014-05-27 15:08:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_middle_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return is_inside_top_button_area(tp, t) &&
|
2015-03-11 09:24:52 +10:00
|
|
|
t->point.x >= tp->buttons.top_area.leftbutton_right_edge &&
|
|
|
|
|
t->point.x <= tp->buttons.top_area.rightbutton_left_edge;
|
2014-05-27 15:08:35 +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
|
|
|
static void
|
|
|
|
|
tp_button_set_enter_timer(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
2014-06-06 17:01:06 +02:00
|
|
|
libinput_timer_set(&t->button.timer,
|
|
|
|
|
t->millis + DEFAULT_BUTTON_ENTER_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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_set_leave_timer(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
2014-06-06 17:01:06 +02:00
|
|
|
libinput_timer_set(&t->button.timer,
|
|
|
|
|
t->millis + DEFAULT_BUTTON_LEAVE_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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* tp_button_set_state, change state and implement on-entry behavior
|
|
|
|
|
* as described in the state machine diagram.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
2015-04-24 12:02:28 +10:00
|
|
|
tp_button_set_state(struct tp_dispatch *tp,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_state new_state,
|
|
|
|
|
enum button_event event)
|
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-06-06 17:01:06 +02:00
|
|
|
libinput_timer_cancel(&t->button.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
|
|
|
|
|
|
|
|
t->button.state = new_state;
|
2015-04-24 12:02:28 +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
|
|
|
switch (t->button.state) {
|
|
|
|
|
case BUTTON_STATE_NONE:
|
|
|
|
|
t->button.curr = 0;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_AREA:
|
|
|
|
|
t->button.curr = BUTTON_EVENT_IN_AREA;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_BOTTOM:
|
|
|
|
|
t->button.curr = event;
|
|
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_STATE_TOP:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_TOP_NEW:
|
|
|
|
|
t->button.curr = event;
|
|
|
|
|
tp_button_set_enter_timer(tp, t);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_TOP_TO_IGNORE:
|
|
|
|
|
tp_button_set_leave_timer(tp, t);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_IGNORE:
|
|
|
|
|
t->button.curr = 0;
|
|
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_none_handle_event(struct tp_dispatch *tp,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
|
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
2014-07-02 15:00:31 +10:00
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM, event);
|
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
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP_NEW, event);
|
|
|
|
|
break;
|
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
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_AREA, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_area_handle_event(struct tp_dispatch *tp,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
|
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
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
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_bottom_handle_event(struct tp_dispatch *tp,
|
2014-07-02 15:00:31 +10:00
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
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
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
|
|
|
|
if (event != t->button.curr)
|
2015-04-24 12:02:28 +10:00
|
|
|
tp_button_set_state(tp,
|
|
|
|
|
t,
|
|
|
|
|
BUTTON_STATE_BOTTOM,
|
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
|
|
|
event);
|
|
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
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
|
|
|
case BUTTON_EVENT_IN_AREA:
|
2014-07-02 15:00:31 +10:00
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_AREA, event);
|
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
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 15:08:35 +02:00
|
|
|
static void
|
|
|
|
|
tp_button_top_handle_event(struct tp_dispatch *tp,
|
2015-04-24 12:02:28 +10:00
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
2014-05-27 15:08:35 +02:00
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP_TO_IGNORE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
|
|
|
|
if (event != t->button.curr)
|
2015-04-24 12:02:28 +10:00
|
|
|
tp_button_set_state(tp,
|
|
|
|
|
t,
|
|
|
|
|
BUTTON_STATE_TOP_NEW,
|
2014-05-27 15:08:35 +02:00
|
|
|
event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP_TO_IGNORE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_top_new_handle_event(struct tp_dispatch *tp,
|
2015-04-24 12:02:28 +10:00
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
2014-05-27 15:08:35 +02:00
|
|
|
{
|
|
|
|
|
switch(event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_AREA, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
|
|
|
|
if (event != t->button.curr)
|
2015-04-24 12:02:28 +10:00
|
|
|
tp_button_set_state(tp,
|
|
|
|
|
t,
|
|
|
|
|
BUTTON_STATE_TOP_NEW,
|
2014-05-27 15:08:35 +02:00
|
|
|
event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_AREA, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP, event);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_top_to_ignore_handle_event(struct tp_dispatch *tp,
|
2015-04-24 12:02:28 +10:00
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
2014-05-27 15:08:35 +02:00
|
|
|
{
|
|
|
|
|
switch(event) {
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
|
|
|
|
if (event == t->button.curr)
|
2015-04-24 12:02:28 +10:00
|
|
|
tp_button_set_state(tp,
|
|
|
|
|
t,
|
|
|
|
|
BUTTON_STATE_TOP,
|
2014-05-27 15:08:35 +02:00
|
|
|
event);
|
|
|
|
|
else
|
2015-04-24 12:02:28 +10:00
|
|
|
tp_button_set_state(tp,
|
|
|
|
|
t,
|
|
|
|
|
BUTTON_STATE_TOP_NEW,
|
2014-05-27 15:08:35 +02:00
|
|
|
event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
|
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_IGNORE, event);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_ignore_handle_event(struct tp_dispatch *tp,
|
2015-04-24 12:02:28 +10:00
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
2014-05-27 15:08:35 +02:00
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
|
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_UP:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_NONE, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_PRESS:
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
|
tp_button_handle_event(struct tp_dispatch *tp,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event,
|
2014-04-08 12:29:45 +02:00
|
|
|
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
|
|
|
{
|
2015-05-22 15:16:31 +10:00
|
|
|
struct libinput *libinput = tp_libinput_context(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
|
|
|
enum button_state current = t->button.state;
|
|
|
|
|
|
|
|
|
|
switch(t->button.state) {
|
|
|
|
|
case BUTTON_STATE_NONE:
|
|
|
|
|
tp_button_none_handle_event(tp, t, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_AREA:
|
|
|
|
|
tp_button_area_handle_event(tp, t, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_BOTTOM:
|
|
|
|
|
tp_button_bottom_handle_event(tp, t, event);
|
|
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_STATE_TOP:
|
|
|
|
|
tp_button_top_handle_event(tp, t, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_TOP_NEW:
|
|
|
|
|
tp_button_top_new_handle_event(tp, t, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_TOP_TO_IGNORE:
|
|
|
|
|
tp_button_top_to_ignore_handle_event(tp, t, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_IGNORE:
|
|
|
|
|
tp_button_ignore_handle_event(tp, t, event);
|
|
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (current != t->button.state)
|
2014-06-18 19:51:19 +10:00
|
|
|
log_debug(libinput,
|
|
|
|
|
"button state: from %s, event %s to %s\n",
|
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_state_to_str(current),
|
|
|
|
|
button_event_to_str(event),
|
|
|
|
|
button_state_to_str(t->button.state));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
struct tp_touch *t;
|
|
|
|
|
|
|
|
|
|
tp_for_each_touch(tp, t) {
|
|
|
|
|
if (t->state == TOUCH_NONE)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (t->state == TOUCH_END) {
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_UP, time);
|
|
|
|
|
} else if (t->dirty) {
|
2015-04-24 12:36:43 +10:00
|
|
|
enum button_event event;
|
|
|
|
|
|
2014-05-27 15:17:26 +02:00
|
|
|
if (is_inside_bottom_right_area(tp, t))
|
2015-04-24 12:36:43 +10:00
|
|
|
event = BUTTON_EVENT_IN_BOTTOM_R;
|
2014-05-27 15:17:26 +02:00
|
|
|
else if (is_inside_bottom_left_area(tp, t))
|
2015-04-24 12:36:43 +10:00
|
|
|
event = BUTTON_EVENT_IN_BOTTOM_L;
|
2014-05-27 15:08:35 +02:00
|
|
|
else if (is_inside_top_right_area(tp, t))
|
2015-04-24 12:36:43 +10:00
|
|
|
event = BUTTON_EVENT_IN_TOP_R;
|
2014-05-27 15:08:35 +02:00
|
|
|
else if (is_inside_top_middle_area(tp, t))
|
2015-04-24 12:36:43 +10:00
|
|
|
event = BUTTON_EVENT_IN_TOP_M;
|
2014-05-27 15:08:35 +02:00
|
|
|
else if (is_inside_top_left_area(tp, t))
|
2015-04-24 12:36:43 +10:00
|
|
|
event = BUTTON_EVENT_IN_TOP_L;
|
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
|
|
|
else
|
2015-04-24 12:36:43 +10:00
|
|
|
event = BUTTON_EVENT_IN_AREA;
|
|
|
|
|
|
|
|
|
|
tp_button_handle_event(tp, t, event, 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
|
|
|
}
|
|
|
|
|
if (tp->queued & TOUCHPAD_EVENT_BUTTON_RELEASE)
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_RELEASE, time);
|
|
|
|
|
if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-08 12:39:24 +02:00
|
|
|
static void
|
2014-06-06 17:01:06 +02:00
|
|
|
tp_button_handle_timeout(uint64_t now, void *data)
|
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-06-06 17:01:06 +02:00
|
|
|
struct tp_touch *t = data;
|
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-06-06 17:01:06 +02:00
|
|
|
tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now);
|
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
|
|
|
{
|
2015-05-22 15:16:31 +10:00
|
|
|
struct libinput *libinput = tp_libinput_context(tp);
|
2014-03-27 13:09:06 +10:00
|
|
|
uint32_t mask = 1 << (e->code - BTN_LEFT);
|
2014-04-07 13:50:11 +02:00
|
|
|
|
|
|
|
|
/* Ignore other buttons on clickpads */
|
|
|
|
|
if (tp->buttons.is_clickpad && e->code != BTN_LEFT) {
|
2014-06-18 19:51:19 +10:00
|
|
|
log_bug_kernel(libinput,
|
|
|
|
|
"received %s button event on a clickpad\n",
|
2014-05-21 14:36:01 +10:00
|
|
|
libevdev_event_code_get_name(EV_KEY, e->code));
|
2014-04-07 13:50:11 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
if (e->value) {
|
|
|
|
|
tp->buttons.state |= mask;
|
|
|
|
|
tp->queued |= TOUCHPAD_EVENT_BUTTON_PRESS;
|
|
|
|
|
} else {
|
|
|
|
|
tp->buttons.state &= ~mask;
|
|
|
|
|
tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-01 17:17:18 +10:00
|
|
|
void
|
|
|
|
|
tp_release_all_buttons(struct tp_dispatch *tp,
|
|
|
|
|
uint64_t time)
|
|
|
|
|
{
|
|
|
|
|
if (tp->buttons.state) {
|
|
|
|
|
tp->buttons.state = 0;
|
|
|
|
|
tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 14:54:43 +01:00
|
|
|
static void
|
2014-09-04 12:55:02 +10:00
|
|
|
tp_init_softbuttons(struct tp_dispatch *tp,
|
2015-01-14 14:54:43 +01:00
|
|
|
struct evdev_device *device)
|
2014-09-04 12:55:02 +10:00
|
|
|
{
|
|
|
|
|
int width, height;
|
|
|
|
|
const struct input_absinfo *absinfo_x, *absinfo_y;
|
|
|
|
|
int xoffset, yoffset;
|
|
|
|
|
int yres;
|
|
|
|
|
|
|
|
|
|
absinfo_x = device->abs.absinfo_x;
|
|
|
|
|
absinfo_y = device->abs.absinfo_y;
|
|
|
|
|
|
|
|
|
|
xoffset = absinfo_x->minimum,
|
|
|
|
|
yoffset = absinfo_y->minimum;
|
|
|
|
|
yres = absinfo_y->resolution;
|
|
|
|
|
width = abs(absinfo_x->maximum - absinfo_x->minimum);
|
|
|
|
|
height = abs(absinfo_y->maximum - absinfo_y->minimum);
|
|
|
|
|
|
|
|
|
|
/* button height: 10mm or 15% of the touchpad height,
|
|
|
|
|
whichever is smaller */
|
2015-03-17 10:35:31 +10:00
|
|
|
if (!device->abs.fake_resolution && (height * 0.15/yres) > 10) {
|
2014-09-04 12:55:02 +10:00
|
|
|
tp->buttons.bottom_area.top_edge =
|
|
|
|
|
absinfo_y->maximum - 10 * yres;
|
|
|
|
|
} else {
|
|
|
|
|
tp->buttons.bottom_area.top_edge = height * .85 + yoffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tp->buttons.bottom_area.rightbutton_left_edge = width/2 + xoffset;
|
2015-01-14 14:54:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
tp_init_top_softbuttons(struct tp_dispatch *tp,
|
|
|
|
|
struct evdev_device *device,
|
|
|
|
|
double topbutton_size_mult)
|
|
|
|
|
{
|
|
|
|
|
int width, height;
|
|
|
|
|
const struct input_absinfo *absinfo_x, *absinfo_y;
|
|
|
|
|
int xoffset, yoffset;
|
|
|
|
|
int yres;
|
|
|
|
|
|
|
|
|
|
absinfo_x = device->abs.absinfo_x;
|
|
|
|
|
absinfo_y = device->abs.absinfo_y;
|
|
|
|
|
|
|
|
|
|
xoffset = absinfo_x->minimum,
|
|
|
|
|
yoffset = absinfo_y->minimum;
|
|
|
|
|
yres = absinfo_y->resolution;
|
|
|
|
|
width = abs(absinfo_x->maximum - absinfo_x->minimum);
|
|
|
|
|
height = abs(absinfo_y->maximum - absinfo_y->minimum);
|
2014-09-04 12:55:02 +10:00
|
|
|
|
|
|
|
|
if (tp->buttons.has_topbuttons) {
|
2014-09-17 15:35:30 +02:00
|
|
|
/* T440s has the top button line 5mm from the top, event
|
|
|
|
|
analysis has shown events to start down to ~10mm from the
|
|
|
|
|
top - which maps to 15%. We allow the caller to enlarge the
|
|
|
|
|
area using a multiplier for the touchpad disabled case. */
|
|
|
|
|
double topsize_mm = 10 * topbutton_size_mult;
|
|
|
|
|
double topsize_pct = .15 * topbutton_size_mult;
|
|
|
|
|
|
2015-03-17 10:35:31 +10:00
|
|
|
if (!device->abs.fake_resolution) {
|
2014-09-04 12:55:02 +10:00
|
|
|
tp->buttons.top_area.bottom_edge =
|
2014-09-17 15:35:30 +02:00
|
|
|
yoffset + topsize_mm * yres;
|
2014-09-04 12:55:02 +10:00
|
|
|
} else {
|
2014-09-17 15:35:30 +02:00
|
|
|
tp->buttons.top_area.bottom_edge = height * topsize_pct + yoffset;
|
2014-09-04 12:55:02 +10:00
|
|
|
}
|
|
|
|
|
tp->buttons.top_area.rightbutton_left_edge = width * .58 + xoffset;
|
|
|
|
|
tp->buttons.top_area.leftbutton_right_edge = width * .42 + xoffset;
|
|
|
|
|
} else {
|
|
|
|
|
tp->buttons.top_area.bottom_edge = INT_MIN;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 14:54:43 +01:00
|
|
|
static inline uint32_t
|
|
|
|
|
tp_button_config_click_get_methods(struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
struct evdev_device *evdev = (struct evdev_device*)device;
|
|
|
|
|
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
|
|
|
|
uint32_t methods = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
|
|
|
|
|
|
|
|
|
if (tp->buttons.is_clickpad) {
|
|
|
|
|
methods |= LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
|
|
|
|
if (tp->has_mt)
|
|
|
|
|
methods |= LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return methods;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_switch_click_method(struct tp_dispatch *tp)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* All we need to do when switching click methods is to change the
|
|
|
|
|
* bottom_area.top_edge so that when in clickfinger mode the bottom
|
|
|
|
|
* touchpad area is not dead wrt finger movement starting there.
|
|
|
|
|
*
|
|
|
|
|
* We do not need to take any state into account, fingers which are
|
|
|
|
|
* already down will simply keep the state / area they have assigned
|
|
|
|
|
* until they are released, and the post_button_events path is state
|
|
|
|
|
* agnostic.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
switch (tp->buttons.click_method) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS:
|
|
|
|
|
tp_init_softbuttons(tp, tp->device);
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER:
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_NONE:
|
|
|
|
|
tp->buttons.bottom_area.top_edge = INT_MAX;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static enum libinput_config_status
|
|
|
|
|
tp_button_config_click_set_method(struct libinput_device *device,
|
|
|
|
|
enum libinput_config_click_method method)
|
|
|
|
|
{
|
|
|
|
|
struct evdev_device *evdev = (struct evdev_device*)device;
|
|
|
|
|
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
|
|
|
|
|
|
|
|
|
tp->buttons.click_method = method;
|
|
|
|
|
tp_switch_click_method(tp);
|
|
|
|
|
|
|
|
|
|
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static enum libinput_config_click_method
|
|
|
|
|
tp_button_config_click_get_method(struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
struct evdev_device *evdev = (struct evdev_device*)device;
|
|
|
|
|
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
|
|
|
|
|
|
|
|
|
return tp->buttons.click_method;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static enum libinput_config_click_method
|
|
|
|
|
tp_click_get_default_method(struct tp_dispatch *tp)
|
|
|
|
|
{
|
2015-04-23 12:06:42 +10:00
|
|
|
struct evdev_device *device = tp->device;
|
|
|
|
|
|
2015-01-14 14:54:43 +01:00
|
|
|
if (!tp->buttons.is_clickpad)
|
|
|
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
2015-04-29 11:03:08 +10:00
|
|
|
else if (libevdev_get_id_vendor(tp->device->evdev) == VENDOR_ID_APPLE)
|
2015-01-14 14:54:43 +01:00
|
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
2015-04-29 11:03:08 +10:00
|
|
|
|
|
|
|
|
switch (device->model) {
|
|
|
|
|
case EVDEV_MODEL_CHROMEBOOK:
|
|
|
|
|
case EVDEV_MODEL_SYSTEM76_BONOBO:
|
|
|
|
|
case EVDEV_MODEL_SYSTEM76_GALAGO:
|
|
|
|
|
case EVDEV_MODEL_SYSTEM76_KUDU:
|
2015-05-18 15:13:23 +02:00
|
|
|
case EVDEV_MODEL_CLEVO_W740SU:
|
2015-04-29 11:03:08 +10:00
|
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
2015-01-14 14:54:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static enum libinput_config_click_method
|
|
|
|
|
tp_button_config_click_get_default_method(struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
struct evdev_device *evdev = (struct evdev_device*)device;
|
|
|
|
|
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
|
|
|
|
|
|
|
|
|
return tp_click_get_default_method(tp);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
int
|
|
|
|
|
tp_init_buttons(struct tp_dispatch *tp,
|
|
|
|
|
struct evdev_device *device)
|
|
|
|
|
{
|
2015-05-22 15:16:31 +10:00
|
|
|
struct libinput *libinput = tp_libinput_context(tp);
|
2014-06-06 17:01:06 +02:00
|
|
|
struct tp_touch *t;
|
2014-03-27 13:09:06 +10:00
|
|
|
int width, height;
|
|
|
|
|
double diagonal;
|
2014-06-19 11:11:36 +10:00
|
|
|
const struct input_absinfo *absinfo_x, *absinfo_y;
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2014-04-07 13:44:07 +02:00
|
|
|
tp->buttons.is_clickpad = libevdev_has_property(device->evdev,
|
|
|
|
|
INPUT_PROP_BUTTONPAD);
|
2014-05-27 15:08:35 +02:00
|
|
|
tp->buttons.has_topbuttons = libevdev_has_property(device->evdev,
|
|
|
|
|
INPUT_PROP_TOPBUTTONPAD);
|
2014-04-07 13:44:07 +02:00
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE) ||
|
2014-04-07 13:44:07 +02:00
|
|
|
libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) {
|
|
|
|
|
if (tp->buttons.is_clickpad)
|
2014-06-18 19:51:19 +10:00
|
|
|
log_bug_kernel(libinput,
|
2014-07-03 09:53:35 +10:00
|
|
|
"%s: clickpad advertising right button\n",
|
2014-11-20 14:26:10 +10:00
|
|
|
device->devname);
|
2015-03-04 09:51:54 +10:00
|
|
|
} else if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT) &&
|
|
|
|
|
!tp->buttons.is_clickpad) {
|
2014-06-18 19:51:19 +10:00
|
|
|
log_bug_kernel(libinput,
|
2014-07-03 09:53:35 +10:00
|
|
|
"%s: non clickpad without right button?\n",
|
2014-11-20 14:26:10 +10:00
|
|
|
device->devname);
|
2014-04-07 13:44:07 +02:00
|
|
|
}
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2014-06-19 11:11:36 +10:00
|
|
|
absinfo_x = device->abs.absinfo_x;
|
|
|
|
|
absinfo_y = device->abs.absinfo_y;
|
|
|
|
|
|
2015-06-12 17:29:41 +10:00
|
|
|
/* pinned-finger motion threshold, see tp_unpin_finger.
|
|
|
|
|
The MAGIC for resolution-less touchpads ends up as 2% of the diagonal */
|
|
|
|
|
if (device->abs.fake_resolution) {
|
|
|
|
|
const int BUTTON_MOTION_MAGIC = 0.007;
|
|
|
|
|
width = abs(absinfo_x->maximum - absinfo_x->minimum);
|
|
|
|
|
height = abs(absinfo_y->maximum - absinfo_y->minimum);
|
|
|
|
|
diagonal = sqrt(width*width + height*height);
|
|
|
|
|
tp->buttons.motion_dist.x_scale_coeff = diagonal * BUTTON_MOTION_MAGIC;
|
|
|
|
|
tp->buttons.motion_dist.y_scale_coeff = diagonal * BUTTON_MOTION_MAGIC;
|
|
|
|
|
} else {
|
|
|
|
|
tp->buttons.motion_dist.x_scale_coeff = 1.0/absinfo_x->resolution;
|
|
|
|
|
tp->buttons.motion_dist.y_scale_coeff = 1.0/absinfo_y->resolution;
|
|
|
|
|
}
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2015-01-14 14:54:43 +01:00
|
|
|
tp->buttons.config_method.get_methods = tp_button_config_click_get_methods;
|
|
|
|
|
tp->buttons.config_method.set_method = tp_button_config_click_set_method;
|
|
|
|
|
tp->buttons.config_method.get_method = tp_button_config_click_get_method;
|
|
|
|
|
tp->buttons.config_method.get_default_method = tp_button_config_click_get_default_method;
|
|
|
|
|
tp->device->base.config.click_method = &tp->buttons.config_method;
|
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
|
|
|
|
2015-01-14 14:54:43 +01:00
|
|
|
tp->buttons.click_method = tp_click_get_default_method(tp);
|
|
|
|
|
tp_switch_click_method(tp);
|
|
|
|
|
|
|
|
|
|
tp_init_top_softbuttons(tp, device, 1.0);
|
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
|
|
|
|
2015-04-14 14:40:49 +10:00
|
|
|
if (!tp->buttons.is_clickpad &&
|
|
|
|
|
!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE))
|
|
|
|
|
evdev_init_middlebutton(tp->device, true, false);
|
|
|
|
|
|
2014-06-06 17:01:06 +02:00
|
|
|
tp_for_each_touch(tp, t) {
|
|
|
|
|
t->button.state = BUTTON_STATE_NONE;
|
|
|
|
|
libinput_timer_init(&t->button.timer,
|
2015-05-22 15:16:31 +10:00
|
|
|
tp_libinput_context(tp),
|
2014-06-06 17:01:06 +02:00
|
|
|
tp_button_handle_timeout, t);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
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-06-06 17:01:06 +02:00
|
|
|
struct tp_touch *t;
|
|
|
|
|
|
|
|
|
|
tp_for_each_touch(tp, t)
|
|
|
|
|
libinput_timer_cancel(&t->button.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
|
|
|
}
|
|
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
static int
|
2014-04-08 12:29:45 +02:00
|
|
|
tp_post_physical_buttons(struct tp_dispatch *tp, uint64_t time)
|
2014-03-27 13:09:06 +10:00
|
|
|
{
|
|
|
|
|
uint32_t current, old, button;
|
|
|
|
|
|
|
|
|
|
current = tp->buttons.state;
|
|
|
|
|
old = tp->buttons.old_state;
|
|
|
|
|
button = BTN_LEFT;
|
|
|
|
|
|
|
|
|
|
while (current || old) {
|
2014-06-03 20:08:02 -04:00
|
|
|
enum libinput_button_state state;
|
2014-03-27 13:09:06 +10:00
|
|
|
|
|
|
|
|
if ((current & 0x1) ^ (old & 0x1)) {
|
2014-09-23 14:35:42 +10:00
|
|
|
uint32_t b;
|
|
|
|
|
|
2014-03-27 13:09:06 +10:00
|
|
|
if (!!(current & 0x1))
|
2014-06-03 20:08:02 -04:00
|
|
|
state = LIBINPUT_BUTTON_STATE_PRESSED;
|
2014-03-27 13:09:06 +10:00
|
|
|
else
|
2014-06-03 20:08:02 -04:00
|
|
|
state = LIBINPUT_BUTTON_STATE_RELEASED;
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2014-09-23 14:35:42 +10:00
|
|
|
b = evdev_to_left_handed(tp->device, button);
|
2015-04-13 14:47:26 +10:00
|
|
|
evdev_pointer_notify_physical_button(tp->device,
|
|
|
|
|
time,
|
|
|
|
|
b,
|
|
|
|
|
state);
|
2014-03-27 13:09:06 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
button++;
|
|
|
|
|
current >>= 1;
|
|
|
|
|
old >>= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-03 12:15:51 +10:00
|
|
|
static inline int
|
|
|
|
|
tp_check_clickfinger_distance(struct tp_dispatch *tp,
|
|
|
|
|
struct tp_touch *t1,
|
|
|
|
|
struct tp_touch *t2)
|
|
|
|
|
{
|
|
|
|
|
double x, y;
|
|
|
|
|
|
|
|
|
|
if (!t1 || !t2)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2015-06-03 14:27:43 +10:00
|
|
|
x = abs(t1->point.x - t2->point.x);
|
|
|
|
|
y = abs(t1->point.y - t2->point.y);
|
|
|
|
|
|
2015-06-03 12:15:51 +10:00
|
|
|
/* no resolution, so let's assume they're close enough together */
|
2015-06-03 14:27:43 +10:00
|
|
|
if (tp->device->abs.fake_resolution) {
|
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
|
|
/* Use a maximum of 30% of the touchpad width or height if
|
|
|
|
|
* we dont' have resolution. */
|
|
|
|
|
w = tp->device->abs.absinfo_x->maximum -
|
|
|
|
|
tp->device->abs.absinfo_x->minimum;
|
|
|
|
|
h = tp->device->abs.absinfo_y->maximum -
|
|
|
|
|
tp->device->abs.absinfo_y->minimum;
|
2015-06-03 12:15:51 +10:00
|
|
|
|
2015-06-03 14:27:43 +10:00
|
|
|
return (x < w * 0.3 && y < h * 0.3) ? 1 : 0;
|
|
|
|
|
} else {
|
|
|
|
|
/* maximum spread is 40mm horiz, 20mm vert. Anything wider than that
|
|
|
|
|
* is probably a gesture. The y spread is small so we ignore clicks
|
|
|
|
|
* with thumbs at the bottom of the touchpad while the pointer
|
|
|
|
|
* moving finger is still on the pad */
|
2015-06-03 12:15:51 +10:00
|
|
|
|
2015-06-03 14:27:43 +10:00
|
|
|
x /= tp->device->abs.absinfo_x->resolution;
|
|
|
|
|
y /= tp->device->abs.absinfo_y->resolution;
|
|
|
|
|
|
|
|
|
|
return (x < 40 && y < 20) ? 1 : 0;
|
|
|
|
|
}
|
2015-06-03 12:15:51 +10:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-03 11:06:54 +10:00
|
|
|
static uint32_t
|
|
|
|
|
tp_clickfinger_set_button(struct tp_dispatch *tp)
|
|
|
|
|
{
|
|
|
|
|
uint32_t button;
|
2015-06-03 12:15:51 +10:00
|
|
|
unsigned int nfingers = tp->nfingers_down;
|
|
|
|
|
struct tp_touch *t;
|
|
|
|
|
struct tp_touch *first = NULL,
|
|
|
|
|
*second = NULL,
|
|
|
|
|
*third = NULL;
|
|
|
|
|
uint32_t close_touches = 0;
|
|
|
|
|
|
|
|
|
|
if (nfingers < 2 || nfingers > 3)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
/* two or three fingers down on the touchpad. Check for distance
|
|
|
|
|
* between the fingers. */
|
|
|
|
|
tp_for_each_touch(tp, t) {
|
|
|
|
|
if (t->state != TOUCH_BEGIN && t->state != TOUCH_UPDATE)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!first)
|
|
|
|
|
first = t;
|
|
|
|
|
else if (!second)
|
|
|
|
|
second = t;
|
|
|
|
|
else if (!third) {
|
|
|
|
|
third = t;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!first || !second) {
|
|
|
|
|
nfingers = 1;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close_touches |= tp_check_clickfinger_distance(tp, first, second) << 0;
|
|
|
|
|
close_touches |= tp_check_clickfinger_distance(tp, second, third) << 1;
|
|
|
|
|
close_touches |= tp_check_clickfinger_distance(tp, first, third) << 2;
|
|
|
|
|
|
|
|
|
|
switch(__builtin_popcount(close_touches)) {
|
|
|
|
|
case 0: nfingers = 1; break;
|
|
|
|
|
case 1: nfingers = 2; break;
|
|
|
|
|
default: nfingers = 3; break;
|
|
|
|
|
}
|
2015-06-03 11:06:54 +10:00
|
|
|
|
2015-06-03 12:15:51 +10:00
|
|
|
out:
|
|
|
|
|
switch (nfingers) {
|
2015-06-03 11:06:54 +10:00
|
|
|
case 0:
|
|
|
|
|
case 1: button = BTN_LEFT; break;
|
|
|
|
|
case 2: button = BTN_RIGHT; break;
|
|
|
|
|
case 3: button = BTN_MIDDLE; break;
|
|
|
|
|
default:
|
|
|
|
|
button = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return button;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 14:54:43 +01:00
|
|
|
static int
|
|
|
|
|
tp_notify_clickpadbutton(struct tp_dispatch *tp,
|
|
|
|
|
uint64_t time,
|
|
|
|
|
uint32_t button,
|
|
|
|
|
uint32_t is_topbutton,
|
|
|
|
|
enum libinput_button_state state)
|
2014-09-16 16:22:39 +02:00
|
|
|
{
|
|
|
|
|
/* If we've a trackpoint, send top buttons through the trackpoint */
|
|
|
|
|
if (is_topbutton && tp->buttons.trackpoint) {
|
|
|
|
|
struct evdev_dispatch *dispatch = tp->buttons.trackpoint->dispatch;
|
|
|
|
|
struct input_event event;
|
|
|
|
|
|
|
|
|
|
event.time.tv_sec = time/1000;
|
|
|
|
|
event.time.tv_usec = (time % 1000) * 1000;
|
|
|
|
|
event.type = EV_KEY;
|
|
|
|
|
event.code = button;
|
|
|
|
|
event.value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0;
|
2015-04-24 12:02:28 +10:00
|
|
|
dispatch->interface->process(dispatch,
|
|
|
|
|
tp->buttons.trackpoint,
|
|
|
|
|
&event,
|
|
|
|
|
time);
|
2015-01-14 14:54:43 +01:00
|
|
|
return 1;
|
2014-09-16 16:22:39 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-16 16:22:41 +02:00
|
|
|
/* Ignore button events not for the trackpoint while suspended */
|
|
|
|
|
if (tp->device->suspended)
|
2015-01-14 14:54:43 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If the user has requested clickfinger replace the button chosen
|
|
|
|
|
* by the softbutton code with one based on the number of fingers.
|
|
|
|
|
*/
|
|
|
|
|
if (tp->buttons.click_method == LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER &&
|
2015-04-24 12:02:28 +10:00
|
|
|
state == LIBINPUT_BUTTON_STATE_PRESSED) {
|
2015-06-03 11:06:54 +10:00
|
|
|
button = tp_clickfinger_set_button(tp);
|
2015-01-14 14:54:43 +01:00
|
|
|
tp->buttons.active = button;
|
|
|
|
|
|
|
|
|
|
if (!button)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2014-09-16 16:22:41 +02:00
|
|
|
|
2014-09-16 16:22:39 +02:00
|
|
|
evdev_pointer_notify_button(tp->device, time, button, state);
|
2015-01-14 14:54:43 +01:00
|
|
|
return 1;
|
2014-09-16 16:22:39 +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
|
|
|
static int
|
2015-01-14 14:54:43 +01:00
|
|
|
tp_post_clickpadbutton_buttons(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-09-16 16:22:39 +02:00
|
|
|
uint32_t current, old, button, is_top;
|
2014-06-03 20:08:02 -04:00
|
|
|
enum libinput_button_state state;
|
2014-05-27 15:08:35 +02:00
|
|
|
enum { AREA = 0x01, LEFT = 0x02, MIDDLE = 0x04, RIGHT = 0x08 };
|
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
|
|
|
|
|
|
|
|
current = tp->buttons.state;
|
|
|
|
|
old = tp->buttons.old_state;
|
2014-04-07 16:49:36 +02:00
|
|
|
button = 0;
|
2014-09-16 16:22:39 +02:00
|
|
|
is_top = 0;
|
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-07 16:49:36 +02:00
|
|
|
if (!tp->buttons.click_pending && current == old)
|
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
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (current) {
|
|
|
|
|
struct tp_touch *t;
|
2015-04-24 12:23:45 +10:00
|
|
|
uint32_t area = 0;
|
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
|
|
|
|
|
|
|
|
tp_for_each_touch(tp, t) {
|
2014-04-07 16:49:36 +02:00
|
|
|
switch (t->button.curr) {
|
|
|
|
|
case BUTTON_EVENT_IN_AREA:
|
2015-04-24 12:23:45 +10:00
|
|
|
area |= AREA;
|
2014-04-07 16:49:36 +02:00
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
2014-09-16 16:22:39 +02:00
|
|
|
is_top = 1;
|
2015-02-04 09:11:46 +10:00
|
|
|
/* fallthrough */
|
2014-09-16 16:22:39 +02:00
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
2015-04-24 12:23:45 +10:00
|
|
|
area |= LEFT;
|
2014-04-07 16:49:36 +02:00
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
2014-09-16 16:22:39 +02:00
|
|
|
is_top = 1;
|
2015-04-24 12:23:45 +10:00
|
|
|
area |= MIDDLE;
|
2014-05-27 15:08:35 +02:00
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
2014-09-16 16:22:39 +02:00
|
|
|
is_top = 1;
|
2015-02-04 09:11:46 +10:00
|
|
|
/* fallthrough */
|
2014-09-16 16:22:39 +02:00
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
2015-04-24 12:23:45 +10:00
|
|
|
area |= RIGHT;
|
2014-04-07 16:49:36 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2015-04-24 12:25:50 +10:00
|
|
|
if (area == 0 &&
|
|
|
|
|
tp->buttons.click_method != LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) {
|
2014-04-07 16:49:36 +02:00
|
|
|
/* No touches, wait for a touch before processing */
|
|
|
|
|
tp->buttons.click_pending = true;
|
|
|
|
|
return 0;
|
2014-05-27 15:08:35 +02:00
|
|
|
}
|
|
|
|
|
|
2015-04-24 12:23:45 +10:00
|
|
|
if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT)))
|
2014-09-23 14:35:42 +10:00
|
|
|
button = evdev_to_left_handed(tp->device, BTN_MIDDLE);
|
2015-04-24 12:23:45 +10:00
|
|
|
else if (area & RIGHT)
|
2014-09-23 14:35:42 +10:00
|
|
|
button = evdev_to_left_handed(tp->device, BTN_RIGHT);
|
2015-04-24 12:23:45 +10:00
|
|
|
else if (area & LEFT)
|
2014-09-23 14:35:42 +10:00
|
|
|
button = evdev_to_left_handed(tp->device, BTN_LEFT);
|
2015-04-24 12:25:50 +10:00
|
|
|
else /* main or no area (for clickfinger) is always BTN_LEFT */
|
2014-04-07 16:49:36 +02:00
|
|
|
button = BTN_LEFT;
|
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
|
|
|
|
|
|
|
|
tp->buttons.active = button;
|
2014-09-16 16:22:39 +02:00
|
|
|
tp->buttons.active_is_topbutton = is_top;
|
2014-06-03 20:08:02 -04:00
|
|
|
state = LIBINPUT_BUTTON_STATE_PRESSED;
|
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
|
|
|
} else {
|
|
|
|
|
button = tp->buttons.active;
|
2014-09-16 16:22:39 +02:00
|
|
|
is_top = tp->buttons.active_is_topbutton;
|
2014-04-07 16:49:36 +02:00
|
|
|
tp->buttons.active = 0;
|
2014-09-16 16:22:39 +02:00
|
|
|
tp->buttons.active_is_topbutton = 0;
|
2014-06-03 20:08:02 -04:00
|
|
|
state = LIBINPUT_BUTTON_STATE_RELEASED;
|
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-07 16:49:36 +02:00
|
|
|
tp->buttons.click_pending = false;
|
|
|
|
|
|
2014-09-16 16:22:39 +02:00
|
|
|
if (button)
|
2015-04-24 12:02:28 +10:00
|
|
|
return tp_notify_clickpadbutton(tp,
|
|
|
|
|
time,
|
|
|
|
|
button,
|
|
|
|
|
is_top,
|
|
|
|
|
state);
|
2015-01-14 14:54:43 +01:00
|
|
|
return 0;
|
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
|
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
|
|
|
{
|
2015-01-14 14:54:43 +01:00
|
|
|
if (tp->buttons.is_clickpad)
|
|
|
|
|
return tp_post_clickpadbutton_buttons(tp, time);
|
|
|
|
|
else
|
|
|
|
|
return tp_post_physical_buttons(tp, time);
|
2014-03-27 13:09:06 +10:00
|
|
|
}
|
2014-04-04 17:22:02 +02:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return t->button.state == BUTTON_STATE_AREA;
|
|
|
|
|
}
|
2014-07-10 17:34:08 +10:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
tp_button_is_inside_softbutton_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
2015-04-24 12:02:28 +10:00
|
|
|
return is_inside_top_button_area(tp, t) ||
|
|
|
|
|
is_inside_bottom_button_area(tp, t);
|
2014-07-10 17:34:08 +10:00
|
|
|
}
|