Since neither function actually do anything that couldn't just be done in 'map_wheels' and 'map_button' respectively, we simply squash them together.
Signed-off-by: Jason Gerecke <killert...@gmail.com> --- tools/xsetwacom.c | 44 ++++++++++++++------------------------------ 1 files changed, 14 insertions(+), 30 deletions(-) diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index f6626d3..2ff3b22 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -1280,11 +1280,15 @@ static void special_map_property(Display *dpy, XDevice *dev, Atom btnact_prop, i XFlush(dpy); } - -static void special_map_wheels(Display *dpy, XDevice *dev, param_t* param, int argc, char **argv) +static void map_wheels(Display *dpy, XDevice *dev, param_t* param, int argc, char **argv) { Atom wheel_prop; + if (argc <= 0) + return; + + TRACE("Mapping wheel %s for device %ld.\n", param->name, dev->device_id); + wheel_prop = XInternAtom(dpy, param->prop_name, True); if (!wheel_prop) return; @@ -1294,33 +1298,6 @@ static void special_map_wheels(Display *dpy, XDevice *dev, param_t* param, int a special_map_property(dpy, dev, wheel_prop, param->prop_offset, argc, argv); } -static void map_wheels(Display *dpy, XDevice *dev, param_t* param, int argc, char **argv) -{ - if (argc <= 0) - return; - - TRACE("Mapping wheel %s for device %ld.\n", param->name, dev->device_id); - - special_map_wheels(dpy, dev, param, argc, argv); -} - -/* Handles complex button mappings through button actions. */ -static void special_map_buttons(Display *dpy, XDevice *dev, param_t* param, - int button, int argc, char **argv) -{ - Atom btnact_prop; - - TRACE("Special %s map for device %ld.\n", param->name, dev->device_id); - - btnact_prop = XInternAtom(dpy, WACOM_PROP_BUTTON_ACTIONS, True); - if (!btnact_prop) - return; - - button--; /* property is zero-indexed, button numbers are 1-indexed */ - - special_map_property(dpy, dev, btnact_prop, button, argc, argv); -} - /* Supports two variations, simple mapping and special mapping: xsetwacom set device Button 1 1 @@ -1330,6 +1307,7 @@ static void special_map_buttons(Display *dpy, XDevice *dev, param_t* param, */ static void map_button(Display *dpy, XDevice *dev, param_t* param, int argc, char **argv) { + Atom btnact_prop; int button, /* button to be mapped */ mapping; @@ -1338,7 +1316,13 @@ 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); - special_map_buttons(dpy, dev, param, button, argc - 1, &argv[1]); + btnact_prop = XInternAtom(dpy, WACOM_PROP_BUTTON_ACTIONS, True); + if (!btnact_prop) + return; + + button--; /* property is zero-indexed, button numbers are 1-indexed */ + + special_map_property(dpy, dev, btnact_prop, 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