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 <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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)) {