With parse_actions now handling simple button mappings, we remove
this function which essentially duplicates its functionality.

Note that there is a small difference in how the new parse_actions
code and the old map_button_simple code handle things. The former
Translates a single numeric argument into an action (e.g. "3" is
turned into "button +3"). The latter cleared any existing action
and used XSetDeviceButtonMapping to have X remap button events.

To better explain the difference, consider the two following commands
run in sequence:

xsetwacom --set $id button 2 3
xsetwacom --set $id button 3 button 2

Under the old map_button_simple code, both buttons 2 and 3 would
produce a right-click event. This is because the first command has
X remap all "button 2" events into "button 3" events. Since both
button 2 (by driver's priv->button[]) and button 3 (by the explicit
action) produce a "button 2" event, X remaps both events into "button 3"
events.

Under the new parse_actions code, things are what you'd expect: button
2 produces a right click and button 3 produces a middle click. If the
user wants, they can use `xinput set-button-map` to remap the buttons
the same way that map_button_simple did.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 tools/xsetwacom.c |   30 +-----------------------------
 1 files changed, 1 insertions(+), 29 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index 7eb95d7..f6626d3 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1321,29 +1321,6 @@ static void special_map_buttons(Display *dpy, XDevice 
*dev, param_t* param,
        special_map_property(dpy, dev, btnact_prop, button, argc, argv);
 }
 
-
-static void map_button_simple(Display *dpy, XDevice *dev, param_t* param,
-                             int button, int mapping)
-{
-       int nmap = 256;
-       unsigned char map[nmap];
-
-       nmap = XGetDeviceButtonMapping(dpy, dev, map, nmap);
-       if (button > nmap)
-       {
-               fprintf(stderr, "Button number does not exist on device.\n");
-               return;
-       }
-
-       TRACE("Mapping button %d to %d.\n", button, mapping);
-
-       map[button - 1] = mapping;
-       XSetDeviceButtonMapping(dpy, dev, map, nmap);
-       XFlush(dpy);
-
-       /* If there's a property set, unset it */
-       special_map_buttons(dpy, dev, param, button, 0, NULL);
-}
 /*
    Supports two variations, simple mapping and special mapping:
    xsetwacom set device Button 1 1
@@ -1361,12 +1338,7 @@ static void map_button(Display *dpy, XDevice *dev, 
param_t* param, int argc, cha
 
        TRACE("Mapping %s for device %ld.\n", param->name, dev->device_id);
 
-
-       /* --set "device" Button1 3 */
-       if (argc > 1 && sscanf(argv[1], "%d", &mapping) == 1)
-               map_button_simple(dpy, dev, param, button, mapping);
-       else
-               special_map_buttons(dpy, dev, param, button, argc - 1, 
&argv[1]);
+       special_map_buttons(dpy, dev, param, button, argc - 1, &argv[1]);
 }
 
 static void set_xydefault(Display *dpy, XDevice *dev, param_t* param, int 
argc, char **argv)
-- 
1.7.4.1


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to