The 'keys' array is indexed into by reference to the X11 button number stored in the 'buttons' array. While this may have been useful at some point in time, the benefits are no longer clear (but the repercussions are still just as annoying).
Note that because the association with X11 buttons has been removed, systems which set both raw *and* action button mappings will appear to have the button number associated with actions change. Since the only way to set raw button mappings is via xorg.conf, there is little expected fallout from this change. Signed-off-by: Jason Gerecke <killert...@gmail.com> --- src/wcmCommon.c | 25 +++++++++---------------- src/wcmXCommand.c | 5 ++--- src/xf86WacomDefs.h | 6 +++--- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 7199105..55393bb 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -286,23 +286,16 @@ static void sendAButton(InputInfoPtr pInfo, int button, int mask, #ifdef DEBUG WacomCommonPtr common = priv->common; #endif - int mapped_button; + int mapped_button = button > 2 ? button + 4 : button; /* maintain prior "dead button" behavior */ - if (!priv->button[button]) /* ignore this button event */ - return; - - mapped_button = priv->button[button]; - - DBG(4, priv, "TPCButton(%s) button=%d state=%d " - "mapped_button=%d\n", - common->wcmTPCButton ? "on" : "off", - button, mask, mapped_button); + DBG(4, priv, "TPCButton(%s) button=%d state=%d\n", + common->wcmTPCButton ? "on" : "off", button, mask); if (!priv->keys[mapped_button][0]) { /* No button action configured, send button */ xf86PostButtonEventP(pInfo->dev, is_absolute(pInfo), - mapped_button, (mask != 0), + priv->button[button], (mask != 0), first_val, num_val, VCOPY(valuators, num_val)); return; @@ -433,7 +426,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds, { DBG(10, priv, "Left touch strip scroll delta = %d\n", delta); fakeButton = getWheelButton(delta, priv->striplup, priv->stripldn, - priv->strip_keys[0+1], priv->strip_keys[1+1], &fakeKey); + priv->strip_keys[0], priv->strip_keys[1], &fakeKey); sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators); } @@ -443,7 +436,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds, { DBG(10, priv, "Right touch strip scroll delta = %d\n", delta); fakeButton = getWheelButton(delta, priv->striprup, priv->striprdn, - priv->strip_keys[2+1], priv->strip_keys[3+1], &fakeKey); + priv->strip_keys[2], priv->strip_keys[3], &fakeKey); sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators); } @@ -453,7 +446,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds, { DBG(10, priv, "Relative wheel scroll delta = %d\n", delta); fakeButton = getWheelButton(delta, priv->relup, priv->reldn, - priv->wheel_keys[0+1], priv->wheel_keys[1+1], &fakeKey); + priv->wheel_keys[0], priv->wheel_keys[1], &fakeKey); sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators); } @@ -463,7 +456,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds, { DBG(10, priv, "Left touch wheel scroll delta = %d\n", delta); fakeButton = getWheelButton(delta, priv->wheelup, priv->wheeldn, - priv->wheel_keys[2+1], priv->wheel_keys[3+1], &fakeKey); + priv->wheel_keys[2], priv->wheel_keys[3], &fakeKey); sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators); } @@ -473,7 +466,7 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds, { 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); + priv->wheel_keys[4], priv->wheel_keys[5], &fakeKey); sendWheelStripEvent(fakeButton, fakeKey, pInfo, first_val, num_vals, valuators); } } diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 883b3b1..1ded48c 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -330,8 +330,7 @@ static void wcmUpdateButtonKeyActions(DeviceIntPtr dev, XIPropertyValuePtr prop, for (i = 0; i < prop->size; i++) { - /* keys is one based array to align with X buttons */ - memset(keys[i+1], 0, sizeof(keys[i+1])); + memset(keys[i], 0, sizeof(keys[i])); if (!values[i]) continue; @@ -339,7 +338,7 @@ static void wcmUpdateButtonKeyActions(DeviceIntPtr dev, XIPropertyValuePtr prop, XIGetDeviceProperty(dev, values[i], &val); for (j = 0; j < val->size; j++) - keys[i+1][j] = ((unsigned int*)val->data)[j]; + keys[i][j] = ((unsigned int*)val->data)[j]; } } diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h index f662131..1b725df 100644 --- a/src/xf86WacomDefs.h +++ b/src/xf86WacomDefs.h @@ -234,7 +234,7 @@ struct _WacomDeviceRec /* map zero based internal buttons to one based X buttons */ int button[WCM_MAX_BUTTONS]; /* map one based X buttons to keystrokes */ - unsigned keys[WCM_MAX_BUTTONS+1][256]; + unsigned keys[WCM_MAX_BUTTONS][256]; int relup; int reldn; int wheelup; @@ -244,7 +244,7 @@ struct _WacomDeviceRec /* keystrokes assigned to wheel events (default is the buttons above). * Order is relup, reldwn, wheelup, wheeldn, wheel2up, wheel2dn. * Like 'keys', this array is one-indexed */ - unsigned wheel_keys[6+1][256]; + unsigned wheel_keys[6][256]; int striplup; int stripldn; @@ -253,7 +253,7 @@ struct _WacomDeviceRec /* keystrokes assigned to strip events (default is the buttons above). * Order is striplup, stripldn, striprup, striprdn. Like 'keys', this * array is one-indexed */ - unsigned strip_keys[4+1][256]; + unsigned strip_keys[4][256]; int nbuttons; /* number of buttons for this subdevice */ int naxes; /* number of axes */ /* FIXME: always 6, and the code relies on that... */ -- 1.7.9.5 ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel