Re: [PATCH v2 libinput] touchpad: Route top softbuttons through the trackstick if we've one

2014-09-18 Thread Hans de Goede
Hi,

On 09/18/2014 05:17 AM, Peter Hutterer wrote:
 From: Hans de Goede hdego...@redhat.com
 
 The touchpad top softbuttons such as found on the Lenove T440 are intended for
 use with the trackstick. Route their events through the trackstick, so that
 they can be used for e.g. middle button scrolling with the trackstick.
 
 Note that sending top button events to a disabled trackpoint makes no sense
 (and will mess up internal state). Likely a user with a disabled trackpoint
 will still expect the top buttons to work, so rather than not sending events
 in that case, simply treat a suspendeded trackpoint as not being there, and
 send the events directly from the touchpad device.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com
 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
 Changes to v1:
 - rename is_top and active_is_top to *is_topbutton for better clarity
 - add timestamp to struct input_event generation 
 - replace two commas with semicolons (typos)
 - change active_is_topbutton to a bool (from unsigned int)
 
  doc/touchpad-softbutton-state-machine.svg | 198 
 +-
  src/evdev-mt-touchpad-buttons.c   |  47 +--
  src/evdev-mt-touchpad.c   |  17 ++-
  src/evdev-mt-touchpad.h   |   1 +
  4 files changed, 164 insertions(+), 99 deletions(-)
 
 diff --git a/doc/touchpad-softbutton-state-machine.svg 
 b/doc/touchpad-softbutton-state-machine.svg
 index 1d569bf..ffa17a2 100644
 --- a/doc/touchpad-softbutton-state-machine.svg
 +++ b/doc/touchpad-softbutton-state-machine.svg
 @@ -1,5 +1,5 @@
  ?xml version=1.0?
 -svg xmlns=http://www.w3.org/2000/svg; 
 xmlns:xlink=http://www.w3.org/1999/xlink; width=2190px height=1624px 
 version=1.1
 +svg xmlns=http://www.w3.org/2000/svg; 
 xmlns:xlink=http://www.w3.org/1999/xlink; width=2180px height=1624px 
 version=1.1
defs/
g transform=translate(0.5,0.5)
  path d=M 862 441 L 894 441 fill=none stroke=#00 
 stroke-miterlimit=10 pointer-events=none/
 @@ -68,13 +68,13 @@
  path d=M 712 441 L 668 441 Q 658 441 658 451 L 658 762 fill=none 
 stroke=#00 stroke-miterlimit=10 pointer-events=none/
  path d=M 786 62 L 786 81 Q 786 91 786 101 L 786 114 fill=none 
 stroke=#00 stroke-miterlimit=10 pointer-events=none/
  path d=M 786 120 L 783 113 L 786 114 L 790 113 Z fill=#00 
 stroke=#00 stroke-miterlimit=10 pointer-events=none/
 -rect x=1753 y=472 width=120 height=40 rx=16 ry=16 
 fill=#c0 stroke=#ff pointer-events=none/
 +rect x=1753 y=412 width=120 height=40 rx=16 ry=16 
 fill=#c0 stroke=#ff pointer-events=none/
  g fill=#00 font-family=Helvetica text-anchor=middle 
 font-size=12px
 -  text x=1813 y=489Check state of/text
 -  text x=1813 y=503all touches/text
 +  text x=1813 y=429Check state of/text
 +  text x=1813 y=443all touches/text
  /g
 -path d=M 1813 512 L 1813 518 Q 1813 524 1813 529 L 1813 534 
 fill=none stroke=#ff stroke-miterlimit=10 pointer-events=none/
 -path d=M 1809 526 L 1813 535 L 1818 526 fill=none stroke=#ff 
 stroke-miterlimit=10 pointer-events=none/
 +path d=M 1813 452 L 1813 458 Q 1813 465 1813 470 L 1813 475 
 fill=none stroke=#ff stroke-miterlimit=10 pointer-events=none/
 +path d=M 1809 467 L 1813 476 L 1818 467 fill=none stroke=#ff 
 stroke-miterlimit=10 pointer-events=none/
  ellipse cx=1813 cy=72 rx=11 ry=11 fill=#00 
 stroke=#ff pointer-events=none/
  path d=M 1813 87 L 1813 115 Q 1813 125 1813 135 L 1813 160 
 fill=none stroke=#ff stroke-miterlimit=10 pointer-events=none/
  path d=M 1809 152 L 1813 161 L 1818 152 fill=none stroke=#ff 
 stroke-miterlimit=10 pointer-events=none/
 @@ -82,88 +82,89 @@
  g fill=#00 font-family=Helvetica text-anchor=middle 
 font-size=12px
text x=1813 y=41tp_post_softbutton_buttons()/text
  /g
 -path d=M 1813 212 L 1908 267 L 1813 322 L 1718 267 Z fill=#c0 
 stroke=#ff stroke-miterlimit=10 pointer-events=none/
 +path d=M 1813 192 L 1908 247 L 1813 302 L 1718 247 Z fill=#c0 
 stroke=#ff stroke-miterlimit=10 pointer-events=none/
  g fill=#00 font-family=Helvetica text-anchor=middle 
 font-size=12px
 -  text x=1813 y=264!buttons.click_pend/text
 -  text x=1813 y=278amp;amp; current == old/text
 +  text x=1813 y=244!buttons.click_pend/text
 +  text x=1813 y=258amp;amp; current == old/text
  /g
 -path d=M 1908 267 L 1968 267 Q 1978 267 1988 267 L 2056 267 
 fill=none stroke=#ff stroke-miterlimit=10 pointer-events=none/
 -path d=M 2048 272 L 2057 267 L 2048 263 fill=none stroke=#ff 
 stroke-miterlimit=10 pointer-events=none/
 +path d=M 1908 247 L 1968 247 Q 1978 247 1988 247 L 2056 247 
 fill=none stroke=#ff stroke-miterlimit=10 pointer-events=none/
 +path d=M 2048 252 L 2057 247 L 2048 243 fill=none stroke=#ff 
 stroke-miterlimit=10 

[PATCH v2 libinput] touchpad: Route top softbuttons through the trackstick if we've one

2014-09-17 Thread Peter Hutterer
From: Hans de Goede hdego...@redhat.com

The touchpad top softbuttons such as found on the Lenove T440 are intended for
use with the trackstick. Route their events through the trackstick, so that
they can be used for e.g. middle button scrolling with the trackstick.

Note that sending top button events to a disabled trackpoint makes no sense
(and will mess up internal state). Likely a user with a disabled trackpoint
will still expect the top buttons to work, so rather than not sending events
in that case, simply treat a suspendeded trackpoint as not being there, and
send the events directly from the touchpad device.

Signed-off-by: Hans de Goede hdego...@redhat.com
Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
Changes to v1:
- rename is_top and active_is_top to *is_topbutton for better clarity
- add timestamp to struct input_event generation 
- replace two commas with semicolons (typos)
- change active_is_topbutton to a bool (from unsigned int)

 doc/touchpad-softbutton-state-machine.svg | 198 +-
 src/evdev-mt-touchpad-buttons.c   |  47 +--
 src/evdev-mt-touchpad.c   |  17 ++-
 src/evdev-mt-touchpad.h   |   1 +
 4 files changed, 164 insertions(+), 99 deletions(-)

diff --git a/doc/touchpad-softbutton-state-machine.svg 
b/doc/touchpad-softbutton-state-machine.svg
index 1d569bf..ffa17a2 100644
--- a/doc/touchpad-softbutton-state-machine.svg
+++ b/doc/touchpad-softbutton-state-machine.svg
@@ -1,5 +1,5 @@
 ?xml version=1.0?
-svg xmlns=http://www.w3.org/2000/svg; 
xmlns:xlink=http://www.w3.org/1999/xlink; width=2190px height=1624px 
version=1.1
+svg xmlns=http://www.w3.org/2000/svg; 
xmlns:xlink=http://www.w3.org/1999/xlink; width=2180px height=1624px 
version=1.1
   defs/
   g transform=translate(0.5,0.5)
 path d=M 862 441 L 894 441 fill=none stroke=#00 
stroke-miterlimit=10 pointer-events=none/
@@ -68,13 +68,13 @@
 path d=M 712 441 L 668 441 Q 658 441 658 451 L 658 762 fill=none 
stroke=#00 stroke-miterlimit=10 pointer-events=none/
 path d=M 786 62 L 786 81 Q 786 91 786 101 L 786 114 fill=none 
stroke=#00 stroke-miterlimit=10 pointer-events=none/
 path d=M 786 120 L 783 113 L 786 114 L 790 113 Z fill=#00 
stroke=#00 stroke-miterlimit=10 pointer-events=none/
-rect x=1753 y=472 width=120 height=40 rx=16 ry=16 
fill=#c0 stroke=#ff pointer-events=none/
+rect x=1753 y=412 width=120 height=40 rx=16 ry=16 
fill=#c0 stroke=#ff pointer-events=none/
 g fill=#00 font-family=Helvetica text-anchor=middle 
font-size=12px
-  text x=1813 y=489Check state of/text
-  text x=1813 y=503all touches/text
+  text x=1813 y=429Check state of/text
+  text x=1813 y=443all touches/text
 /g
-path d=M 1813 512 L 1813 518 Q 1813 524 1813 529 L 1813 534 fill=none 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
-path d=M 1809 526 L 1813 535 L 1818 526 fill=none stroke=#ff 
stroke-miterlimit=10 pointer-events=none/
+path d=M 1813 452 L 1813 458 Q 1813 465 1813 470 L 1813 475 fill=none 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
+path d=M 1809 467 L 1813 476 L 1818 467 fill=none stroke=#ff 
stroke-miterlimit=10 pointer-events=none/
 ellipse cx=1813 cy=72 rx=11 ry=11 fill=#00 stroke=#ff 
pointer-events=none/
 path d=M 1813 87 L 1813 115 Q 1813 125 1813 135 L 1813 160 fill=none 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
 path d=M 1809 152 L 1813 161 L 1818 152 fill=none stroke=#ff 
stroke-miterlimit=10 pointer-events=none/
@@ -82,88 +82,89 @@
 g fill=#00 font-family=Helvetica text-anchor=middle 
font-size=12px
   text x=1813 y=41tp_post_softbutton_buttons()/text
 /g
-path d=M 1813 212 L 1908 267 L 1813 322 L 1718 267 Z fill=#c0 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
+path d=M 1813 192 L 1908 247 L 1813 302 L 1718 247 Z fill=#c0 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
 g fill=#00 font-family=Helvetica text-anchor=middle 
font-size=12px
-  text x=1813 y=264!buttons.click_pend/text
-  text x=1813 y=278amp;amp; current == old/text
+  text x=1813 y=244!buttons.click_pend/text
+  text x=1813 y=258amp;amp; current == old/text
 /g
-path d=M 1908 267 L 1968 267 Q 1978 267 1988 267 L 2056 267 fill=none 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
-path d=M 2048 272 L 2057 267 L 2048 263 fill=none stroke=#ff 
stroke-miterlimit=10 pointer-events=none/
+path d=M 1908 247 L 1968 247 Q 1978 247 1988 247 L 2056 247 fill=none 
stroke=#ff stroke-miterlimit=10 pointer-events=none/
+path d=M 2048 252 L 2057 247 L 2048 243 fill=none stroke=#ff 
stroke-miterlimit=10 pointer-events=none/
 g fill=#00 font-family=Helvetica font-size=11px
-  rect fill=#ff stroke=none x=1998 y=252 width=18 
height=14