Supports AC_PRESSUREHOLD by adding a 'holdPressure' variable to
the '_WacomDeviceRec' struct. When non-negative, the value of
this variable will be used in place of pressure being reported
by the hardware.
---
 src/wcmCommon.c     |   11 +++++++++++
 src/xf86Wacom.c     |    1 +
 src/xf86WacomDefs.h |    6 ++++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 95dbb90..0689abc 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -203,6 +203,7 @@ static void sendAction(InputInfoPtr pInfo, int press,
                       unsigned int *keys, int nkeys,
                       int first_val, int num_val, int *valuators)
 {
+       WacomDevicePtr priv = (WacomDevicePtr) pInfo->private;
        int i;
 
        /* Actions only trigger on press, not release */
@@ -237,6 +238,10 @@ static void sendAction(InputInfoPtr pInfo, int press,
                                        wcmDevSwitchModeCall(pInfo,
                                                        (is_absolute(pInfo)) ? 
Relative : Absolute); /* not a typo! */
                                break;
+                       case AC_PRESSUREHOLD:
+                               DBG(4, priv, "Pressure hold ENABLED at p=%d", 
priv->oldZ);
+                               priv->holdPressure = priv->oldZ;
+                               break;
                }
        }
 
@@ -273,6 +278,10 @@ static void sendAction(InputInfoPtr pInfo, int press,
                                        if (countPresses(key_code, &keys[i], 
nkeys - i))
                                                wcmEmitKeycode(pInfo->dev, 
key_code, 0);
                                }
+                       case AC_PRESSUREHOLD:
+                               DBG(4, priv, "Pressure hold DISABLED");
+                               priv->holdPressure = -1;
+                               break;
                }
 
        }
@@ -1174,6 +1183,8 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
                if (IsPen(priv))
                        filtered.buttons = setPressureButton(priv, &filtered);
                filtered.pressure = applyPressureCurve(priv,&filtered);
+               if (priv->holdPressure >= 0)
+                       filtered.pressure = priv->holdPressure;
                if (IsPen(priv))
                        common->wcmPenInProx = filtered.proximity;
        }
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 16561b5..8090e8d 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -436,6 +436,7 @@ static int wcmDevInit(DeviceIntPtr pWcm)
        {
                wcmInitialToolSize(pInfo);
                wcmMappingFactor(pInfo);
+               priv->holdPressure = -1;
        }
 
        if (!wcmInitAxes(pWcm))
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 94eee2e..9980202 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -320,6 +320,12 @@ struct _WacomDeviceRec
        Atom strip_actions[4];
 
        OsTimerPtr serial_timer; /* timer used for serial number property 
update */
+
+       /* If negative, pressure hold is disabled and the driver will report
+        * actual HW pressure. Otherwise, pressure hold is enabled and the
+        * value contained is used in lieu of HW pressure.
+        */
+       int holdPressure;
 };
 
 /******************************************************************************
-- 
1.7.5.2


------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to