On Fri, Dec 18, 2009 at 09:26:11PM -0800, Ping wrote: > Ok, another try by following the property principle. Comments are added > into the patch without repeating them in the commit message. Feel free to > change them the way that works for you.
> From 4147814f913be47c34481c1c993bb5c486d5f914 Mon Sep 17 00:00:00 2001 > From: Ping Cheng <[email protected]> > Date: Fri, 18 Dec 2009 16:12:25 -0800 > Subject: [PATCH] Fix tablet area property check issue > > Signed-off-by: Ping Cheng <[email protected]> > --- > src/wcmXCommand.c | 53 > ++++++++++++++++++++++++++++------------------------- > 1 files changed, 28 insertions(+), 25 deletions(-) > > diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c > index 563a42d..b8bbda9 100644 > --- a/src/wcmXCommand.c > +++ b/src/wcmXCommand.c > @@ -306,46 +306,49 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, > XIPropertyValuePtr prop, > if (property == prop_tablet_area) > { > INT32 *values = (INT32*)prop->data; > - WacomToolArea area; > + WacomToolAreaPtr area = priv->toolarea; > + WacomToolArea tmpArea; > > 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]; > + /* value validation is unnecessary since we let utility programs, > such as > + * xsetwacom and userland control panel take care of the validation > role. > + * when all four values are set to -1, it is an area reset > (xydefault) */ > + if ((values[0] != -1) || (values[1] != -1) || > + (values[2] != -1) || (values[3] != -1)) > + { > + tmpArea.topX = values[0]; > + tmpArea.topY = values[1]; > + tmpArea.bottomX = values[2]; > + tmpArea.bottomY = values[3]; > > - /* FIXME: this will always be the case? */ > - if (WcmAreaListOverlap(&area, priv->tool->arealist)) > - return BadValue; > + /* validate the area */ > + if (WcmAreaListOverlap(&tmpArea, priv->tool->arealist)) > + return BadValue; > + } doesn't this do exactly the same as before, except that what was "area" before is not "tmpArea"? it still compares the new area with the already existing one and it still always detects an overlap and fails. we need something like: tmp_arealist = duplicate(priv->tool->arealist) tmp_arealist.remove(priv->toolarea) tmp_area = values[0], values[1], values[2], values[3] WcmAreaListOverlap(tmp_area, tmp_arealist) if that passes, then the new area doesn't overlap with an existing one. is there a link between the entry in priv->tool->arealist and priv->toolarea? can we somehow figure out which one is which or do we need to compare all four coordinates? Cheers, Peter ------------------------------------------------------------------------------ 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
