Remove half-implemented radio groups

It looks like this could never have worked anyway, what with num_rg
always being 0 everywhere.  Remove it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-03-10 14:27:06 +00:00
parent e7c8bac79d
commit 24c61d0f78
4 changed files with 10 additions and 131 deletions

View File

@ -327,7 +327,6 @@ struct xkb_names {
xkb_keycode_t num_keys;
xkb_keycode_t num_key_aliases;
unsigned short num_rg;
};
struct xkb_controls {
@ -436,7 +435,6 @@ struct xkb_name_changes {
unsigned char first_lvl;
unsigned char num_lvls;
xkb_keycode_t num_aliases;
unsigned char num_rg;
xkb_keycode_t first_key;
xkb_keycode_t num_keys;
unsigned short changed_vmods;

View File

@ -188,33 +188,6 @@ SimpleLookup(const void * priv, xkb_atom_t field, unsigned type,
return False;
}
static Bool
RadioLookup(const void * priv, xkb_atom_t field, unsigned type, ExprResult * val_rtrn)
{
const char *str;
int rg;
if ((field == None) || (type != TypeInt))
return False;
str = XkbcAtomText(field);
if (str)
{
if (uStrCasePrefix("group", str))
str += strlen("group");
else if (uStrCasePrefix("radiogroup", str))
str += strlen("radiogroup");
else if (uStrCasePrefix("rg", str))
str += strlen("rg");
else if (!isdigit(str[0]))
str = NULL;
}
if ((!str) || (sscanf(str, "%i", &rg) < 1) || (rg < 1)
|| (rg > XkbMaxRadioGroups))
return False;
val_rtrn->uval = rg;
return True;
}
static const LookupEntry modIndexNames[] = {
{"shift", ShiftMapIndex},
{"control", ControlMapIndex},
@ -509,9 +482,8 @@ ExprResolveKeyCode(ExprDef * expr,
* returned as millimetres (rather than points) in ival.
*
* If an ident or field reference is given, the lookup function (if given)
* will be called. At the moment, only RadioLookup and SimpleLookup use
* this, and they both return the results in uval. And don't support field
* references.
* will be called. At the moment, only SimpleLookup use this, and they both
* return the results in uval. And don't support field references.
*
* Cool.
*/
@ -631,13 +603,6 @@ ExprResolveInteger(ExprDef * expr,
return ExprResolveIntegerLookup(expr, val_rtrn, NULL, NULL);
}
int
ExprResolveRadioGroup(ExprDef * expr,
ExprResult * val_rtrn)
{
return ExprResolveIntegerLookup(expr, val_rtrn, RadioLookup, NULL);
}
int
ExprResolveGroup(ExprDef * expr,
ExprResult * val_rtrn)

View File

@ -90,10 +90,6 @@ extern int ExprResolveInteger(ExprDef * /* expr */ ,
ExprResult * /* val_rtrn */
);
extern int ExprResolveRadioGroup(ExprDef * /* expr */ ,
ExprResult * /* val_rtrn */
);
extern int ExprResolveLevel(ExprDef * /* expr */ ,
ExprResult * /* val_rtrn */
);

View File

@ -1004,49 +1004,6 @@ AddActionsToKey(KeyInfo * key,
return True;
}
static int
SetAllowNone(KeyInfo * key, ExprDef * arrayNdx, ExprDef * value)
{
ExprResult tmp;
unsigned radio_groups = 0;
if (arrayNdx == NULL)
{
radio_groups = XkbAllRadioGroupsMask;
}
else
{
if (!ExprResolveRadioGroup(arrayNdx, &tmp))
{
ERROR("Illegal index in group name definition\n");
ACTION("Definition with non-integer array index ignored\n");
return False;
}
if ((tmp.uval < 1) || (tmp.uval > XkbMaxRadioGroups))
{
ERROR("Illegal radio group specified (must be 1..%d)\n",
XkbMaxRadioGroups + 1);
ACTION("Value of \"allow none\" for group %d ignored\n",
tmp.uval);
return False;
}
radio_groups |= (1 << (tmp.uval - 1));
}
if (!ExprResolveBoolean(value, &tmp))
{
ERROR("Illegal \"allow none\" value for %s\n",
longText(key->name));
ACTION("Non-boolean value ignored\n");
return False;
}
if (tmp.uval)
key->allowNone |= radio_groups;
else
key->allowNone &= ~radio_groups;
return True;
}
static const LookupEntry lockingEntries[] = {
{"true", XkbKB_Lock},
{"yes", XkbKB_Lock},
@ -1139,51 +1096,12 @@ SetSymbolsField(KeyInfo * key,
key->defs.defined |= _Key_Behavior;
}
else if ((uStrCaseCmp(field, "radiogroup") == 0) ||
(uStrCaseCmp(field, "permanentradiogroup") == 0))
(uStrCaseCmp(field, "permanentradiogroup") == 0) ||
(uStrCaseEqual(field, "allownone")))
{
Bool permanent = False;
if (uStrCaseCmp(field, "permanentradiogroup") == 0)
permanent = True;
if (ExprResolveString(value, &tmp)) {
ok = (strcmp(tmp.str, "none") == 0);
free(tmp.str);
if (ok)
tmp.uval = 0;
}
else {
ok = ExprResolveInteger(value, &tmp);
}
if (!ok)
{
ERROR("Illegal radio group specification for %s\n",
longText(key->name));
ACTION("Non-integer radio group ignored\n");
return False;
}
if (tmp.uval == 0)
{
key->behavior.type = XkbKB_Default;
key->behavior.data = 0;
return ok;
}
if ((tmp.uval < 1) || (tmp.uval > XkbMaxRadioGroups))
{
ERROR
("Radio group specification for %s out of range (1..32)\n",
longText(key->name));
ACTION("Illegal radio group %d ignored\n", tmp.uval);
return False;
}
key->behavior.type =
XkbKB_RadioGroup | (permanent ? XkbKB_Permanent : 0);
key->behavior.data = tmp.uval - 1;
if (key->allowNone & (1 << (tmp.uval - 1)))
key->behavior.data |= XkbKB_RGAllowNone;
key->defs.defined |= _Key_Behavior;
}
else if (uStrCaseEqual(field, "allownone"))
{
ok = SetAllowNone(key, arrayNdx, value);
ERROR("Radio groups not supported\n");
ACTION("Ignoring radio group specification for key %s\n", longText(key->name));
return False;
}
else if (uStrCasePrefix("overlay", field) ||
uStrCasePrefix("permanentoverlay", field))
@ -1414,7 +1332,9 @@ HandleSymbolsVar(VarDef * stmt, struct xkb_desc * xkb, SymbolsInfo * info)
}
else if ((elem.str == NULL) && (uStrCaseCmp(field.str, "allownone") == 0))
{
ret = SetAllowNone(&info->dflt, arrayNdx, stmt->value);
ERROR("Radio groups not supported\n");
ACTION("Ignoring \"allow none\" specification\n");
ret = False;
}
else {
ret = SetActionField(xkb, elem.str, field.str, arrayNdx, stmt->value,