Commit a53b9b1ed397323bd2f0d2d2e9130fabad824b83

Dan Nicholson 2009-03-28T15:32:51

Add XkbModIndexText replacement Now, I think we should have all the *Text functions we need.

diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h
index d857ff2..b207219 100644
--- a/include/X11/extensions/XKBcommon.h
+++ b/include/X11/extensions/XKBcommon.h
@@ -248,6 +248,9 @@ extern char *
 XkbcVModMaskText(XkbcDescPtr xkb, unsigned modMask, unsigned mask);
 
 extern char *
+XkbcModIndexText(unsigned ndx);
+
+extern char *
 XkbcModMaskText(unsigned mask, Bool cFormat);
 
 extern char *
diff --git a/src/text.c b/src/text.c
index 1b24cf6..207177e 100644
--- a/src/text.c
+++ b/src/text.c
@@ -248,6 +248,22 @@ static char *modNames[XkbNumModifiers] = {
 };
 
 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 *
 XkbcModMaskText(unsigned mask, Bool cFormat)
 {
     int i, rem, bit;
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 0f5ae27..f8d8ddf 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -662,8 +662,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
                     ("%s added to symbol map for multiple modifiers\n",
                      XkbcKeysymText(new->u.keySym));
                 ACTION2("Using %s, ignoring %s.\n",
-                        XkbModIndexText(use, XkbMessage),
-                        XkbModIndexText(ignore, XkbMessage));
+                        XkbcModIndexText(use),
+                        XkbcModIndexText(ignore));
                 mm->modifier = use;
             }
             return True;
@@ -687,8 +687,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
                 ERROR1("Key %s added to map for multiple modifiers\n",
                        longText(new->u.keyName));
                 ACTION2("Using %s, ignoring %s.\n",
-                        XkbModIndexText(use, XkbMessage),
-                        XkbModIndexText(ignore, XkbMessage));
+                        XkbcModIndexText(use),
+                        XkbcModIndexText(ignore));
                 mm->modifier = use;
             }
             return True;
@@ -699,7 +699,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
     {
         WSGO("Could not allocate modifier map entry\n");
         ACTION1("Modifier map for %s will be incomplete\n",
-                XkbModIndexText(new->modifier, XkbMessage));
+                XkbcModIndexText(new->modifier));
         return False;
     }
     *mm = *new;
@@ -1623,7 +1623,7 @@ HandleModMapDef(ModMapDef * def,
         {
             ERROR("Modmap entries may contain only key names or keysyms\n");
             ACTION1("Illegal definition for %s modifier ignored\n",
-                    XkbModIndexText(tmp.modifier, XkbMessage));
+                    XkbcModIndexText(tmp.modifier));
             continue;
         }
 
@@ -2166,7 +2166,7 @@ CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry)
                   longText(entry->u.keyName),
                   XkbcAtomText(xkb->names->keycodes));
             ACTION1("Modifier map entry for %s not updated\n",
-                    XkbModIndexText(entry->modifier, XkbMessage));
+                    XkbcModIndexText(entry->modifier));
         }
         return False;
     }
@@ -2179,7 +2179,7 @@ CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry)
                   XkbcKeysymText(entry->u.keySym),
                   XkbcAtomText(xkb->names->symbols));
             ACTION1("Modifier map entry for %s not updated\n",
-                    XkbModIndexText(entry->modifier, XkbMessage));
+                    XkbcModIndexText(entry->modifier));
         }
         return False;
     }