Re: [PATCH libinput 08/20] touchpad: Only enable clickfingers on Apple touchpads

2014-04-23 Thread Peter Hutterer
On Tue, Apr 15, 2014 at 04:00:41PM +0200, Hans de Goede wrote:
 Hi,
 
 On 04/15/2014 03:44 PM, Daniel Stone wrote:
  Hi,
  
  On 15 April 2014 13:28, Hans de Goede hdego...@redhat.com wrote:
  
  Apple touchpads don't have visible markings for the software button areas
  that almost all other vendors use. OS X provides clickfinger behaviour
  instead, where a click with two fingers on the touchpad generate a right
  button click. Use that same behaviour in libinput.
 
  For all other touchpads, use the software button areas introduced in a
  follow-up commit.
 
  
  Some of the early Samsung Chromebooks had an Apple-style setup: it would be
  good to expose this as a tuneable so it could be set through configuration.
 
 Agreed, but that will have to wait till we have some sort of config framework
 in place. Creating a config framework is on my / Peter's TODO (who ever gets
 around to it first).

Just for the archives, this will probably end up as an either/or behaviour.
Having software buttons and clickfinger behaviour makes the driver a lot
harder to get right.

Cheers,
   Peter

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 08/20] touchpad: Only enable clickfingers on Apple touchpads

2014-04-15 Thread Hans de Goede
From: Peter Hutterer peter.hutte...@who-t.net

Apple touchpads don't have visible markings for the software button areas
that almost all other vendors use. OS X provides clickfinger behaviour
instead, where a click with two fingers on the touchpad generate a right
button click. Use that same behaviour in libinput.

For all other touchpads, use the software button areas introduced in a
follow-up commit.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
Signed-off-by: Hans de Goede hdego...@redhat.com
---
 src/evdev-mt-touchpad-buttons.c |  7 ++-
 src/evdev-mt-touchpad.h |  1 +
 test/touchpad.c | 12 
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index c3c97b0..08783a3 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -60,6 +60,11 @@ tp_init_buttons(struct tp_dispatch *tp,
 
tp-buttons.motion_dist = diagonal * DEFAULT_BUTTON_MOTION_THRESHOLD;
 
+   if (libevdev_get_id_vendor(device-evdev) == 0x5ac) /* Apple */
+   tp-buttons.use_clickfinger = true;
+   else
+   tp-buttons.use_clickfinger = false;
+
return 0;
 }
 
@@ -142,7 +147,7 @@ tp_post_button_events(struct tp_dispatch *tp, uint32_t time)
 
if (tp-buttons.has_buttons)
rc = tp_post_physical_buttons(tp, time);
-   else
+   else if (tp-buttons.use_clickfinger)
rc = tp_post_clickfinger_buttons(tp, time);
 
return rc;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 85cf7e5..87d291a 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -129,6 +129,7 @@ struct tp_dispatch {
 
struct {
bool has_buttons;   /* true for physical LMR 
buttons */
+   bool use_clickfinger;   /* number of fingers decides 
button number */
uint32_t state;
uint32_t old_state;
uint32_t motion_dist;   /* for pinned touches */
diff --git a/test/touchpad.c b/test/touchpad.c
index f4d7839..bbae6cd 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -217,7 +217,7 @@ END_TEST
 
 START_TEST(touchpad_1fg_clickfinger)
 {
-   struct litest_device *dev = litest_current_device();
+   struct litest_device *dev = litest_create_device(LITEST_BCM5974);
struct libinput *li = dev-libinput;
struct libinput_event *event;
struct libinput_event_pointer *ptrev;
@@ -237,12 +237,14 @@ START_TEST(touchpad_1fg_clickfinger)
LIBINPUT_POINTER_BUTTON_STATE_PRESSED);
assert_button_event(li, BTN_LEFT,
LIBINPUT_POINTER_BUTTON_STATE_RELEASED);
+
+   litest_delete_device(dev);
 }
 END_TEST
 
 START_TEST(touchpad_2fg_clickfinger)
 {
-   struct litest_device *dev = litest_current_device();
+   struct litest_device *dev = litest_create_device(LITEST_BCM5974);
struct libinput *li = dev-libinput;
struct libinput_event *event;
struct libinput_event_pointer *ptrev;
@@ -264,6 +266,8 @@ START_TEST(touchpad_2fg_clickfinger)
LIBINPUT_POINTER_BUTTON_STATE_PRESSED);
assert_button_event(li, BTN_RIGHT,
LIBINPUT_POINTER_BUTTON_STATE_RELEASED);
+
+   litest_delete_device(dev);
 }
 END_TEST
 
@@ -362,8 +366,8 @@ int main(int argc, char **argv) {
litest_add(touchpad:tap, touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, 
LITEST_ANY);
litest_add(touchpad:tap, touchpad_2fg_tap, LITEST_TOUCHPAD, 
LITEST_SINGLE_TOUCH);
 
-   litest_add(touchpad:clickfinger, touchpad_1fg_clickfinger, 
LITEST_TOUCHPAD, LITEST_ANY);
-   litest_add(touchpad:clickfinger, touchpad_2fg_clickfinger, 
LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+   litest_add_no_device(touchpad:clickfinger, touchpad_1fg_clickfinger);
+   litest_add_no_device(touchpad:clickfinger, touchpad_2fg_clickfinger);
 
litest_add(touchpad:click, touchpad_btn_left, LITEST_TOUCHPAD, 
LITEST_CLICKPAD);
litest_add(touchpad:click, clickpad_btn_left, LITEST_CLICKPAD, 
LITEST_ANY);
-- 
1.9.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput 08/20] touchpad: Only enable clickfingers on Apple touchpads

2014-04-15 Thread Daniel Stone
Hi,

On 15 April 2014 13:28, Hans de Goede hdego...@redhat.com wrote:

 Apple touchpads don't have visible markings for the software button areas
 that almost all other vendors use. OS X provides clickfinger behaviour
 instead, where a click with two fingers on the touchpad generate a right
 button click. Use that same behaviour in libinput.

 For all other touchpads, use the software button areas introduced in a
 follow-up commit.


Some of the early Samsung Chromebooks had an Apple-style setup: it would be
good to expose this as a tuneable so it could be set through configuration.

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH libinput 08/20] touchpad: Only enable clickfingers on Apple touchpads

2014-04-15 Thread Hans de Goede
Hi,

On 04/15/2014 03:44 PM, Daniel Stone wrote:
 Hi,
 
 On 15 April 2014 13:28, Hans de Goede hdego...@redhat.com wrote:
 
 Apple touchpads don't have visible markings for the software button areas
 that almost all other vendors use. OS X provides clickfinger behaviour
 instead, where a click with two fingers on the touchpad generate a right
 button click. Use that same behaviour in libinput.

 For all other touchpads, use the software button areas introduced in a
 follow-up commit.

 
 Some of the early Samsung Chromebooks had an Apple-style setup: it would be
 good to expose this as a tuneable so it could be set through configuration.

Agreed, but that will have to wait till we have some sort of config framework
in place. Creating a config framework is on my / Peter's TODO (who ever gets
around to it first).

Regards,

Hans
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel