From 24c61d0f78e4de77041568c2114c4f1e7e19a0b0 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sat, 10 Mar 2012 14:27:06 +0000 Subject: [PATCH] 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 --- include/xkbcommon/xkbcommon.h | 2 - src/xkbcomp/expr.c | 39 +----------------- src/xkbcomp/expr.h | 4 -- src/xkbcomp/symbols.c | 96 ++++--------------------------------------- 4 files changed, 10 insertions(+), 131 deletions(-) diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h index ac7b848..4ef3dd2 100644 --- a/include/xkbcommon/xkbcommon.h +++ b/include/xkbcommon/xkbcommon.h @@ -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; diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c index d912631..60467cd 100644 --- a/src/xkbcomp/expr.c +++ b/src/xkbcomp/expr.c @@ -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. */ @@ -632,13 +604,6 @@ ExprResolveInteger(ExprDef * expr, } int -ExprResolveRadioGroup(ExprDef * expr, - ExprResult * val_rtrn) -{ - return ExprResolveIntegerLookup(expr, val_rtrn, RadioLookup, NULL); -} - -int ExprResolveGroup(ExprDef * expr, ExprResult * val_rtrn) { diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h index c990351..414ff02 100644 --- a/src/xkbcomp/expr.h +++ b/src/xkbcomp/expr.h @@ -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 */ ); diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 0d430c4..dfaf547 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -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, -- 2.7.4