So I decided that rather than hacking it with Xmodmap, I would try and get the back and forward buttons (on my IBM laptop) working properly just via the xkb stuff, and did eventually manage it.
Basically in /etc/X11/xkb/symbols/inet (ubuntu, other distros will vary) put:
partial alphanumeric_keys
xkb_symbols "thinkpad" {
key <I6A> { [ XF86Back ] };
key <I69> { [ XF86Forward ] };
};
(how do I generate those <I6A> numbers ? it isn’t a direct conversion from the decimal that xev gives me)
and then in the $inetkbds bit of /etc/X11/xkb/rules/base add “thinkpad”. Once that is done, just select the “IBM thinkpad <random model numbers>” layout in gnome-keyboard-properties, and your back and forward buttons will ‘just work’ with no xmodmap messing.
I believe this is the correct way of doing things, so I have raised a bug about it.
Perhaps another bug should be raised about the name of that keyboard, and the fact that the keys appear as just a big black rectangle in the layouts dialog of gnome-keyboard-properties.
Next up, get my Microsoft Natural Multimedia keyboard’s audio buttons working…..