From fa9c38e6e7f1caa12d38f35c5633735bcaef3ba1 Mon Sep 17 00:00:00 2001 From: Karl Fogel Date: Sat, 16 Mar 2019 21:29:04 -0500 Subject: Fix warning about number of mouse buttons Change a warning to distinguish between too few buttons and too many. Before this change: $ xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" Warning: Only changing the first 15 of 10 buttons. $ After this change: $ xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" Warning: Not changing 5 extra buttons beyond 10. $ Fixes: https://gitlab.freedesktop.org/xorg/app/xmodmap/issues/2 Signed-off-by: Karl Fogel --- handle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'handle.c') diff --git a/handle.c b/handle.c index 02a5f41..429b57a 100644 --- a/handle.c +++ b/handle.c @@ -889,8 +889,16 @@ do_pointer(char *line, int len) } if (i > 0 && i != nbuttons) { - fprintf (stderr, "Warning: Only changing the first %d of %d buttons.\n", - i, nbuttons); + if (i < nbuttons) { + fprintf (stderr, + "Warning: Only changing the first %d of %d buttons.\n", + i, nbuttons); + } + else { /* i > nbuttons */ + fprintf (stderr, + "Warning: Not changing %d extra buttons beyond %d.\n", + i - nbuttons, nbuttons); + } i = nbuttons; } -- cgit v1.2.3