XKB: Remove support for pre-built keymaps

Don't load prebuilt keymaps anymore.
This commit is contained in:
Daniel Stone 2008-02-03 23:48:57 +11:00
parent 1332343910
commit ab79110a84
5 changed files with 18 additions and 128 deletions

View File

@ -1022,13 +1022,6 @@ extern Bool XkbDDXApplyConfig(
XkbSrvInfoPtr /* xkbi */
);
extern void *XkbDDXPreloadConfig(
char ** /* rulesFileRtrn */,
XkbRF_VarDefsPtr /* defs */,
XkbComponentNamesPtr /* names */,
DeviceIntPtr /* dev */
);
extern int _XkbStrCaseCmp(
char * /* str1 */,
char * /* str2 */

View File

@ -178,74 +178,6 @@ OutputDirectory(
}
}
static Bool
XkbDDXCompileNamedKeymap( XkbDescPtr xkb,
XkbComponentNamesPtr names,
char * nameRtrn,
int nameRtrnLen)
{
char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
if (names->keymap==NULL)
return False;
strncpy(file,names->keymap,PATH_MAX); file[PATH_MAX-1]= '\0';
if ((map= strrchr(file,'('))!=NULL) {
char *tmp;
if ((tmp= strrchr(map,')'))!=NULL) {
*map++= '\0';
*tmp= '\0';
}
else {
map= NULL;
}
}
if ((outFile= strrchr(file,'/'))!=NULL)
outFile= _XkbDupString(&outFile[1]);
else outFile= _XkbDupString(file);
XkbEnsureSafeMapName(outFile);
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
if (XkbBaseDirectory!=NULL) {
char *xkbbasedir = XkbBaseDirectory;
char *xkbbindir = XkbBinDirectory;
cmd = Xprintf("\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
xkbbindir,
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
xkbbasedir,(map?"-m ":""),(map?map:""),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile);
}
else {
cmd = Xprintf("xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"",
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)),
(map?"-m ":""),(map?map:""),
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
xkm_output_dir,outFile);
}
if (xkbDebugFlags) {
DebugF("XkbDDXCompileNamedKeymap compiling keymap using:\n");
DebugF(" \"cmd\"\n");
}
if (System(cmd)==0) {
if (nameRtrn) {
strncpy(nameRtrn,outFile,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
}
if (outFile!=NULL)
_XkbFree(outFile);
if (cmd!=NULL)
xfree(cmd);
return True;
}
DebugF("Error compiling keymap (%s)\n",names->keymap);
if (outFile!=NULL)
_XkbFree(outFile);
if (cmd!=NULL)
xfree(cmd);
return False;
}
static Bool
XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
XkbComponentNamesPtr names,
@ -418,20 +350,7 @@ unsigned missing;
if ((names->keycodes==NULL)&&(names->types==NULL)&&
(names->compat==NULL)&&(names->symbols==NULL)&&
(names->geometry==NULL)) {
if (names->keymap==NULL) {
bzero(finfoRtrn,sizeof(XkbFileInfo));
if (xkb && XkbDetermineFileType(finfoRtrn,XkbXKMFile,NULL) &&
((finfoRtrn->defined&need)==need) ) {
finfoRtrn->xkb= xkb;
nameRtrn[0]= '\0';
return finfoRtrn->defined;
}
return 0;
}
else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
DebugF("Couldn't compile keymap file\n");
return 0;
}
return 0;
}
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
nameRtrn,nameRtrnLen)){

View File

@ -459,7 +459,7 @@ Bool append = False;
rule->types= _XkbDupString(tmp.name[TYPES]);
rule->compat= _XkbDupString(tmp.name[COMPAT]);
rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
rule->keymap= _XkbDupString(tmp.name[KEYMAP]);
rule->keymap= NULL;
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@ -589,7 +589,6 @@ XkbRF_ApplyRule( XkbRF_RulePtr rule,
Apply(rule->types, &names->types);
Apply(rule->compat, &names->compat);
Apply(rule->geometry, &names->geometry);
Apply(rule->keymap, &names->keymap);
}
static Bool
@ -1279,7 +1278,6 @@ XkbRF_GroupPtr group;
if (rule->types) _XkbFree(rule->types);
if (rule->compat) _XkbFree(rule->compat);
if (rule->geometry) _XkbFree(rule->geometry);
if (rule->keymap) _XkbFree(rule->keymap);
bzero((char *)rule,sizeof(XkbRF_RuleRec));
}
_XkbFree(rules->rules);

View File

@ -5157,25 +5157,20 @@ ProcXkbGetKbdByName(ClientPtr client)
if (stuff->load)
fwant= XkbGBN_AllComponentsMask;
else fwant= stuff->want|stuff->need;
if (!names.keymap) {
if ((!names.compat)&&
(fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
names.compat= _XkbDupString("%");
}
if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
names.types= _XkbDupString("%");
}
if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
names.symbols= _XkbDupString("%");
}
geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
names.geometry= _XkbDupString("%");
geom_changed= False;
}
if ((!names.compat)&&
(fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
names.compat= _XkbDupString("%");
}
else {
geom_changed= True;
if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
names.types= _XkbDupString("%");
}
if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
names.symbols= _XkbDupString("%");
}
geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
names.geometry= _XkbDupString("%");
geom_changed= False;
}
bzero(mapFile,PATH_MAX);

View File

@ -591,7 +591,7 @@ XkbRF_VarDefsRec defs;
* generation. Eventually they will be freed at the end of this
* function.
*/
if (names->keymap) names->keymap = _XkbDupString(names->keymap);
names->keymap = NULL;
if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes);
if (names->types) names->types = _XkbDupString(names->types);
if (names->compat) names->compat = _XkbDupString(names->compat);
@ -602,11 +602,6 @@ XkbRF_VarDefsRec defs;
XkbComponentNamesRec rNames;
bzero(&rNames,sizeof(XkbComponentNamesRec));
if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) {
if (rNames.keymap) {
if (!names->keymap)
names->keymap = rNames.keymap;
else _XkbFree(rNames.keymap);
}
if (rNames.keycodes) {
if (!names->keycodes)
names->keycodes = rNames.keycodes;
@ -637,16 +632,8 @@ XkbRF_VarDefsRec defs;
}
}
if (names->keymap) {
XkbComponentNamesRec tmpNames;
bzero(&tmpNames,sizeof(XkbComponentNamesRec));
tmpNames.keymap = names->keymap;
ok = (Bool) XkbDDXLoadKeymapByNames(dev,&tmpNames,XkmAllIndicesMask,0,
&finfo,name,PATH_MAX);
}
if (!(ok && (finfo.xkb!=NULL)))
ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
&finfo,name,PATH_MAX);
ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
&finfo,name,PATH_MAX);
if (ok && (finfo.xkb!=NULL)) {
XkbDescPtr xkb;
@ -694,8 +681,6 @@ XkbRF_VarDefsRec defs;
pSyms->map= NULL;
}
if (names->keymap) _XkbFree(names->keymap);
names->keymap = NULL;
if (names->keycodes) _XkbFree(names->keycodes);
names->keycodes = NULL;
if (names->types) _XkbFree(names->types);