From: Chris Bagwell <[email protected]> If a user did a special button mapping, such as key-to-button, and then changed it back to simple button-to-button mapping, the special mapping still occured.
The main fix is to memset keys[] to clear out old mapping. The other fix is more cosmetic. We were leaving around a property that was unreferenced by anything. If a user did an "xinput list-props pad", they way scratch there head by old button mapping properties were still around. Signed-off-by: Chris Bagwell <[email protected]> Reviewed-by: Peter Hutterer <[email protected]> --- Made "}" and else on same line at Peter's request. src/wcmXCommand.c | 5 +++-- tools/xsetwacom.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 11b247f..8b9e0cd 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -299,13 +299,14 @@ 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])); + if (!values[i]) continue; XIGetDeviceProperty(dev, values[i], &val); - /* keys is one based array to align with X buttons */ - memset(keys[i+1], 0, sizeof(keys[i])); for (j = 0; j < val->size; j++) keys[i+1][j] = ((unsigned int*)val->data)[j]; } diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index e2a7d0b..a92c87d 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -1296,7 +1296,7 @@ static int convert_wheel_prop(Display *dpy, XDevice *dev, Atom btnact_prop) static void special_map_property(Display *dpy, XDevice *dev, Atom btnact_prop, int offset, int argc, char **argv) { unsigned long *data, *btnact_data; - Atom type, prop; + Atom type, prop = 0; int format; unsigned long btnact_nitems, nitems, bytes_after; int need_update = 0; @@ -1326,8 +1326,11 @@ static void special_map_property(Display *dpy, XDevice *dev, Atom btnact_prop, i } if (argc == 0) /* unset property */ + { + prop = btnact_data[offset]; btnact_data[offset] = 0; - else if (btnact_data[offset]) /* some atom already assigned, modify that */ + } else if (btnact_data[offset]) + /* some atom already assigned, modify that */ prop = btnact_data[offset]; else { @@ -1373,6 +1376,10 @@ static void special_map_property(Display *dpy, XDevice *dev, Atom btnact_prop, i PropModeReplace, (unsigned char*)btnact_data, btnact_nitems); + + if (argc == 0 && prop) + XDeleteDeviceProperty(dpy, dev, prop); + XFlush(dpy); } -- 1.7.3.4 ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
