From 4ca85c7b3b46fb8d54d884a13c29cc78967f2313 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 2 Sep 2012 16:16:57 +0300 Subject: [PATCH] action: disallow setting an action_field default for all types Currently where it is possible to write: setMods.clearLocks = True; It's also possible to write: action.clearLocks = True; This will set the default value for the clearLocks action field for *all* action types, as opposed to just setMods in this case. If subsequently an action is used for which this field does not make sense, it will error out. This doesn't make any sense, because any given field is only possible by at most 3 or 4 action types... which you might as well write explicitly and avoid the side effect mentioned above. Needless to say this is one of xkbcomp's "hidden features" and is not used anywhere; remove it. Signed-off-by: Ran Benita --- src/xkbcomp/action.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 4a8d20d..36a18dc 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -1271,7 +1271,7 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, ApplyActionFactoryDefaults(action); for (; info; info = info->next) { - if (info->action != XkbSA_NoAction && info->action != hndlrType) + if (info->action != hndlrType) continue; if (!handleAction[hndlrType](keymap, action, info->field, @@ -1342,19 +1342,14 @@ SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field, goto err; } - if (istreq(elem, "action")) { - new->action = XkbSA_NoAction; - } - else { - if (!stringToAction(elem, &new->action)) - goto err; + if (!stringToAction(elem, &new->action)) + goto err; - if (new->action == XkbSA_NoAction) { - log_err(keymap->ctx, - "\"%s\" is not a valid field in a NoAction action\n", - field); - goto err; - } + if (new->action == XkbSA_NoAction) { + log_err(keymap->ctx, + "\"%s\" is not a valid field in a NoAction action\n", + field); + goto err; } if (!stringToField(field, &new->field)) { -- 2.7.4