On Sat, Jan 15, 2011 at 09:39:32AM -0600, [email protected] wrote: > From: Chris Bagwell <[email protected]> > > 1) Couldn't do button-to-button mapping for last ButtonN because > it was doing >= check. Probably this used to be hidden because > input driver would pad button counts and has recently been > corrected. > > 2) If user did a key mapping and then changed back to button > mapping, the key mapping property was left around and kepted being > used by input driver. Delete the property and memset keys[]s. > > Signed-off-by: Chris Bagwell <[email protected]> > --- > New in v2 is memset() on driver side to clear out keys. > > Andrzej Giniewicz is helping to test and helped me realize > I was testing against an old wacom input driver were we originally > tried only that as fix. I forgot to add that part to patch. > > src/wcmXCommand.c | 3 ++- > tools/xsetwacom.c | 11 +++++++++-- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c > index 014fd17..66f5b84 100644 > --- a/src/wcmXCommand.c > +++ b/src/wcmXCommand.c > @@ -299,12 +299,13 @@ static void wcmUpdateButtonKeyActions(DeviceIntPtr dev, > XIPropertyValuePtr prop, > > for (i = 0; i < prop->size; i++) > { > + memset(keys[i], 0, sizeof(keys[i])); > +
thanks, that's what I was missing in the other patch. sorry, replied to the other one before I saw this one. comment still stands about the deleting and the >= nmap though, but Reviewed-by: Peter Hutterer <[email protected]> otherwise Cheers, Peter > if (!values[i]) > continue; > > XIGetDeviceProperty(dev, values[i], &val); > > - memset(keys[i], 0, sizeof(keys[i])); > for (j = 0; j < val->size; j++) > keys[i][j] = ((unsigned int*)val->data)[j]; > } > diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c > index 26d822f..5875968 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,7 +1326,10 @@ 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 */ > 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); > } > > @@ -1438,7 +1445,7 @@ static void map_button_simple(Display *dpy, XDevice > *dev, param_t* param, int bu > return; > > nmap = XGetDeviceButtonMapping(dpy, dev, map, nmap); > - if (btn_no >= nmap) > + if (btn_no > nmap) > { > fprintf(stderr, "Button number does not exist on device.\n"); > return; > -- > 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
