2014-03-27 13:09:06 +10:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2014 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
|
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software
|
|
|
|
|
* without specific, written prior permission. The copyright holders make
|
|
|
|
|
* no representations about the suitability of this software for any
|
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
|
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_BUTTON_MOTION_THRESHOLD 0.02 /* 2% of size */
|
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);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_BOTTOM_NEW);
|
|
|
|
|
CASE_RETURN_STRING(BUTTON_STATE_BOTTOM_TO_AREA);
|
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
|
|
|
{
|
2014-05-27 15:17:26 +02:00
|
|
|
return t->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) &&
|
|
|
|
|
t->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)
|
|
|
|
|
{
|
|
|
|
|
return t->y <= tp->buttons.top_area.bottom_edge;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_right_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return is_inside_top_button_area(tp, t) &&
|
|
|
|
|
t->x > tp->buttons.top_area.rightbutton_left_edge;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_left_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return is_inside_top_button_area(tp, t) &&
|
|
|
|
|
t->x < tp->buttons.top_area.leftbutton_right_edge;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
is_inside_top_middle_area(struct tp_dispatch *tp, struct tp_touch *t)
|
|
|
|
|
{
|
|
|
|
|
return is_inside_top_button_area(tp, t) &&
|
|
|
|
|
t->x >= tp->buttons.top_area.leftbutton_right_edge &&
|
|
|
|
|
t->x <= tp->buttons.top_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 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
|
|
|
|
|
tp_button_set_state(struct tp_dispatch *tp, struct tp_touch *t,
|
|
|
|
|
enum button_state new_state, enum button_event event)
|
|
|
|
|
{
|
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;
|
|
|
|
|
switch (t->button.state) {
|
|
|
|
|
case BUTTON_STATE_NONE:
|
|
|
|
|
t->button.curr = 0;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_AREA:
|
|
|
|
|
t->button.curr = BUTTON_EVENT_IN_AREA;
|
2014-04-04 17:22:02 +02:00
|
|
|
tp_set_pointer(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
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_BOTTOM:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_BOTTOM_NEW:
|
|
|
|
|
t->button.curr = event;
|
|
|
|
|
tp_button_set_enter_timer(tp, t);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_BOTTOM_TO_AREA:
|
|
|
|
|
tp_button_set_leave_timer(tp, t);
|
|
|
|
|
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:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM_NEW, 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:
|
|
|
|
|
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,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
|
|
|
|
{
|
|
|
|
|
switch (event) {
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
|
|
|
|
if (event != t->button.curr)
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM_NEW,
|
|
|
|
|
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:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM_TO_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_bottom_new_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:
|
|
|
|
|
if (event != t->button.curr)
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM_NEW,
|
|
|
|
|
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:
|
|
|
|
|
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_BOTTOM, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_RELEASE:
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_TIMEOUT:
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM, event);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tp_button_bottom_to_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:
|
|
|
|
|
if (event == t->button.curr)
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM,
|
|
|
|
|
event);
|
|
|
|
|
else
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM_NEW,
|
|
|
|
|
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:
|
|
|
|
|
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_AREA, event);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-27 15:08:35 +02:00
|
|
|
static void
|
|
|
|
|
tp_button_top_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:
|
|
|
|
|
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)
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP_NEW,
|
|
|
|
|
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,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP_NEW,
|
|
|
|
|
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,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP,
|
|
|
|
|
event);
|
|
|
|
|
else
|
|
|
|
|
tp_button_set_state(tp, t, BUTTON_STATE_TOP_NEW,
|
|
|
|
|
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,
|
|
|
|
|
struct tp_touch *t,
|
|
|
|
|
enum button_event event)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
case BUTTON_STATE_BOTTOM_NEW:
|
|
|
|
|
tp_button_bottom_new_handle_event(tp, t, event);
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_STATE_BOTTOM_TO_AREA:
|
|
|
|
|
tp_button_bottom_to_area_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)
|
|
|
|
|
log_debug("button state: from %s, event %s to %s\n",
|
|
|
|
|
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) {
|
2014-05-27 15:17:26 +02:00
|
|
|
if (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
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_IN_BOTTOM_R, time);
|
2014-05-27 15:17:26 +02:00
|
|
|
else if (is_inside_bottom_left_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
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_IN_BOTTOM_L, time);
|
2014-05-27 15:08:35 +02:00
|
|
|
else if (is_inside_top_right_area(tp, t))
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_IN_TOP_R, time);
|
|
|
|
|
else if (is_inside_top_middle_area(tp, t))
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_IN_TOP_M, time);
|
|
|
|
|
else if (is_inside_top_left_area(tp, t))
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_IN_TOP_L, 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
|
|
|
else
|
|
|
|
|
tp_button_handle_event(tp, t, BUTTON_EVENT_IN_AREA, time);
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
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-05-21 14:36:01 +10:00
|
|
|
log_bug_kernel("received %s button event on a clickpad\n",
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
tp_init_buttons(struct tp_dispatch *tp,
|
|
|
|
|
struct evdev_device *device)
|
|
|
|
|
{
|
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-05-21 14:36:01 +10:00
|
|
|
log_bug_kernel("clickpad advertising right button\n");
|
2014-04-07 13:44:07 +02:00
|
|
|
} else {
|
|
|
|
|
if (!tp->buttons.is_clickpad)
|
2014-05-21 14:36:01 +10:00
|
|
|
log_bug_kernel("non clickpad without right button?\n");
|
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;
|
|
|
|
|
|
|
|
|
|
width = abs(absinfo_x->maximum - absinfo_x->minimum);
|
|
|
|
|
height = abs(absinfo_y->maximum - absinfo_y->minimum);
|
2014-03-27 13:09:06 +10:00
|
|
|
diagonal = sqrt(width*width + height*height);
|
|
|
|
|
|
|
|
|
|
tp->buttons.motion_dist = diagonal * DEFAULT_BUTTON_MOTION_THRESHOLD;
|
|
|
|
|
|
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 (libevdev_get_id_vendor(device->evdev) == 0x5ac) /* Apple */
|
|
|
|
|
tp->buttons.use_clickfinger = true;
|
|
|
|
|
|
2014-04-07 13:44:07 +02:00
|
|
|
if (tp->buttons.is_clickpad && !tp->buttons.use_clickfinger) {
|
2014-06-19 11:11:36 +10:00
|
|
|
int xoffset = absinfo_x->minimum,
|
|
|
|
|
yoffset = absinfo_y->minimum;
|
|
|
|
|
tp->buttons.bottom_area.top_edge = height * .8 + yoffset;
|
|
|
|
|
tp->buttons.bottom_area.rightbutton_left_edge = width/2 + xoffset;
|
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
|
|
|
if (tp->buttons.has_topbuttons) {
|
2014-06-19 11:11:36 +10:00
|
|
|
tp->buttons.top_area.bottom_edge = height * .08 + yoffset;
|
|
|
|
|
tp->buttons.top_area.rightbutton_left_edge = width * .58 + xoffset;
|
|
|
|
|
tp->buttons.top_area.leftbutton_right_edge = width * .42 + xoffset;
|
2014-05-27 15:08:35 +02:00
|
|
|
} else {
|
|
|
|
|
tp->buttons.top_area.bottom_edge = INT_MIN;
|
|
|
|
|
}
|
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 {
|
2014-05-27 15:17:26 +02:00
|
|
|
tp->buttons.bottom_area.top_edge = INT_MAX;
|
2014-05-27 15:08:35 +02:00
|
|
|
tp->buttons.top_area.bottom_edge = INT_MIN;
|
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_for_each_touch(tp, t) {
|
|
|
|
|
t->button.state = BUTTON_STATE_NONE;
|
|
|
|
|
libinput_timer_init(&t->button.timer,
|
|
|
|
|
tp->device->base.seat->libinput,
|
|
|
|
|
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
|
|
|
|
|
tp_destroy_buttons(struct tp_dispatch *tp)
|
|
|
|
|
{
|
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_clickfinger_buttons(struct tp_dispatch *tp, uint64_t time)
|
2014-03-27 13:09:06 +10:00
|
|
|
{
|
|
|
|
|
uint32_t current, old, button;
|
2014-06-03 20:08:02 -04:00
|
|
|
enum libinput_button_state state;
|
2014-03-27 13:09:06 +10:00
|
|
|
|
|
|
|
|
current = tp->buttons.state;
|
|
|
|
|
old = tp->buttons.old_state;
|
|
|
|
|
|
|
|
|
|
if (current == old)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2014-03-27 15:51:12 +10:00
|
|
|
if (current) {
|
|
|
|
|
switch (tp->nfingers_down) {
|
2014-03-27 13:09:06 +10:00
|
|
|
case 1: button = BTN_LEFT; break;
|
|
|
|
|
case 2: button = BTN_RIGHT; break;
|
|
|
|
|
case 3: button = BTN_MIDDLE; break;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
2014-03-27 15:51:12 +10:00
|
|
|
}
|
|
|
|
|
tp->buttons.active = button;
|
2014-06-03 20:08:02 -04:00
|
|
|
state = LIBINPUT_BUTTON_STATE_PRESSED;
|
2014-03-27 15:51:12 +10:00
|
|
|
} else {
|
|
|
|
|
button = tp->buttons.active;
|
|
|
|
|
tp->buttons.active = 0;
|
2014-06-03 20:08:02 -04:00
|
|
|
state = LIBINPUT_BUTTON_STATE_RELEASED;
|
2014-03-27 15:51:12 +10:00
|
|
|
}
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2014-03-27 15:51:12 +10:00
|
|
|
if (button)
|
|
|
|
|
pointer_notify_button(&tp->device->base,
|
|
|
|
|
time,
|
|
|
|
|
button,
|
|
|
|
|
state);
|
2014-03-27 13:09:06 +10:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)) {
|
|
|
|
|
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
|
|
|
|
|
|
|
|
pointer_notify_button(&tp->device->base,
|
|
|
|
|
time,
|
|
|
|
|
button,
|
|
|
|
|
state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
button++;
|
|
|
|
|
current >>= 1;
|
|
|
|
|
old >>= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
static int
|
2014-04-08 12:29:45 +02:00
|
|
|
tp_post_softbutton_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
|
|
|
{
|
|
|
|
|
uint32_t current, old, button;
|
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;
|
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;
|
|
|
|
|
|
|
|
|
|
tp_for_each_touch(tp, t) {
|
2014-04-07 16:49:36 +02:00
|
|
|
switch (t->button.curr) {
|
|
|
|
|
case BUTTON_EVENT_IN_AREA:
|
|
|
|
|
button |= AREA;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_EVENT_IN_BOTTOM_L:
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_L:
|
2014-04-07 16:49:36 +02:00
|
|
|
button |= LEFT;
|
|
|
|
|
break;
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_M:
|
|
|
|
|
button |= MIDDLE;
|
|
|
|
|
break;
|
2014-04-07 16:49:36 +02:00
|
|
|
case BUTTON_EVENT_IN_BOTTOM_R:
|
2014-05-27 15:08:35 +02:00
|
|
|
case BUTTON_EVENT_IN_TOP_R:
|
2014-04-07 16:49:36 +02:00
|
|
|
button |= RIGHT;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2014-05-27 15:08:35 +02:00
|
|
|
if (button == 0) {
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((button & MIDDLE) || ((button & LEFT) && (button & RIGHT)))
|
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 = BTN_MIDDLE;
|
2014-05-27 15:08:35 +02:00
|
|
|
else if (button & RIGHT)
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
else
|
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-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-04-07 16:49:36 +02:00
|
|
|
tp->buttons.active = 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;
|
|
|
|
|
|
|
|
|
|
if (button)
|
|
|
|
|
pointer_notify_button(&tp->device->base,
|
|
|
|
|
time,
|
|
|
|
|
button,
|
|
|
|
|
state);
|
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 1;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
2014-04-07 13:44:07 +02:00
|
|
|
if (tp->buttons.is_clickpad) {
|
|
|
|
|
if (tp->buttons.use_clickfinger)
|
|
|
|
|
return tp_post_clickfinger_buttons(tp, time);
|
|
|
|
|
else
|
|
|
|
|
return tp_post_softbutton_buttons(tp, time);
|
|
|
|
|
}
|
2014-03-27 13:09:06 +10:00
|
|
|
|
2014-04-07 13:44:07 +02:00
|
|
|
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;
|
|
|
|
|
}
|