Re: [Linuxwacom-devel] [PATCH] isdv4: Use last-known event position in touch up events

2016-04-14 Thread Ping Cheng
On Thu, Apr 14, 2016 at 9:16 AM, Jason Gerecke  wrote:
> Old serial ISDv4 sensors that (still?!) use the driver-internal parsing
> routines can inadvertantly send (0,0) coordinates to X on touch up.
> Even if a sensor sends (0,0) as the touch up coordinate, the code in
> wcmTouchFilter.c should do the right thing by only sending motion
> eventions while the touch is down. This isn't the case when in-driver
> gestures are disabled though, since motion events (specifically XI_TouchEnd)
> will be sent for touch up events as well.
>
> To prevent potential (0,0) coordinates from being emitted on touch up
> while in-driver gestures are disabled, we use the last-known touch
> position as the current touch position. This mirrors what is done by
> the standard input kernel driver (which leaves X/Y at its last known
> position on touch up).

Sounds sensible to me.

>
> Fixes: https://sourceforge.net/p/linuxwacom/bugs/312/
>
> Signed-off-by: Jason Gerecke 

Reviewed-by: Ping Cheng 

Ping

> ---
>  src/wcmISDV4.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
> index 95001a1..8cc4483 100644
> --- a/src/wcmISDV4.c
> +++ b/src/wcmISDV4.c
> @@ -625,8 +625,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, 
> const unsigned char *data,
> return -1;
> }
>
> -   ds->x = touchdata.x;
> -   ds->y = touchdata.y;
> +   ds->x = touchdata.status ? touchdata.x : last->x;
> +   ds->y = touchdata.status ? touchdata.y : last->y;
> ds->proximity = touchdata.status;
> ds->device_type = TOUCH_ID;
> ds->device_id = TOUCH_DEVICE_ID;
> @@ -651,8 +651,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, 
> const unsigned char *data,
> channel = 1;
> ds = >wcmChannel[channel].work;
> RESET_RELATIVE(*ds);
> -   ds->x = touchdata.finger2.x;
> -   ds->y = touchdata.finger2.y;
> +   ds->x = touchdata.finger2.status ? 
> touchdata.finger2.x : lastTemp->x;
> +   ds->y = touchdata.finger2.status ? 
> touchdata.finger2.y : lastTemp->y;
> ds->device_type = TOUCH_ID;
> ds->device_id = TOUCH_DEVICE_ID;
> ds->serial_num = 2;
> --
> 2.8.0
>

--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] isdv4: Use last-known event position in touch up events

2016-04-14 Thread Jason Gerecke
Old serial ISDv4 sensors that (still?!) use the driver-internal parsing
routines can inadvertantly send (0,0) coordinates to X on touch up.
Even if a sensor sends (0,0) as the touch up coordinate, the code in
wcmTouchFilter.c should do the right thing by only sending motion
eventions while the touch is down. This isn't the case when in-driver
gestures are disabled though, since motion events (specifically XI_TouchEnd)
will be sent for touch up events as well.

To prevent potential (0,0) coordinates from being emitted on touch up
while in-driver gestures are disabled, we use the last-known touch
position as the current touch position. This mirrors what is done by
the standard input kernel driver (which leaves X/Y at its last known
position on touch up).

Fixes: https://sourceforge.net/p/linuxwacom/bugs/312/

Signed-off-by: Jason Gerecke 
---
 src/wcmISDV4.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 95001a1..8cc4483 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -625,8 +625,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const 
unsigned char *data,
return -1;
}
 
-   ds->x = touchdata.x;
-   ds->y = touchdata.y;
+   ds->x = touchdata.status ? touchdata.x : last->x;
+   ds->y = touchdata.status ? touchdata.y : last->y;
ds->proximity = touchdata.status;
ds->device_type = TOUCH_ID;
ds->device_id = TOUCH_DEVICE_ID;
@@ -651,8 +651,8 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, const 
unsigned char *data,
channel = 1;
ds = >wcmChannel[channel].work;
RESET_RELATIVE(*ds);
-   ds->x = touchdata.finger2.x;
-   ds->y = touchdata.finger2.y;
+   ds->x = touchdata.finger2.status ? touchdata.finger2.x 
: lastTemp->x;
+   ds->y = touchdata.finger2.status ? touchdata.finger2.y 
: lastTemp->y;
ds->device_type = TOUCH_ID;
ds->device_id = TOUCH_DEVICE_ID;
ds->serial_num = 2;
-- 
2.8.0


--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel