[PATCH xkbcomp] keycodes: Ignore high keycodes

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 6 22:09:41 UTC 2017


On Thu, Apr 06, 2017 at 09:57:26PM +0300, Ran Benita wrote:
> On Thu, Apr 06, 2017 at 05:37:28PM +0100, Daniel Stone wrote:
> > Rather than throwing a fatal error when a keycode definition exceeds the
> > declared maximum (i.e. 255), just ignore the definition and continue.
> > 
> > This allows xkeyboard-config to start shipping datasets including high
> > keycodes, which will work in xkbcommon as it ignores explicit range
> > declarations.
> 
> I always hoped that Wayland systems could switch to a new keycode file,
> which uses the full evdev key names (xkbcommon no longer has the 4
> character limit), and the evdev codes (without the + 8 offset), and
> aliases for backward compat with existing keymaps. But I guess that
> would be a lot of pain for little gain.
> 
> So this seems like a good idea to me, to move things forward.
> 
> My only concern about the patch is that I think that it will issue a
> million warnings if keymaps start to use this? I looked at utils.c (a
> true relic) and it seems that there is no filtering on these ERROR2 and
> ACTION2, they just print. Add to that other files which would start to
> use the new keycodes, and you get more warnings (hopefully not fatal
> errors).
> 
> I think a reasonable test plan would be:
> 
> - Add ~15 new >255 keycodes.
> - Use them in some symbols file.
> - Try to load this with a patched xkbcomp.
> - See that:
>   - There's not a huge log spam.
>   - That it actually doesn't fail.
> 
> Note that I say ~15, because I vaguely remember that there are "allow 10
> errors then give up" checks in some places.

xkbcomp is used to convert keymaps for X, there isn't really much of a
use-case beyond that. So I think we can put something X specific in here,
instead of just converting to a warning, how about we make it a) ratelimited
and b) X-specific. so something like:

static bool have_warned;

if (!have_warned) {
        have_warned =  true;
        WARNING("High keycode %d for name <%s>. This keycode cannot be routed in X11. "
                "This warning only occurs once for the first high keycode.\n", kc, name");
}

That addresses both the logspam and is explanatory. We could/should even
link to a web page with the full explanation here to save us some bug reports.

Cheers,
   Peter


More information about the xorg-devel mailing list