Hi Peter,

Hope you didn't use the suggestion I made earlier.  Attached is the patch
that fixes the issue properly.

I added a few comments in the code and hopefully they made it clear for what
I did.  Feel free to add  commit comments as you see appropriate.  Or shout
back if you need more details.

Ping

P.S. any progress in resolving the wcmTouch set to 0 after resume issue?

On Mon, Dec 14, 2009 at 12:51 PM, Ping <[email protected]> wrote:

> On Sun, Dec 13, 2009 at 10:57 PM, Peter Hutterer <[email protected]
> > wrote:
>
>> This check would cause setting of the property to fail since -
>> especially if only one coordinate is modified - overlap was virtually
>> guaranteed to happen.
>>
>
> Then,  WcmPointInArea should be changed from
>
>     if (area->topX <= x && x <= area->bottomX &&
>         area->topY <= y && y <= area->bottomY)
> To
>
>     if (area->topX < x && x < area->bottomX &&
>         area->topY < y && y < area->bottomY)
>
> Some thing else may need to be updated with this change.  But, this should
> fix the overlap issue.  You can apply this change.  I will look into the
> other possible changes once I get there.  Area is a low priority issue for
> our current work, I think.
>
>
>> Each tool only has a single area, so this check doesn't seem necessary.
>>
>
> We are not verifying the area that is associated with the tool we are
> using.  We are verifying the other areas in the list.  WcmAreaListOverlap
> has this line:
>
>         if (area != list && WcmAreasOverlap(list, area))
>
> Ping
>
>
>>
>> Signed-off-by: Peter Hutterer <[email protected]>
>> ---
>> If I understand this correctly, priv->tool->arealist is this tool's area,
>> so
>> the check for the area overlap is superfluous here (especially since it
>> always produces overlaps).
>>
>>  src/wcmXCommand.c |    4 ----
>>  1 files changed, 0 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
>> index 23402c3..4dd4be1 100644
>> --- a/src/wcmXCommand.c
>> +++ b/src/wcmXCommand.c
>> @@ -317,10 +317,6 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom
>> property, XIPropertyValuePtr prop,
>>         area.bottomX = values[2];
>>         area.bottomY = values[3];
>>
>> -       /* FIXME: this will always be the case? */
>> -        if (WcmAreaListOverlap(&area, priv->tool->arealist))
>> -            return BadValue;
>> -
>>         if (!checkonly)
>>         {
>>             /* Invalid range resets axis to defaults */
>> --
>> 1.6.5.2
>>
>>
>
From c6cd83e7197e952dfa6fbe5623e9d2a8c682b26a Mon Sep 17 00:00:00 2001
From: Ping Cheng <[email protected]>
Date: Thu, 17 Dec 2009 16:41:22 -0800
Subject: [PATCH] Fix tablet area property check issue

Signed-off-by: Ping Cheng <[email protected]>
---
 src/wcmXCommand.c |   42 ++++++++++++++++--------------------------
 1 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 2ac7eed..a427ad0 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -307,46 +307,36 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
     if (property == prop_tablet_area)
     {
         INT32 *values = (INT32*)prop->data;
-        WacomToolArea area;
+        WacomToolAreaPtr area = priv->toolarea;
 
         if (prop->size != 4 || prop->format != 32)
             return BadValue;
 
-        area.topX = values[0];
-        area.topY = values[1];
-        area.bottomX = values[2];
-        area.bottomY = values[3];
-
-	/* FIXME: this will always be the case? */
-        if (WcmAreaListOverlap(&area, priv->tool->arealist))
-            return BadValue;
-
         if (!checkonly)
         {
-            /* Invalid range resets axis to defaults */
-            if (values[0] >= values[2])
-            {
-                values[0] = 0;
-		if (!IsTouch(priv))
-	            values[2] = common->wcmMaxX;
-		else
-	            values[2] = common->wcmMaxTouchX;
-            }
+            /* validate the values first */
+             if ((values[0] >= values[2]) || (values[1] >= values[3]))
+                return BadValue;
 
-            if (values[1] >= values[3])
+            area->topX = values[0];
+            area->topY = values[1];
+            area->bottomX = values[2];
+            area->bottomY = values[3];
+
+            if (WcmAreaListOverlap(area, priv->tool->arealist))
             {
-                values[1] = 0;
-		if (!IsTouch(priv))
-	            values[3] = common->wcmMaxY;
-		else
-	            values[3] = common->wcmMaxTouchY;
+                /* reset area back to the original values */
+                area->topX = priv->topX;
+                area->topY = priv->topY;
+                area->bottomX = priv->bottomX;
+                area->bottomY = priv->bottomY;
+                return BadValue;
             }
 
             priv->topX = values[0];
             priv->topY = values[1];
             priv->bottomX = values[2];
             priv->bottomY = values[3];
-            xf86WcmMappingFactor(local);
             xf86WcmInitialCoordinates(local, 0);
             xf86WcmInitialCoordinates(local, 1);
         }
-- 
1.6.5.2

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to