Commit 6e60db9b950e1e5379574a0d54b2a4ae64a5fbbb

Touch Devices: just move the cursor for quick swipes, drag if still for 200ms

This patch comes from Ubuntu Forums Bamboo Pen and Touch development thread
and prettifies the behavior when using the tablet in Touch mode.

Applied wcmCommon.c.patch wcmConfig.c.patch xf86WacomDefs.h.patch -r34
as found on UbuntuForums.

Signed-off-by: Enrico Ros <enrico.ros@gmail.com>
  
11911191 }
11921192 }
11931193
1194 if (ds.device_type == TOUCH_ID) {
1195 WacomDeviceState* pds = &common->wcmTouchpadState;
1196 WacomDevicePtr priv = common->wcmDevices;
1197
1198 if (ds.proximity)
1199 switch (common->wcmTouchpadMode) {
1200 case 0:
1201 common->wcmTouchpadMode = 1;
1202 common->wcmTouchpadState = ds;
1203 common->wcmTouchpadState.sample = (int)GetTimeInMillis();
1204 break;
1205 case 1:
1206 if (GetTimeInMillis() - pds->sample <= 200) {
1207 int xd = ds.x - pds->x;
1208 int yd = ds.y - pds->y;
1209
1210 if (xd*xd + yd*yd > 10*10)
1211 common->wcmTouchpadMode = 2;
1212 } else {
1213 /* left button down */
1214 xf86PostButtonEvent(priv->local->dev,
1215 priv->flags & ABSOLUTE_FLAG,
1216 1,1,0,priv->naxes, priv->oldX,
1217 priv->oldY,0,0,0,0);
1218 common->wcmTouchpadMode = 3;
1219 }
1220 break;
1221 }
1222 else {
1223 switch (common->wcmTouchpadMode) {
1224 case 1:
1225 if (GetTimeInMillis() - pds->sample <= 200) {
1226 /* left button down */
1227 xf86PostButtonEvent(priv->local->dev,
1228 priv->flags & ABSOLUTE_FLAG,
1229 1,1,0,priv->naxes, priv->oldX,
1230 priv->oldY,0,0,0,0);
1231 /* left button up */
1232 xf86PostButtonEvent(priv->local->dev,
1233 priv->flags & ABSOLUTE_FLAG,
1234 1,0,0,priv->naxes, priv->oldX,
1235 priv->oldY,0,0,0,0);
1236 }
1237 break;
1238 case 3:
1239 /* left button up */
1240 xf86PostButtonEvent(priv->local->dev,
1241 priv->flags & ABSOLUTE_FLAG,
1242 1,0,0,priv->naxes, priv->oldX,
1243 priv->oldY,0,0,0,0);
1244 }
1245 common->wcmTouchpadMode = 0;
1246 }
1247 if (common->wcmTouchpadMode == 1 || common->wcmTouchpadMode == 2)
1248 ds.buttons &= ~1;
1249 }
1250
1251
11941252 /* JEJ - Do not move this code without discussing it with me.
11951253 * The device state is invariant of any filtering performed below.
11961254 * Changing the device state after this point can and will cause
  
134134 common->wcmDevCls = &gWacomUSBDevice; /* device-specific functions */
135135 common->wcmTPCButton =
136136 common->wcmTPCButtonDefault; /* set Tablet PC button on/off */
137 common->wcmTouchpadMode = 0; /* default to disable when touchpad isn't supported */
137138 common->wcmCapacity = -1; /* Capacity is disabled */
138139 common->wcmCapacityDefault = -1; /* default to -1 when capacity isn't supported */
139140 /* 3 when capacity is supported */
  
431431 int wcmGestureDefault; /* default touch gesture to disable when not supported */
432432 int wcmGestureMode; /* data is in Gesture Mode? */
433433 WacomDeviceState wcmGestureState[MAX_FINGERS]; /* inital state when in gesture mode */
434 int wcmTouchpadMode; /* state when in touchpad mode */
435 WacomDeviceState wcmTouchpadState; /* inital state when entering touchpad mode */
434436 int wcmCapacity; /* disable/enable capacity */
435437 int wcmCapacityDefault; /* default to -1 when capacity isn't supported/disabled */
436438 /* 3 when capacity is supported */