From: Chris Bagwell <[email protected]>

Couldn't do button-to-button mapping for last ButtonN.  This
may be newly visible before recently some unneeded button
counts were corrected in input driver.

If user did a key mapping and then changed back to button
mapping, the key mapping was left around and kepted being
used by input driver.  Delete the property now.

Signed-off-by: Chris Bagwell <[email protected]>
---
 tools/xsetwacom.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

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

Reply via email to