Re: [Linuxwacom-devel] [PATCH 2/3] Add IsPen to cover both IsStylus and IsEraser

2011-03-30 Thread Peter Hutterer
On Wed, Mar 30, 2011 at 04:24:43PM -0700, Ping Cheng wrote:
> It will be used more often when we need to compare touch events
> with pen events.
> 
> Signed-off-by: Ping Cheng 
> ---
>  src/wcmCommon.c |2 +-
>  src/xf86WacomDefs.h |2 ++
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index 106b741..a370389 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -1164,7 +1164,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
> unsigned int channel,
>   }
>   }
>  
> - if (IsStylus(priv) || IsEraser(priv))
> + if (IsPen(priv))
>   {
>   priv->minPressure = rebasePressure(priv, &filtered);
>   filtered.pressure = normalizePressure(priv, &filtered);
> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> index 7740820..43348fc 100644
> --- a/src/xf86WacomDefs.h
> +++ b/src/xf86WacomDefs.h
> @@ -184,6 +184,8 @@ struct _WacomModel
>  #define IsTouch(priv)  (DEVICE_ID((priv)->flags) == TOUCH_ID)
>  #define IsEraser(priv) (DEVICE_ID((priv)->flags) == ERASER_ID)
>  #define IsPad(priv)(DEVICE_ID((priv)->flags) == PAD_ID)
> +#define IsPen(priv)((DEVICE_ID((priv)->flags) == STYLUS_ID) || \
> + (DEVICE_ID((priv)->flags) == ERASER_ID))

this should probably use IsStylus() || IsEraser() instead of duplicating
the check

Cheers,
  Peter
>  
>  #define IsUSBDevice(common) ((common)->wcmDevCls == &gWacomUSBDevice)
>  
> -- 
> 1.7.4
> 

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 2/3] Add IsPen to cover both IsStylus and IsEraser

2011-03-30 Thread Ping Cheng
It will be used more often when we need to compare touch events
with pen events.

Signed-off-by: Ping Cheng 
---
 src/wcmCommon.c |2 +-
 src/xf86WacomDefs.h |2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 106b741..a370389 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1164,7 +1164,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
}
}
 
-   if (IsStylus(priv) || IsEraser(priv))
+   if (IsPen(priv))
{
priv->minPressure = rebasePressure(priv, &filtered);
filtered.pressure = normalizePressure(priv, &filtered);
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 7740820..43348fc 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -184,6 +184,8 @@ struct _WacomModel
 #define IsTouch(priv)  (DEVICE_ID((priv)->flags) == TOUCH_ID)
 #define IsEraser(priv) (DEVICE_ID((priv)->flags) == ERASER_ID)
 #define IsPad(priv)(DEVICE_ID((priv)->flags) == PAD_ID)
+#define IsPen(priv)((DEVICE_ID((priv)->flags) == STYLUS_ID) || \
+   (DEVICE_ID((priv)->flags) == ERASER_ID))
 
 #define IsUSBDevice(common) ((common)->wcmDevCls == &gWacomUSBDevice)
 
-- 
1.7.4


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel