if (!suffix)
suffix = "";
- type = ActionTypeText(action->any.type);
+ type = ActionTypeText(action->type);
- switch (action->any.type) {
+ switch (action->type) {
case XkbSA_SetMods:
case XkbSA_LatchMods:
case XkbSA_LockMods:
else
args = VModMaskText(keymap, action->mods.mods.mods);
write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args,
- (action->any.type != XkbSA_LockGroup &&
+ (action->type != XkbSA_LockGroup &&
(action->mods.flags & XkbSA_ClearLocks)) ?
",clearLocks" : "",
- (action->any.type != XkbSA_LockGroup &&
+ (action->type != XkbSA_LockGroup &&
(action->mods.flags & XkbSA_LatchToLock)) ?
",latchToLock" : "",
suffix);
action->group.group > 0) ? "+" : "",
(action->group.flags & XkbSA_GroupAbsolute) ?
action->group.group + 1 : action->group.group,
- (action->any.type != XkbSA_LockGroup &&
+ (action->type != XkbSA_LockGroup &&
(action->group.flags & XkbSA_ClearLocks)) ?
",clearLocks" : "",
- (action->any.type != XkbSA_LockGroup &&
+ (action->type != XkbSA_LockGroup &&
(action->group.flags & XkbSA_LatchToLock)) ?
",latchToLock" : "",
suffix);
default:
write_buf(buf,
"%s%s(type=0x%02x,data[0]=0x%02x,data[1]=0x%02x,data[2]=0x%02x,data[3]=0x%02x,data[4]=0x%02x,data[5]=0x%02x,data[6]=0x%02x)%s",
- prefix, type, action->any.type, action->any.data[0],
- action->any.data[1], action->any.data[2],
- action->any.data[3], action->any.data[4],
- action->any.data[5], action->any.data[6],
+ prefix, type, action->type, action->priv.data[0],
+ action->priv.data[1], action->priv.data[2],
+ action->priv.data[3], action->priv.data[4],
+ action->priv.data[5], action->priv.data[6],
suffix);
break;
}
}
static bool
-HandleNoAction(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
{
}
static bool
-HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleSetLatchMods(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_mod_action *act;
+ struct xkb_mod_action *act = &action->mods;
unsigned rtrn;
unsigned t1;
xkb_mod_mask_t t2;
- act = (struct xkb_mod_action *) action;
if (array_ndx != NULL) {
switch (field) {
case F_ClearLocks:
}
static bool
-HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleLockMods(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
{
- struct xkb_mod_action *act;
+ struct xkb_mod_action *act = &action->mods;
unsigned t1;
xkb_mod_mask_t t2;
- act = (struct xkb_mod_action *) action;
if ((array_ndx != NULL) && (field == F_Modifiers))
return ReportActionNotArray(keymap, action->type, field);
switch (field) {
}
static bool
-HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleSetLatchGroup(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_group_action *act;
+ struct xkb_group_action *act = &action->group;
unsigned rtrn;
unsigned t1;
xkb_group_index_t t2;
- act = (struct xkb_group_action *) action;
if (array_ndx != NULL) {
switch (field) {
case F_ClearLocks:
}
static bool
-HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleLockGroup(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_group_action *act;
+ struct xkb_group_action *act = &action->group;
unsigned t1;
xkb_group_index_t t2;
- act = (struct xkb_group_action *) action;
if ((array_ndx != NULL) && (field == F_Group))
return ReportActionNotArray(keymap, action->type, field);
if (field == F_Group) {
}
static bool
-HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
{
- struct xkb_pointer_action *act;
+ struct xkb_pointer_action *act = &action->ptr;
bool absolute;
- act = (struct xkb_pointer_action *) action;
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
return ReportActionNotArray(keymap, action->type, field);
};
static bool
-HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
{
- struct xkb_pointer_button_action *act;
+ struct xkb_pointer_button_action *act = &action->btn;
- act = (struct xkb_pointer_button_action *) action;
if (field == F_Button) {
int btn;
};
static bool
-HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_pointer_default_action *act;
+ struct xkb_pointer_default_action *act = &action->dflt;
- act = (struct xkb_pointer_default_action *) action;
if (field == F_Affect) {
unsigned int val;
};
static bool
-HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleISOLock(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
{
- struct xkb_iso_action *act;
+ struct xkb_iso_action *act = &action->iso;
- act = (struct xkb_iso_action *) action;
if (field == F_Modifiers) {
unsigned flags;
xkb_mod_mask_t mods;
}
static bool
-HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_switch_screen_action *act;
+ struct xkb_switch_screen_action *act = &action->screen;
- act = (struct xkb_switch_screen_action *) action;
if (field == F_Screen) {
const ExprDef *scrn;
int val;
static bool
HandleSetLockControls(struct xkb_keymap *keymap,
- struct xkb_any_action *action,
+ union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_controls_action *act;
+ struct xkb_controls_action *act = &action->ctrls;
- act = (struct xkb_controls_action *) action;
if (field == F_Controls) {
unsigned int mask;
};
static bool
-HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleActionMessage(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_message_action *act;
+ struct xkb_message_action *act = &action->msg;
- act = (struct xkb_message_action *) action;
if (field == F_Report) {
unsigned int mask;
}
static bool
-HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleRedirectKey(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
struct xkb_key *key;
- struct xkb_redirect_key_action *act;
+ struct xkb_redirect_key_action *act = &action->redirect;
unsigned t1;
xkb_mod_mask_t t2;
unsigned long tmp;
if (array_ndx != NULL)
return ReportActionNotArray(keymap, action->type, field);
- act = (struct xkb_redirect_key_action *) action;
switch (field) {
case F_Keycode:
if (!ExprResolveKeyName(keymap->ctx, value, key_name))
}
static bool
-HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleDeviceBtn(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
- struct xkb_device_button_action *act;
+ struct xkb_device_button_action *act = &action->devbtn;
- act = (struct xkb_device_button_action *) action;
if (field == F_Button) {
int val;
}
static bool
-HandleDeviceValuator(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandleDeviceValuator(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx,
const ExprDef *value)
{
-#if 0
- ExprResult rtrn;
- struct xkb_device_valuator_action *act;
+ struct xkb_device_valuator_action *act = &action->devval;
+ (void) act;
- act = (struct xkb_device_valuator_action *) action;
/* XXX - Not yet implemented */
-#endif
return false;
}
static bool
-HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
+HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
{
+ struct xkb_private_action *act = &action->priv;
+
if (field == F_Type) {
int type;
return false;
}
- action->type = (uint8_t) type;
+ act->type = (uint8_t) type;
return true;
}
else if (field == F_Data) {
return false;
}
- strncpy((char *) action->data, str, sizeof(action->data));
+ strncpy((char *) act->data, str, sizeof(act->data));
return true;
}
else {
return false;
}
- if (ndx < 0 || ndx >= sizeof(action->data)) {
+ if (ndx < 0 || ndx >= sizeof(act->data)) {
log_err(keymap->ctx,
"The data for a private action is %zu bytes long; "
"Attempt to use data[%d] ignored\n",
- sizeof(action->data), ndx);
+ sizeof(act->data), ndx);
return false;
}
if (!ExprResolveInteger(keymap->ctx, value, &datum))
- return ReportMismatch(keymap, action->type, field, "integer");
+ return ReportMismatch(keymap, act->type, field, "integer");
if (datum < 0 || datum > 255) {
log_err(keymap->ctx,
return false;
}
- action->data[ndx] = (uint8_t) datum;
+ act->data[ndx] = (uint8_t) datum;
return true;
}
}
}
typedef bool (*actionHandler)(struct xkb_keymap *keymap,
- struct xkb_any_action *action, unsigned field,
+ union xkb_action *action, unsigned field,
const ExprDef *array_ndx, const ExprDef *value);
static const actionHandler handleAction[XkbSA_NumActions + 1] = {
int
HandleActionDef(ExprDef * def,
struct xkb_keymap *keymap,
- struct xkb_any_action *action, ActionInfo *info)
+ union xkb_action *action, ActionInfo *info)
{
ExprDef *arg;
const char *str;