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>master
parent
ba9f66bda3
commit
4ca85c7b3b
|
@ -1271,7 +1271,7 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
|
||||||
ApplyActionFactoryDefaults(action);
|
ApplyActionFactoryDefaults(action);
|
||||||
|
|
||||||
for (; info; info = info->next) {
|
for (; info; info = info->next) {
|
||||||
if (info->action != XkbSA_NoAction && info->action != hndlrType)
|
if (info->action != hndlrType)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!handleAction[hndlrType](keymap, action, info->field,
|
if (!handleAction[hndlrType](keymap, action, info->field,
|
||||||
|
@ -1342,10 +1342,6 @@ SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (istreq(elem, "action")) {
|
|
||||||
new->action = XkbSA_NoAction;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!stringToAction(elem, &new->action))
|
if (!stringToAction(elem, &new->action))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -1355,7 +1351,6 @@ SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field,
|
||||||
field);
|
field);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!stringToField(field, &new->field)) {
|
if (!stringToField(field, &new->field)) {
|
||||||
log_err(keymap->ctx, "\"%s\" is not a legal field name\n", field);
|
log_err(keymap->ctx, "\"%s\" is not a legal field name\n", field);
|
||||||
|
|
Loading…
Reference in New Issue