action: get rid of xkb_any_action
And use union xkb_action instead. We add xkb_private_action, which is the same as xkb_any_action, but only used where the intention is clear. This should take care of whatever sizing changes the action struct might have. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
600caac33a
commit
4c34bda15a
|
@ -397,9 +397,9 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
if (!suffix)
|
if (!suffix)
|
||||||
suffix = "";
|
suffix = "";
|
||||||
|
|
||||||
type = ActionTypeText(action->any.type);
|
type = ActionTypeText(action->type);
|
||||||
|
|
||||||
switch (action->any.type) {
|
switch (action->type) {
|
||||||
case XkbSA_SetMods:
|
case XkbSA_SetMods:
|
||||||
case XkbSA_LatchMods:
|
case XkbSA_LatchMods:
|
||||||
case XkbSA_LockMods:
|
case XkbSA_LockMods:
|
||||||
|
@ -408,10 +408,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
else
|
else
|
||||||
args = VModMaskText(keymap, action->mods.mods.mods);
|
args = VModMaskText(keymap, action->mods.mods.mods);
|
||||||
write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args,
|
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)) ?
|
(action->mods.flags & XkbSA_ClearLocks)) ?
|
||||||
",clearLocks" : "",
|
",clearLocks" : "",
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->type != XkbSA_LockGroup &&
|
||||||
(action->mods.flags & XkbSA_LatchToLock)) ?
|
(action->mods.flags & XkbSA_LatchToLock)) ?
|
||||||
",latchToLock" : "",
|
",latchToLock" : "",
|
||||||
suffix);
|
suffix);
|
||||||
|
@ -425,10 +425,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
action->group.group > 0) ? "+" : "",
|
action->group.group > 0) ? "+" : "",
|
||||||
(action->group.flags & XkbSA_GroupAbsolute) ?
|
(action->group.flags & XkbSA_GroupAbsolute) ?
|
||||||
action->group.group + 1 : action->group.group,
|
action->group.group + 1 : action->group.group,
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->type != XkbSA_LockGroup &&
|
||||||
(action->group.flags & XkbSA_ClearLocks)) ?
|
(action->group.flags & XkbSA_ClearLocks)) ?
|
||||||
",clearLocks" : "",
|
",clearLocks" : "",
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->type != XkbSA_LockGroup &&
|
||||||
(action->group.flags & XkbSA_LatchToLock)) ?
|
(action->group.flags & XkbSA_LatchToLock)) ?
|
||||||
",latchToLock" : "",
|
",latchToLock" : "",
|
||||||
suffix);
|
suffix);
|
||||||
|
@ -521,10 +521,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
||||||
default:
|
default:
|
||||||
write_buf(buf,
|
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",
|
"%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],
|
prefix, type, action->type, action->priv.data[0],
|
||||||
action->any.data[1], action->any.data[2],
|
action->priv.data[1], action->priv.data[2],
|
||||||
action->any.data[3], action->any.data[4],
|
action->priv.data[3], action->priv.data[4],
|
||||||
action->any.data[5], action->any.data[6],
|
action->priv.data[5], action->priv.data[6],
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,11 +148,6 @@ struct xkb_mods {
|
||||||
xkb_mod_mask_t mask; /* computed effective mask */
|
xkb_mod_mask_t mask; /* computed effective mask */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xkb_any_action {
|
|
||||||
uint8_t type;
|
|
||||||
uint8_t data[7];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct xkb_mod_action {
|
struct xkb_mod_action {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
|
@ -240,8 +235,12 @@ struct xkb_pointer_button_action {
|
||||||
int8_t button;
|
int8_t button;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct xkb_private_action {
|
||||||
|
uint8_t type;
|
||||||
|
uint8_t data[7];
|
||||||
|
};
|
||||||
|
|
||||||
union xkb_action {
|
union xkb_action {
|
||||||
struct xkb_any_action any;
|
|
||||||
struct xkb_mod_action mods;
|
struct xkb_mod_action mods;
|
||||||
struct xkb_group_action group;
|
struct xkb_group_action group;
|
||||||
struct xkb_iso_action iso;
|
struct xkb_iso_action iso;
|
||||||
|
@ -254,6 +253,7 @@ union xkb_action {
|
||||||
struct xkb_pointer_action ptr; /* XXX delete for DeviceValuator */
|
struct xkb_pointer_action ptr; /* XXX delete for DeviceValuator */
|
||||||
struct xkb_pointer_button_action btn; /* XXX delete for DeviceBtn */
|
struct xkb_pointer_button_action btn; /* XXX delete for DeviceBtn */
|
||||||
struct xkb_message_action msg; /* XXX just delete */
|
struct xkb_message_action msg; /* XXX just delete */
|
||||||
|
struct xkb_private_action priv;
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ ReportNotFound(struct xkb_keymap *keymap, unsigned action, unsigned field,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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)
|
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -277,16 +277,15 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
const ExprDef *value)
|
||||||
{
|
{
|
||||||
struct xkb_mod_action *act;
|
struct xkb_mod_action *act = &action->mods;
|
||||||
unsigned rtrn;
|
unsigned rtrn;
|
||||||
unsigned t1;
|
unsigned t1;
|
||||||
xkb_mod_mask_t t2;
|
xkb_mod_mask_t t2;
|
||||||
|
|
||||||
act = (struct xkb_mod_action *) action;
|
|
||||||
if (array_ndx != NULL) {
|
if (array_ndx != NULL) {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case F_ClearLocks:
|
case F_ClearLocks:
|
||||||
|
@ -318,14 +317,13 @@ HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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)
|
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||||
{
|
{
|
||||||
struct xkb_mod_action *act;
|
struct xkb_mod_action *act = &action->mods;
|
||||||
unsigned t1;
|
unsigned t1;
|
||||||
xkb_mod_mask_t t2;
|
xkb_mod_mask_t t2;
|
||||||
|
|
||||||
act = (struct xkb_mod_action *) action;
|
|
||||||
if ((array_ndx != NULL) && (field == F_Modifiers))
|
if ((array_ndx != NULL) && (field == F_Modifiers))
|
||||||
return ReportActionNotArray(keymap, action->type, field);
|
return ReportActionNotArray(keymap, action->type, field);
|
||||||
switch (field) {
|
switch (field) {
|
||||||
|
@ -370,16 +368,15 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
const ExprDef *value)
|
||||||
{
|
{
|
||||||
struct xkb_group_action *act;
|
struct xkb_group_action *act = &action->group;
|
||||||
unsigned rtrn;
|
unsigned rtrn;
|
||||||
unsigned t1;
|
unsigned t1;
|
||||||
xkb_group_index_t t2;
|
xkb_group_index_t t2;
|
||||||
|
|
||||||
act = (struct xkb_group_action *) action;
|
|
||||||
if (array_ndx != NULL) {
|
if (array_ndx != NULL) {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case F_ClearLocks:
|
case F_ClearLocks:
|
||||||
|
@ -411,15 +408,14 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
const ExprDef *value)
|
||||||
{
|
{
|
||||||
struct xkb_group_action *act;
|
struct xkb_group_action *act = &action->group;
|
||||||
unsigned t1;
|
unsigned t1;
|
||||||
xkb_group_index_t t2;
|
xkb_group_index_t t2;
|
||||||
|
|
||||||
act = (struct xkb_group_action *) action;
|
|
||||||
if ((array_ndx != NULL) && (field == F_Group))
|
if ((array_ndx != NULL) && (field == F_Group))
|
||||||
return ReportActionNotArray(keymap, action->type, field);
|
return ReportActionNotArray(keymap, action->type, field);
|
||||||
if (field == F_Group) {
|
if (field == F_Group) {
|
||||||
|
@ -435,13 +431,12 @@ HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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)
|
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||||
{
|
{
|
||||||
struct xkb_pointer_action *act;
|
struct xkb_pointer_action *act = &action->ptr;
|
||||||
bool absolute;
|
bool absolute;
|
||||||
|
|
||||||
act = (struct xkb_pointer_action *) action;
|
|
||||||
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
|
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
|
||||||
return ReportActionNotArray(keymap, action->type, field);
|
return ReportActionNotArray(keymap, action->type, field);
|
||||||
|
|
||||||
|
@ -493,12 +488,11 @@ static const LookupEntry lockWhich[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
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)
|
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) {
|
if (field == F_Button) {
|
||||||
int btn;
|
int btn;
|
||||||
|
|
||||||
|
@ -564,13 +558,12 @@ static const LookupEntry ptrDflts[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
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) {
|
if (field == F_Affect) {
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
|
@ -638,12 +631,11 @@ static const LookupEntry isoNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
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)
|
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) {
|
if (field == F_Modifiers) {
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
xkb_mod_mask_t mods;
|
xkb_mod_mask_t mods;
|
||||||
|
@ -691,13 +683,12 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
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) {
|
if (field == F_Screen) {
|
||||||
const ExprDef *scrn;
|
const ExprDef *scrn;
|
||||||
int val;
|
int val;
|
||||||
|
@ -771,13 +762,12 @@ const LookupEntry ctrlNames[] = {
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
HandleSetLockControls(struct xkb_keymap *keymap,
|
HandleSetLockControls(struct xkb_keymap *keymap,
|
||||||
struct xkb_any_action *action,
|
union xkb_action *action,
|
||||||
unsigned field, const ExprDef *array_ndx,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
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) {
|
if (field == F_Controls) {
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
|
|
||||||
|
@ -806,13 +796,12 @@ static const LookupEntry evNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
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) {
|
if (field == F_Report) {
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
|
|
||||||
|
@ -896,12 +885,12 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
const ExprDef *value)
|
||||||
{
|
{
|
||||||
struct xkb_key *key;
|
struct xkb_key *key;
|
||||||
struct xkb_redirect_key_action *act;
|
struct xkb_redirect_key_action *act = &action->redirect;
|
||||||
unsigned t1;
|
unsigned t1;
|
||||||
xkb_mod_mask_t t2;
|
xkb_mod_mask_t t2;
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
|
@ -910,7 +899,6 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(keymap, action->type, field);
|
return ReportActionNotArray(keymap, action->type, field);
|
||||||
|
|
||||||
act = (struct xkb_redirect_key_action *) action;
|
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case F_Keycode:
|
case F_Keycode:
|
||||||
if (!ExprResolveKeyName(keymap->ctx, value, key_name))
|
if (!ExprResolveKeyName(keymap->ctx, value, key_name))
|
||||||
|
@ -948,13 +936,12 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
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) {
|
if (field == F_Button) {
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
@ -1034,24 +1021,23 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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,
|
unsigned field, const ExprDef *array_ndx,
|
||||||
const ExprDef *value)
|
const ExprDef *value)
|
||||||
{
|
{
|
||||||
#if 0
|
struct xkb_device_valuator_action *act = &action->devval;
|
||||||
ExprResult rtrn;
|
(void) act;
|
||||||
struct xkb_device_valuator_action *act;
|
|
||||||
|
|
||||||
act = (struct xkb_device_valuator_action *) action;
|
|
||||||
/* XXX - Not yet implemented */
|
/* XXX - Not yet implemented */
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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)
|
unsigned field, const ExprDef *array_ndx, const ExprDef *value)
|
||||||
{
|
{
|
||||||
|
struct xkb_private_action *act = &action->priv;
|
||||||
|
|
||||||
if (field == F_Type) {
|
if (field == F_Type) {
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
@ -1065,7 +1051,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
action->type = (uint8_t) type;
|
act->type = (uint8_t) type;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (field == F_Data) {
|
else if (field == F_Data) {
|
||||||
|
@ -1084,7 +1070,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy((char *) action->data, str, sizeof(action->data));
|
strncpy((char *) act->data, str, sizeof(act->data));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1097,16 +1083,16 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ndx < 0 || ndx >= sizeof(action->data)) {
|
if (ndx < 0 || ndx >= sizeof(act->data)) {
|
||||||
log_err(keymap->ctx,
|
log_err(keymap->ctx,
|
||||||
"The data for a private action is %zu bytes long; "
|
"The data for a private action is %zu bytes long; "
|
||||||
"Attempt to use data[%d] ignored\n",
|
"Attempt to use data[%d] ignored\n",
|
||||||
sizeof(action->data), ndx);
|
sizeof(act->data), ndx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &datum))
|
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) {
|
if (datum < 0 || datum > 255) {
|
||||||
log_err(keymap->ctx,
|
log_err(keymap->ctx,
|
||||||
|
@ -1115,7 +1101,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
action->data[ndx] = (uint8_t) datum;
|
act->data[ndx] = (uint8_t) datum;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1124,7 +1110,7 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef bool (*actionHandler)(struct xkb_keymap *keymap,
|
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);
|
const ExprDef *array_ndx, const ExprDef *value);
|
||||||
|
|
||||||
static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
||||||
|
@ -1170,7 +1156,7 @@ ApplyActionFactoryDefaults(union xkb_action * action)
|
||||||
int
|
int
|
||||||
HandleActionDef(ExprDef * def,
|
HandleActionDef(ExprDef * def,
|
||||||
struct xkb_keymap *keymap,
|
struct xkb_keymap *keymap,
|
||||||
struct xkb_any_action *action, ActionInfo *info)
|
union xkb_action *action, ActionInfo *info)
|
||||||
{
|
{
|
||||||
ExprDef *arg;
|
ExprDef *arg;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
|
@ -68,7 +68,7 @@ typedef struct _ActionInfo {
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
|
HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
|
||||||
struct xkb_any_action *action,
|
union xkb_action *action,
|
||||||
ActionInfo *info);
|
ActionInfo *info);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
|
|
|
@ -158,8 +158,6 @@ ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo * info)
|
||||||
static void
|
static void
|
||||||
InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id)
|
InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
info->keymap = keymap;
|
info->keymap = keymap;
|
||||||
info->name = NULL;
|
info->name = NULL;
|
||||||
info->file_id = file_id;
|
info->file_id = file_id;
|
||||||
|
@ -172,9 +170,8 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id)
|
||||||
info->dflt.merge = MERGE_OVERRIDE;
|
info->dflt.merge = MERGE_OVERRIDE;
|
||||||
info->dflt.interp.flags = 0;
|
info->dflt.interp.flags = 0;
|
||||||
info->dflt.interp.virtual_mod = XkbNoModifier;
|
info->dflt.interp.virtual_mod = XkbNoModifier;
|
||||||
|
memset(&info->dflt.interp.act, 0, sizeof(info->dflt.interp.act));
|
||||||
info->dflt.interp.act.type = XkbSA_NoAction;
|
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||||
for (i = 0; i < sizeof(info->dflt.interp.act.any.data); i++)
|
|
||||||
info->dflt.interp.act.any.data[i] = 0;
|
|
||||||
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
||||||
info->ledDflt.file_id = file_id;
|
info->ledDflt.file_id = file_id;
|
||||||
info->ledDflt.defined = 0;
|
info->ledDflt.defined = 0;
|
||||||
|
@ -188,7 +185,6 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id)
|
||||||
static void
|
static void
|
||||||
ClearCompatInfo(CompatInfo *info)
|
ClearCompatInfo(CompatInfo *info)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
ActionInfo *next_act;
|
ActionInfo *next_act;
|
||||||
SymInterpInfo *si, *next_si;
|
SymInterpInfo *si, *next_si;
|
||||||
LEDInfo *led, *next_led;
|
LEDInfo *led, *next_led;
|
||||||
|
@ -200,9 +196,8 @@ ClearCompatInfo(CompatInfo *info)
|
||||||
info->dflt.merge = MERGE_AUGMENT;
|
info->dflt.merge = MERGE_AUGMENT;
|
||||||
info->dflt.interp.flags = 0;
|
info->dflt.interp.flags = 0;
|
||||||
info->dflt.interp.virtual_mod = XkbNoModifier;
|
info->dflt.interp.virtual_mod = XkbNoModifier;
|
||||||
|
memset(&info->dflt.interp.act, 0, sizeof(info->dflt.interp.act));
|
||||||
info->dflt.interp.act.type = XkbSA_NoAction;
|
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||||
for (i = 0; i < sizeof(info->dflt.interp.act.any.data); i++)
|
|
||||||
info->dflt.interp.act.any.data[i] = 0;
|
|
||||||
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
|
||||||
info->nInterps = 0;
|
info->nInterps = 0;
|
||||||
list_foreach_safe(si, next_si, &info->interps, entry)
|
list_foreach_safe(si, next_si, &info->interps, entry)
|
||||||
|
@ -640,7 +635,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
|
||||||
if (arrayNdx)
|
if (arrayNdx)
|
||||||
return ReportSINotArray(info, si, field);
|
return ReportSINotArray(info, si, field);
|
||||||
|
|
||||||
if (!HandleActionDef(value, keymap, &si->interp.act.any, info->act))
|
if (!HandleActionDef(value, keymap, &si->interp.act, info->act))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
si->defined |= SI_FIELD_ACTION;
|
si->defined |= SI_FIELD_ACTION;
|
||||||
|
|
|
@ -925,7 +925,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
|
||||||
xkb_group_index_t ndx;
|
xkb_group_index_t ndx;
|
||||||
size_t nActs;
|
size_t nActs;
|
||||||
ExprDef *act;
|
ExprDef *act;
|
||||||
struct xkb_any_action *toAct;
|
union xkb_action *toAct;
|
||||||
|
|
||||||
if (!GetGroupIndex(info, keyi, arrayNdx, ACTIONS, &ndx))
|
if (!GetGroupIndex(info, keyi, arrayNdx, ACTIONS, &ndx))
|
||||||
return false;
|
return false;
|
||||||
|
@ -970,7 +970,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
|
||||||
}
|
}
|
||||||
keyi->actsDefined |= (1 << ndx);
|
keyi->actsDefined |= (1 << ndx);
|
||||||
|
|
||||||
toAct = (struct xkb_any_action *) darray_mem(keyi->acts[ndx], 0);
|
toAct = darray_mem(keyi->acts[ndx], 0);
|
||||||
act = value->value.child;
|
act = value->value.child;
|
||||||
for (i = 0; i < nActs; i++, toAct++) {
|
for (i = 0; i < nActs; i++, toAct++) {
|
||||||
if (!HandleActionDef(act, info->keymap, toAct, info->action)) {
|
if (!HandleActionDef(act, info->keymap, toAct, info->action)) {
|
||||||
|
|
Loading…
Reference in New Issue