Add XkbModIndexText replacement

Now, I think we should have all the *Text functions we need.
master
Dan Nicholson 2009-03-28 15:32:51 -07:00
parent a59ce8f525
commit a53b9b1ed3
3 changed files with 27 additions and 8 deletions

View File

@ -247,6 +247,9 @@ XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx);
extern char * extern char *
XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask); XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
extern char *
XkbcModIndexText(unsigned ndx);
extern char * extern char *
XkbcModMaskText(unsigned mask, Bool cFormat); XkbcModMaskText(unsigned mask, Bool cFormat);

View File

@ -247,6 +247,22 @@ static char *modNames[XkbNumModifiers] = {
"Mod5" "Mod5"
}; };
char *
XkbcModIndexText(unsigned ndx)
{
char *buf;
if (ndx < XkbNumModifiers)
return modNames[ndx];
else if (ndx == XkbNoModifier)
return "none";
buf = tbGetBuffer(32);
snprintf(buf, 32, "ILLEGAL_%02x", ndx);
return buf;
}
char * char *
XkbcModMaskText(unsigned mask, Bool cFormat) XkbcModMaskText(unsigned mask, Bool cFormat)
{ {

View File

@ -662,8 +662,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
("%s added to symbol map for multiple modifiers\n", ("%s added to symbol map for multiple modifiers\n",
XkbcKeysymText(new->u.keySym)); XkbcKeysymText(new->u.keySym));
ACTION2("Using %s, ignoring %s.\n", ACTION2("Using %s, ignoring %s.\n",
XkbModIndexText(use, XkbMessage), XkbcModIndexText(use),
XkbModIndexText(ignore, XkbMessage)); XkbcModIndexText(ignore));
mm->modifier = use; mm->modifier = use;
} }
return True; return True;
@ -687,8 +687,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
ERROR1("Key %s added to map for multiple modifiers\n", ERROR1("Key %s added to map for multiple modifiers\n",
longText(new->u.keyName)); longText(new->u.keyName));
ACTION2("Using %s, ignoring %s.\n", ACTION2("Using %s, ignoring %s.\n",
XkbModIndexText(use, XkbMessage), XkbcModIndexText(use),
XkbModIndexText(ignore, XkbMessage)); XkbcModIndexText(ignore));
mm->modifier = use; mm->modifier = use;
} }
return True; return True;
@ -699,7 +699,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
{ {
WSGO("Could not allocate modifier map entry\n"); WSGO("Could not allocate modifier map entry\n");
ACTION1("Modifier map for %s will be incomplete\n", ACTION1("Modifier map for %s will be incomplete\n",
XkbModIndexText(new->modifier, XkbMessage)); XkbcModIndexText(new->modifier));
return False; return False;
} }
*mm = *new; *mm = *new;
@ -1623,7 +1623,7 @@ HandleModMapDef(ModMapDef * def,
{ {
ERROR("Modmap entries may contain only key names or keysyms\n"); ERROR("Modmap entries may contain only key names or keysyms\n");
ACTION1("Illegal definition for %s modifier ignored\n", ACTION1("Illegal definition for %s modifier ignored\n",
XkbModIndexText(tmp.modifier, XkbMessage)); XkbcModIndexText(tmp.modifier));
continue; continue;
} }
@ -2166,7 +2166,7 @@ CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry)
longText(entry->u.keyName), longText(entry->u.keyName),
XkbcAtomText(xkb->names->keycodes)); XkbcAtomText(xkb->names->keycodes));
ACTION1("Modifier map entry for %s not updated\n", ACTION1("Modifier map entry for %s not updated\n",
XkbModIndexText(entry->modifier, XkbMessage)); XkbcModIndexText(entry->modifier));
} }
return False; return False;
} }
@ -2179,7 +2179,7 @@ CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry)
XkbcKeysymText(entry->u.keySym), XkbcKeysymText(entry->u.keySym),
XkbcAtomText(xkb->names->symbols)); XkbcAtomText(xkb->names->symbols));
ACTION1("Modifier map entry for %s not updated\n", ACTION1("Modifier map entry for %s not updated\n",
XkbModIndexText(entry->modifier, XkbMessage)); XkbcModIndexText(entry->modifier));
} }
return False; return False;
} }