-HandleRedirectKey(struct xkb_keymap *keymap, union xkb_action *action,
- enum action_field field, const ExprDef *array_ndx,
- const ExprDef *value)
-{
- struct xkb_key *key;
- struct xkb_redirect_key_action *act = &action->redirect;
- unsigned t1;
- xkb_mod_mask_t t2;
- unsigned long tmp;
- char key_name[XKB_KEY_NAME_LENGTH];
-
- if (array_ndx != NULL)
- return ReportActionNotArray(keymap, action->type, field);
-
- switch (field) {
- case ACTION_FIELD_KEYCODE:
- if (!ExprResolveKeyName(keymap->ctx, value, key_name))
- return ReportMismatch(keymap, action->type, field, "key name");
-
- tmp = KeyNameToLong(key_name);
- key = FindNamedKey(keymap, tmp, true, 0);
- if (!key)
- return ReportNotFound(keymap, action->type, field, "Key",
- KeyNameText(key_name));
- act->new_kc = XkbKeyGetKeycode(keymap, key);
- return true;
-
- case ACTION_FIELD_MODS_TO_CLEAR:
- case ACTION_FIELD_MODIFIERS:
- t1 = 0;
- if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
- act->mods_mask |= (t2 & 0xff);
- if (field == ACTION_FIELD_MODIFIERS)
- act->mods |= (t2 & 0xff);
- else
- act->mods &= ~(t2 & 0xff);
-
- t2 = (t2 >> XkbNumModifiers) & 0xffff;
- act->vmods_mask |= t2;
- if (field == ACTION_FIELD_MODIFIERS)
- act->vmods |= t2;
- else
- act->vmods &= ~t2;
- return true;
- }
- return true;
-
- default:
- break;
- }
-
- return ReportIllegal(keymap, action->type, field);
-}
-
-static bool
-HandleDeviceBtn(struct xkb_keymap *keymap, union xkb_action *action,
- enum action_field field, const ExprDef *array_ndx,
- const ExprDef *value)
-{
- struct xkb_device_button_action *act = &action->devbtn;
-
- if (field == ACTION_FIELD_BUTTON) {
- int val;
-
- if (array_ndx)
- return ReportActionNotArray(keymap, action->type, field);
-
- if (!ExprResolveInteger(keymap->ctx, value, &val))
- return ReportMismatch(keymap, action->type, field,
- "integer (range 1..255)");
-
- if (val < 0 || val > 255) {
- log_err(keymap->ctx,
- "Button must specify default or be in the range 1..255; "
- "Illegal button value %d ignored\n", val);
- return false;
- }
-
- act->button = val;
- return true;
- }
- else if (action->type == XkbSA_LockDeviceBtn &&
- field == ACTION_FIELD_AFFECT) {
- unsigned int val;
-
- if (array_ndx)
- return ReportActionNotArray(keymap, action->type, field);
-
- if (!ExprResolveEnum(keymap->ctx, value, &val, lockWhich))
- return ReportMismatch(keymap, action->type, field,
- "lock or unlock");
-
- act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
- act->flags |= val;
- return true;
- }
- else if (field == ACTION_FIELD_COUNT) {
- int btn;
-
- if (array_ndx)
- return ReportActionNotArray(keymap, action->type, field);
-
- /* XXX: Should this actually be ResolveButton? */
- if (!ExprResolveButton(keymap->ctx, value, &btn))
- return ReportMismatch(keymap, action->type, field, "integer");
-
- if (btn < 0 || btn > 255) {
- log_err(keymap->ctx,
- "The count field must have a value in the range 0..255; "
- "Illegal count %d ignored\n", btn);
- return false;
- }
-
- act->count = btn;
- return true;
- }
- else if (field == ACTION_FIELD_DEVICE) {
- int val;
-
- if (array_ndx)
- return ReportActionNotArray(keymap, action->type, field);
-
- if (!ExprResolveInteger(keymap->ctx, value, &val))
- return ReportMismatch(keymap, action->type, field,
- "integer (range 1..255)");
-
- if (val < 0 || val > 255) {
- log_err(keymap->ctx,
- "Device must specify default or be in the range 1..255; "
- "Illegal device value %d ignored\n", val);
- return false;
- }
-
- act->device = val;
- return true;
- }
-
- return ReportIllegal(keymap, action->type, field);
-}
-
-static bool
-HandleDeviceValuator(struct xkb_keymap *keymap, union xkb_action *action,
- enum action_field field, const ExprDef *array_ndx,
- const ExprDef *value)
-{
- struct xkb_device_valuator_action *act = &action->devval;
- (void) act;
-
- /* XXX - Not yet implemented */
- return false;
-}
-
-static bool
-HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
- enum action_field field, const ExprDef *array_ndx,
- const ExprDef *value)