summaryrefslogtreecommitdiff
path: root/handle.c
diff options
context:
space:
mode:
authorKarl Fogel <kfogel@red-bean.com>2019-03-16 21:29:04 -0500
committerKarl Fogel <kfogel@red-bean.com>2019-03-16 21:40:49 -0500
commitfa9c38e6e7f1caa12d38f35c5633735bcaef3ba1 (patch)
tree56f1bf75e791d884cbc9309f0daaeb3d33092b09 /handle.c
parentc5a5fb06fd25c044f343f4571c645fd6c954d038 (diff)
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 <kfogel@red-bean.com>
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c12
1 files changed, 10 insertions, 2 deletions
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;
}