summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-base/xorg-server/files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch')
-rw-r--r--x11-base/xorg-server/files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/x11-base/xorg-server/files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch b/x11-base/xorg-server/files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch
new file mode 100644
index 000000000000..14ac3f9d448b
--- /dev/null
+++ b/x11-base/xorg-server/files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch
@@ -0,0 +1,145 @@
+From 104048501f37b139d4113562ef1711978cc76018 Mon Sep 17 00:00:00 2001
+From: Daniel Stone <daniel@fooishbar.org>
+Date: Wed, 7 May 2008 23:11:31 +0300
+Subject: [PATCH] XKB: Actually explain keymap failures
+
+When something went wrong building a keymap, try to explain to the user
+what it actually was, instead of the dreaded 'Failed to load XKB keymap'
+catch-all.
+(cherry picked from commit cf20df39cc78203d17b99223908af388ecbf7d0e)
+
+Conflicts:
+ xkb/ddxLoad.c
+---
+ xkb/ddxLoad.c | 69 ++++++++++++++++++++++++++++-----------------------------
+ 1 files changed, 34 insertions(+), 35 deletions(-)
+
+diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
+index d79ae7a..ea9c3ff 100644
+--- a/xkb/ddxLoad.c
++++ b/xkb/ddxLoad.c
+@@ -385,24 +385,20 @@ char tmpname[PATH_MAX];
+ xfree (buf);
+ return True;
+ }
+-#ifdef DEBUG
+ else
+- ErrorF("Error compiling keymap (%s)\n",keymap);
+-#endif
++ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+ #ifdef WIN32
+ /* remove the temporary file */
+ unlink(tmpname);
+ #endif
+ }
+-#ifdef DEBUG
+ else {
+ #ifndef WIN32
+- ErrorF("Could not invoke keymap compiler\n");
++ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
+ #else
+- ErrorF("Could not open file %s\n", tmpname);
++ LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
+ #endif
+ }
+-#endif
+ if (nameRtrn)
+ nameRtrn[0]= '\0';
+ if (buf != NULL)
+@@ -477,17 +473,14 @@ unsigned missing;
+ return 0;
+ }
+ else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
+-#ifdef NOISY
+- ErrorF("Couldn't compile keymap file\n");
+-#endif
++ LogMessage(X_ERROR, "Couldn't compile keymap file %s\n",
++ names->keymap);
+ return 0;
+ }
+ }
+ else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
+- nameRtrn,nameRtrnLen)){
+-#ifdef NOISY
+- ErrorF("Couldn't compile keymap file\n");
+-#endif
++ nameRtrn,nameRtrnLen)){
++ LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
+ return 0;
+ }
+ file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
+@@ -502,11 +495,9 @@ unsigned missing;
+ (void) unlink (fileName);
+ return 0;
+ }
+-#ifdef DEBUG
+- else if (xkbDebugFlags) {
+- ErrorF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
++ else {
++ DebugF("XKB: Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
+ }
+-#endif
+ fclose(file);
+ (void) unlink (fileName);
+ return (need|want)&(~missing);
+@@ -525,32 +516,40 @@ XkbRF_RulesPtr rules;
+
+ if (!rules_name)
+ return False;
+- if (XkbBaseDirectory==NULL) {
+- if (strlen(rules_name)+7 > PATH_MAX)
+- return False;
+- sprintf(buf,"rules/%s",rules_name);
+- }
+- else {
+- if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX)
+- return False;
+- sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name);
++
++ if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
++ LogMessage(X_ERROR, "XKB: Rules name is too long\n");
++ return False;
+ }
+- if ((file= fopen(buf,"r"))==NULL)
++ sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name);
++
++ file = fopen(buf, "r");
++ if (!file) {
++ LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", file);
+ return False;
+- if ((rules= XkbRF_Create(0,0))==NULL) {
++ }
++
++ rules = XkbRF_Create(0, 0);
++ if (!rules) {
++ LogMessage(X_ERROR, "XKB: Couldn't create rules struct\n");
+ fclose(file);
+ return False;
+ }
+- if (!XkbRF_LoadRules(file,rules)) {
++
++ if (!XkbRF_LoadRules(file, rules)) {
++ LogMessage(X_ERROR, "XKB: Couldn't parse rules file %s\n", rules_name);
+ fclose(file);
+ XkbRF_Free(rules,True);
+ return False;
+ }
+- bzero((char *)names,sizeof(XkbComponentNamesRec));
+- complete= XkbRF_GetComponents(rules,defs,names);
++
++ memset(names, 0, sizeof(*names));
++ complete = XkbRF_GetComponents(rules,defs,names);
+ fclose(file);
+- XkbRF_Free(rules,True);
+- return complete;
+-}
++ XkbRF_Free(rules, True);
+
++ if (!complete)
++ LogMessage(X_ERROR, "XKB: Rules returned no components\n");
+
++ return complete;
++}
+--
+1.5.5.1
+