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 cf20df39cc
)
Conflicts:
xkb/ddxLoad.c
This commit is contained in:
parent
b1145a6b42
commit
104048501f
|
@ -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);
|
||||
|
||||
if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
|
||||
LogMessage(X_ERROR, "XKB: Rules name is too long\n");
|
||||
return False;
|
||||
}
|
||||
else {
|
||||
if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX)
|
||||
return False;
|
||||
sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name);
|
||||
}
|
||||
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);
|
||||
XkbRF_Free(rules, True);
|
||||
|
||||
if (!complete)
|
||||
LogMessage(X_ERROR, "XKB: Rules returned no components\n");
|
||||
|
||||
return complete;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user