From 2dae1bbd3c5deb09ff36b2c7bcb805a441142caa Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 8 Apr 2011 15:19:25 +1000 Subject: xsetwacom: fix map_button indexing Don't allow for button 0 to be map-able but allow for the last button to be mapped. Signed-off-by: Peter Hutterer --- tools/xsetwacom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index 28d9e7a..11aea03 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -1490,11 +1490,11 @@ static void map_button_simple(Display *dpy, XDevice *dev, param_t* param, int bu int btn_no = 0; btn_no = get_button_number_from_string(param->name); - if (btn_no == -1) + if (btn_no <= 0) 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; -- cgit v1.2.1