xmodmap prints confusing warning message when mapping too many mouse buttons
If you use xmodmap to set the mouse buttons, and the number of buttons you specify is more than are available on the mouse, the warning message is worded the same as if the number of buttons you specified were less than the number available. This is a bit confusing.
Reproduction recipe:
$ 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.
$
Below is a proposed fix. I'll try to figure out how to submit a merge request for xmodmap, but in case I don't succeed, this is the patch against commit c5a5fb06 in git://anongit.freedesktop.org/xorg/app/xmodmap
:
--- handle.c
+++ 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;
}
Confession: this patch is untested. According to autogen.sh, actually building xmodmap requires xorg-macros 1.8 or later and probably a whole bunch of other things that I don't have handy.