summaryrefslogtreecommitdiff
path: root/keycodes.c
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2017-04-06 15:52:10 +0100
committerDaniel Stone <daniels@collabora.com>2017-04-11 13:54:50 +0100
commit7fdfabd753a39dbdcfcfa65ec33d0192448119d8 (patch)
treee3b16b6817553f17ba3821786fb2fbf6dcaa1f18 /keycodes.c
parent9f1e3e8c8914b349b9b52501bb4acadedb31081d (diff)
downloadxorg-app-xkbcomp-7fdfabd753a39dbdcfcfa65ec33d0192448119d8.tar.gz
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 <daniels@collabora.com> Reviewed-by: Ran Benita <ran234@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reported-by: Christian Kellner <gicmo@gnome.org>
Diffstat (limited to 'keycodes.c')
-rw-r--r--keycodes.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/keycodes.c b/keycodes.c
index 22d9eae..d5ac762 100644
--- a/keycodes.c
+++ b/keycodes.c
@@ -31,6 +31,8 @@
#include "misc.h"
#include "alias.h"
+static Bool high_keycode_warned;
+
char *
longText(unsigned long val, unsigned format)
{
@@ -330,10 +332,15 @@ AddKeyName(KeyNamesInfo * info,
if ((kc < info->effectiveMin) || (kc > info->effectiveMax))
{
- ERROR2("Illegal keycode %d for name <%s>\n", kc, name);
- ACTION2("Must be in the range %d-%d inclusive\n",
- info->effectiveMin, info->effectiveMax);
- return False;
+ if (!high_keycode_warned)
+ {
+ WARN2("Unsupported high keycode %d for name <%s> ignored\n",
+ 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)
info->computedMin = kc;
@@ -589,10 +596,15 @@ HandleKeycodeDef(KeycodeDef * stmt, unsigned merge, KeyNamesInfo * info)
code = result.ival;
if ((code < info->effectiveMin) || (code > info->effectiveMax))
{
- ERROR2("Illegal keycode %d for name <%s>\n", code, stmt->name);
- ACTION2("Must be in the range %d-%d inclusive\n",
- info->effectiveMin, info->effectiveMax);
- return 0;
+ if (!high_keycode_warned)
+ {
+ WARN2("Unsupported high keycode %d for name <%s> ignored\n",
+ 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)
{