summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2011-12-21 09:30:22 -0800
committerJason Gerecke <killertofu@gmail.com>2011-12-29 11:23:45 -0800
commit7e3b2b9223629119472469569a2e23150e5c0c68 (patch)
tree0785fd335572d9cd43dfbd2f52d489869c1df6c1 /src
parentced9465599434c68fa40210aa890970386a08b84 (diff)
Have the second touch ring emulate wheel events by default
Touch strips as well as the first touch ring are set up to emulate mouse wheel events by default. This patch duplicates this behavior for the second touch ring, so that it behaves in an identical manner. Signed-off-by: Jason Gerecke <killertofu@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/wcmCommon.c14
-rw-r--r--src/wcmConfig.c2
-rw-r--r--src/wcmValidateDevice.c4
-rw-r--r--src/wcmXCommand.c19
-rw-r--r--src/xf86WacomDefs.h8
5 files changed, 36 insertions, 11 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 32eb4e4..885b6b9 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -470,6 +470,16 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
priv->wheel_keys[2+1], priv->wheel_keys[3+1], &fakeKey);
sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators);
}
+
+ /* emulate events for right touch ring */
+ delta = getScrollDelta(ds->abswheel2, priv->oldWheel2, MAX_PAD_RING, AXIS_INVERT);
+ if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
+ {
+ DBG(10, priv, "Right touch wheel scroll delta = %d\n", delta);
+ fakeButton = getWheelButton(delta, priv->wheel2up, priv->wheel2dn,
+ priv->wheel_keys[4+1], priv->wheel_keys[5+1], &fakeKey);
+ sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators);
+ }
}
/*****************************************************************************
@@ -488,7 +498,7 @@ static void sendCommonEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
wcmSendButtons(pInfo,buttons, first_val, num_vals, valuators);
/* emulate wheel/strip events when defined */
- if ( ds->relwheel || (ds->abswheel != priv->oldWheel) ||
+ if ( ds->relwheel || (ds->abswheel != priv->oldWheel) || (ds->abswheel2 != priv->oldWheel2) ||
( (ds->stripx - priv->oldStripX) && ds->stripx && priv->oldStripX) ||
((ds->stripy - priv->oldStripY) && ds->stripy && priv->oldStripY) )
sendWheelStripEvents(pInfo, ds, first_val, num_vals, valuators);
@@ -589,7 +599,7 @@ wcmSendPadEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
if (valuators[i])
break;
if (i < num_vals || ds->buttons || ds->relwheel ||
- (ds->abswheel != priv->oldWheel))
+ (ds->abswheel != priv->oldWheel) || (ds->abswheel2 != priv->oldWheel2))
{
sendCommonEvents(pInfo, ds, first_val, num_vals, valuators);
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 783966a..5920e11 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -80,6 +80,8 @@ static int wcmAllocate(InputInfoPtr pInfo)
* later in wcmParseOptions, when we have IsPad() available */
priv->wheelup = 0; /* Default absolute wheel up event */
priv->wheeldn = 0; /* Default absolute wheel down event */
+ priv->wheel2up = 0; /* Default absolute wheel2 up event */
+ priv->wheel2dn = 0; /* Default absolute wheel2 down event */
priv->striplup = 4; /* Default left strip up event */
priv->stripldn = 5; /* Default left strip down event */
priv->striprup = 4; /* Default right strip up event */
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 97df312..862e005 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -729,8 +729,8 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool is_primary,
*/
if (IsPad(priv))
{
- priv->wheelup = 4;
- priv->wheeldn = 5;
+ priv->wheelup = priv->wheel2up = 4;
+ priv->wheeldn = priv->wheel2dn = 5;
set_absolute(pInfo, TRUE);
}
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 82f9b80..40393dc 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -237,7 +237,7 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
if (IsPad(priv) || IsCursor(priv))
{
memset(values, 0, sizeof(values));
- prop_wheel_buttons = InitWcmAtom(pInfo->dev, WACOM_PROP_WHEELBUTTONS, XA_ATOM, 32, 4, values);
+ prop_wheel_buttons = InitWcmAtom(pInfo->dev, WACOM_PROP_WHEELBUTTONS, XA_ATOM, 32, 6, values);
}
values[0] = common->vendor_id;
@@ -456,6 +456,8 @@ struct wheel_strip_update_t {
int *dn1;
int *up2;
int *dn2;
+ int *up3;
+ int *dn3;
/* for CARD32 values, points to atom array of atoms to be
* monitored.*/
@@ -477,7 +479,8 @@ static int wcmSetWheelOrStripProperty(DeviceIntPtr dev, Atom property,
CARD32 *v32;
} values;
- if (prop->size != 4)
+ if ((property == prop_strip_buttons && prop->size != 4) ||
+ (property == prop_wheel_buttons && prop->size != 6))
return BadValue;
/* see wcmSetPropertyButtonActions for how this works. The wheel is
@@ -492,7 +495,9 @@ static int wcmSetWheelOrStripProperty(DeviceIntPtr dev, Atom property,
if (values.v8[0] > WCM_MAX_MOUSE_BUTTONS ||
values.v8[1] > WCM_MAX_MOUSE_BUTTONS ||
values.v8[2] > WCM_MAX_MOUSE_BUTTONS ||
- values.v8[3] > WCM_MAX_MOUSE_BUTTONS)
+ values.v8[3] > WCM_MAX_MOUSE_BUTTONS ||
+ values.v8[4] > WCM_MAX_MOUSE_BUTTONS ||
+ values.v8[5] > WCM_MAX_MOUSE_BUTTONS)
return BadValue;
if (!checkonly) {
@@ -500,6 +505,8 @@ static int wcmSetWheelOrStripProperty(DeviceIntPtr dev, Atom property,
*wsup->dn1 = values.v8[1];
*wsup->up2 = values.v8[2];
*wsup->dn2 = values.v8[3];
+ *wsup->up3 = values.v8[4];
+ *wsup->dn3 = values.v8[5];
}
break;
case 32:
@@ -534,10 +541,12 @@ static int wcmSetWheelProperty(DeviceIntPtr dev, Atom property,
.dn1 = &priv->reldn,
.up2 = &priv->wheelup,
.dn2 = &priv->wheeldn,
+ .up3 = &priv->wheel2up,
+ .dn3 = &priv->wheel2dn,
.handlers = priv->wheel_actions,
.keys = priv->wheel_keys,
- .skeys = 4,
+ .skeys = 6,
};
return wcmSetWheelOrStripProperty(dev, property, prop, checkonly, &wsup);
@@ -554,6 +563,8 @@ static int wcmSetStripProperty(DeviceIntPtr dev, Atom property,
.dn1 = &priv->stripldn,
.up2 = &priv->striprup,
.dn2 = &priv->striprdn,
+ .up3 = NULL,
+ .dn3 = NULL,
.handlers = priv->strip_actions,
.keys = priv->strip_keys,
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index e0e58fe..2f3f7b4 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -239,10 +239,12 @@ struct _WacomDeviceRec
int reldn;
int wheelup;
int wheeldn;
+ int wheel2up;
+ int wheel2dn;
/* keystrokes assigned to wheel events (default is the buttons above).
- * Order is relup, reldwn, wheelup, wheeldn. Like 'keys', this array
- * is one-indexed */
- unsigned wheel_keys[4+1][256];
+ * Order is relup, reldwn, wheelup, wheeldn, wheel2up, wheel2dn.
+ * Like 'keys', this array is one-indexed */
+ unsigned wheel_keys[6+1][256];
int striplup;
int stripldn;