Commit 7fdfabd7 authored by Daniel Stone's avatar Daniel Stone

keycodes: Ignore high keycodes

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.
Signed-off-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
Reviewed-by: default avatarRan Benita <ran234@gmail.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Reported-by: Christian Kellner's avatarChristian Kellner <gicmo@gnome.org>
parent 9f1e3e8c
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "misc.h" #include "misc.h"
#include "alias.h" #include "alias.h"
static Bool high_keycode_warned;
char * char *
longText(unsigned long val, unsigned format) longText(unsigned long val, unsigned format)
{ {
...@@ -330,10 +332,15 @@ AddKeyName(KeyNamesInfo * info, ...@@ -330,10 +332,15 @@ AddKeyName(KeyNamesInfo * info,
if ((kc < info->effectiveMin) || (kc > info->effectiveMax)) if ((kc < info->effectiveMin) || (kc > info->effectiveMax))
{ {
ERROR2("Illegal keycode %d for name <%s>\n", kc, name); if (!high_keycode_warned)
ACTION2("Must be in the range %d-%d inclusive\n", {
info->effectiveMin, info->effectiveMax); WARN2("Unsupported high keycode %d for name <%s> ignored\n",
return False; kc, name);
ACTION2("X11 cannot support keycodes above 255.\n");
ACTION2("This warning only shows for the first high keycode.\n");
high_keycode_warned = True;
}
return True;
} }
if (kc < info->computedMin) if (kc < info->computedMin)
info->computedMin = kc; info->computedMin = kc;
...@@ -589,10 +596,15 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info) ...@@ -589,10 +596,15 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
code = result.ival; code = result.ival;
if ((code < info->effectiveMin) || (code > info->effectiveMax)) if ((code < info->effectiveMin) || (code > info->effectiveMax))
{ {
ERROR2("Illegal keycode %d for name <%s>\n", code, stmt->name); if (!high_keycode_warned)
ACTION2("Must be in the range %d-%d inclusive\n", {
info->effectiveMin, info->effectiveMax); WARN2("Unsupported high keycode %d for name <%s> ignored\n",
return 0; code, stmt->name);
ACTION2("X11 cannot support keycodes above 255.\n");
ACTION2("This warning only shows for the first high keycode.\n");
high_keycode_warned = True;
}
return 1;
} }
if (stmt->merge != MergeDefault) if (stmt->merge != MergeDefault)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment