kbproto unentanglement: action types
Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
314965b1f0
commit
0b2506db12
|
@ -384,45 +384,45 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
|||
type = ActionTypeText(action->type);
|
||||
|
||||
switch (action->type) {
|
||||
case XkbSA_SetMods:
|
||||
case XkbSA_LatchMods:
|
||||
case XkbSA_LockMods:
|
||||
case ACTION_TYPE_MOD_SET:
|
||||
case ACTION_TYPE_MOD_LATCH:
|
||||
case ACTION_TYPE_MOD_LOCK:
|
||||
if (action->mods.flags & XkbSA_UseModMapMods)
|
||||
args = "modMapMods";
|
||||
else
|
||||
args = VModMaskText(keymap, action->mods.mods.mods);
|
||||
write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args,
|
||||
(action->type != XkbSA_LockGroup &&
|
||||
(action->type != ACTION_TYPE_MOD_LOCK &&
|
||||
(action->mods.flags & XkbSA_ClearLocks)) ?
|
||||
",clearLocks" : "",
|
||||
(action->type != XkbSA_LockGroup &&
|
||||
(action->type != ACTION_TYPE_MOD_LOCK &&
|
||||
(action->mods.flags & XkbSA_LatchToLock)) ?
|
||||
",latchToLock" : "",
|
||||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_SetGroup:
|
||||
case XkbSA_LatchGroup:
|
||||
case XkbSA_LockGroup:
|
||||
case ACTION_TYPE_GROUP_SET:
|
||||
case ACTION_TYPE_GROUP_LATCH:
|
||||
case ACTION_TYPE_GROUP_LOCK:
|
||||
write_buf(buf, "%s%s(group=%s%d%s%s)%s", prefix, type,
|
||||
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
||||
action->group.group > 0) ? "+" : "",
|
||||
(action->group.flags & XkbSA_GroupAbsolute) ?
|
||||
action->group.group + 1 : action->group.group,
|
||||
(action->type != XkbSA_LockGroup &&
|
||||
(action->type != ACTION_TYPE_GROUP_LOCK &&
|
||||
(action->group.flags & XkbSA_ClearLocks)) ?
|
||||
",clearLocks" : "",
|
||||
(action->type != XkbSA_LockGroup &&
|
||||
(action->type != ACTION_TYPE_GROUP_LOCK &&
|
||||
(action->group.flags & XkbSA_LatchToLock)) ?
|
||||
",latchToLock" : "",
|
||||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_Terminate:
|
||||
case ACTION_TYPE_TERMINATE:
|
||||
write_buf(buf, "%s%s()%s", prefix, type, suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_MovePtr:
|
||||
case ACTION_TYPE_PTR_MOVE:
|
||||
write_buf(buf, "%s%s(x=%s%d,y=%s%d%s)%s", prefix, type,
|
||||
(!(action->ptr.flags & XkbSA_MoveAbsoluteX) &&
|
||||
action->ptr.x >= 0) ? "+" : "",
|
||||
|
@ -434,7 +434,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
|||
suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_LockPtrBtn:
|
||||
case ACTION_TYPE_PTR_LOCK:
|
||||
switch (action->btn.flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
||||
case XkbSA_LockNoUnlock:
|
||||
args = ",affect=lock";
|
||||
|
@ -452,7 +452,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
|||
args = ",affect=both";
|
||||
break;
|
||||
}
|
||||
case XkbSA_PtrBtn:
|
||||
case ACTION_TYPE_PTR_BUTTON:
|
||||
write_buf(buf, "%s%s(button=", prefix, type);
|
||||
if (action->btn.button > 0 && action->btn.button <= 5)
|
||||
write_buf(buf, "%d", action->btn.button);
|
||||
|
@ -465,7 +465,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
|||
write_buf(buf, ")%s", suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_SetPtrDflt:
|
||||
case ACTION_TYPE_PTR_DEFAULT:
|
||||
write_buf(buf, "%s%s(", prefix, type);
|
||||
if (action->dflt.affect == XkbSA_AffectDfltBtn)
|
||||
write_buf(buf, "affect=button,button=%s%d",
|
||||
|
@ -475,7 +475,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
|||
write_buf(buf, ")%s", suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_SwitchScreen:
|
||||
case ACTION_TYPE_SWITCH_VT:
|
||||
write_buf(buf, "%s%s(screen=%s%d,%ssame)%s", prefix, type,
|
||||
(!(action->screen.flags & XkbSA_SwitchAbsolute) &&
|
||||
action->screen.screen >= 0) ? "+" : "",
|
||||
|
@ -484,15 +484,13 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
|
|||
suffix);
|
||||
break;
|
||||
|
||||
/* Deprecated actions below here */
|
||||
case XkbSA_SetControls:
|
||||
case XkbSA_LockControls:
|
||||
case ACTION_TYPE_CTRL_SET:
|
||||
case ACTION_TYPE_CTRL_LOCK:
|
||||
write_buf(buf, "%s%s(controls=%s)%s", prefix, type,
|
||||
get_control_mask_text(action->ctrls.ctrls), suffix);
|
||||
break;
|
||||
|
||||
case XkbSA_NoAction:
|
||||
/* XXX TODO */
|
||||
case ACTION_TYPE_NONE:
|
||||
write_buf(buf, "%sNoAction()%s", prefix, suffix);
|
||||
break;
|
||||
|
||||
|
|
42
src/state.c
42
src/state.c
|
@ -106,7 +106,7 @@ struct xkb_state {
|
|||
struct xkb_keymap *keymap;
|
||||
};
|
||||
|
||||
static const union xkb_action fake = { .type = XkbSA_NoAction };
|
||||
static const union xkb_action fake = { .type = ACTION_TYPE_NONE };
|
||||
|
||||
static const union xkb_action *
|
||||
xkb_key_get_action(struct xkb_state *state, xkb_keycode_t kc)
|
||||
|
@ -333,6 +333,24 @@ enum xkb_key_latch_state {
|
|||
LATCH_PENDING,
|
||||
};
|
||||
|
||||
static bool
|
||||
xkb_action_breaks_latch(const union xkb_action *action)
|
||||
{
|
||||
switch (action->type) {
|
||||
case ACTION_TYPE_NONE:
|
||||
case ACTION_TYPE_PTR_BUTTON:
|
||||
case ACTION_TYPE_PTR_LOCK:
|
||||
case ACTION_TYPE_CTRL_SET:
|
||||
case ACTION_TYPE_CTRL_LOCK:
|
||||
case ACTION_TYPE_KEY_REDIRECT:
|
||||
case ACTION_TYPE_SWITCH_VT:
|
||||
case ACTION_TYPE_TERMINATE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
||||
enum xkb_key_direction direction)
|
||||
|
@ -345,17 +363,17 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
|||
* or promote it to a lock or plain base set if it's the same
|
||||
* modifier. */
|
||||
const union xkb_action *action = xkb_key_get_action(filter->state, kc);
|
||||
if (action->type == XkbSA_LatchMods &&
|
||||
if (action->type == ACTION_TYPE_MOD_LATCH &&
|
||||
action->mods.flags == filter->action.mods.flags &&
|
||||
action->mods.mods.mask == filter->action.mods.mods.mask) {
|
||||
filter->action = *action;
|
||||
if (filter->action.mods.flags & XkbSA_LatchToLock) {
|
||||
filter->action.type = XkbSA_LockMods;
|
||||
filter->action.type = ACTION_TYPE_MOD_LOCK;
|
||||
filter->func = xkb_filter_mod_lock_func;
|
||||
filter->state->locked_mods |= filter->action.mods.mods.mask;
|
||||
}
|
||||
else {
|
||||
filter->action.type = XkbSA_SetMods;
|
||||
filter->action.type = ACTION_TYPE_MOD_SET;
|
||||
filter->func = xkb_filter_mod_set_func;
|
||||
filter->state->set_mods = filter->action.mods.mods.mask;
|
||||
}
|
||||
|
@ -364,7 +382,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
|
|||
/* XXX beep beep! */
|
||||
return 0;
|
||||
}
|
||||
else if (((1 << action->type) & XkbSA_BreakLatch)) {
|
||||
else if (xkb_action_breaks_latch(action)) {
|
||||
/* XXX: This may be totally broken, we might need to break the
|
||||
* latch in the next run after this press? */
|
||||
filter->state->latched_mods &= ~filter->action.mods.mods.mask;
|
||||
|
@ -456,26 +474,28 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t kc,
|
|||
|
||||
act = xkb_key_get_action(state, kc);
|
||||
switch (act->type) {
|
||||
case XkbSA_SetMods:
|
||||
case ACTION_TYPE_MOD_SET:
|
||||
send = xkb_filter_mod_set_new(state, kc, act);
|
||||
break;
|
||||
case XkbSA_LatchMods:
|
||||
case ACTION_TYPE_MOD_LATCH:
|
||||
send = xkb_filter_mod_latch_new(state, kc, act);
|
||||
break;
|
||||
case XkbSA_LockMods:
|
||||
case ACTION_TYPE_MOD_LOCK:
|
||||
send = xkb_filter_mod_lock_new(state, kc, act);
|
||||
break;
|
||||
case XkbSA_SetGroup:
|
||||
case ACTION_TYPE_GROUP_SET:
|
||||
send = xkb_filter_group_set_new(state, kc, act);
|
||||
break;
|
||||
#if 0
|
||||
case XkbSA_LatchGroup:
|
||||
case ACTION_TYPE_GROUP_LATCH:
|
||||
send = xkb_filter_mod_latch_new(state, key, act);
|
||||
break;
|
||||
#endif
|
||||
case XkbSA_LockGroup:
|
||||
case ACTION_TYPE_GROUP_LOCK:
|
||||
send = xkb_filter_group_lock_new(state, kc, act);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
82
src/text.c
82
src/text.c
|
@ -156,48 +156,48 @@ const LookupEntry useModMapValueNames[] = {
|
|||
};
|
||||
|
||||
const LookupEntry actionTypeNames[] = {
|
||||
{ "NoAction", XkbSA_NoAction },
|
||||
{ "SetMods", XkbSA_SetMods },
|
||||
{ "LatchMods", XkbSA_LatchMods },
|
||||
{ "LockMods", XkbSA_LockMods },
|
||||
{ "SetGroup", XkbSA_SetGroup },
|
||||
{ "LatchGroup", XkbSA_LatchGroup },
|
||||
{ "LockGroup", XkbSA_LockGroup },
|
||||
{ "MovePtr", XkbSA_MovePtr },
|
||||
{ "MovePointer", XkbSA_MovePtr },
|
||||
{ "PtrBtn", XkbSA_PtrBtn },
|
||||
{ "PointerButton", XkbSA_PtrBtn },
|
||||
{ "LockPtrBtn", XkbSA_LockPtrBtn },
|
||||
{ "LockPtrButton", XkbSA_LockPtrBtn },
|
||||
{ "LockPointerButton", XkbSA_LockPtrBtn },
|
||||
{ "LockPointerBtn", XkbSA_LockPtrBtn },
|
||||
{ "SetPtrDflt", XkbSA_SetPtrDflt },
|
||||
{ "SetPointerDefault", XkbSA_SetPtrDflt },
|
||||
{ "Terminate", XkbSA_Terminate },
|
||||
{ "TerminateServer", XkbSA_Terminate },
|
||||
{ "SwitchScreen", XkbSA_SwitchScreen },
|
||||
{ "SetControls", XkbSA_SetControls },
|
||||
{ "LockControls", XkbSA_LockControls },
|
||||
{ "RedirectKey", XkbSA_RedirectKey },
|
||||
{ "Redirect", XkbSA_RedirectKey },
|
||||
{ "Private", PrivateAction },
|
||||
{ "NoAction", ACTION_TYPE_NONE },
|
||||
{ "SetMods", ACTION_TYPE_MOD_SET },
|
||||
{ "LatchMods", ACTION_TYPE_MOD_LATCH },
|
||||
{ "LockMods", ACTION_TYPE_MOD_LOCK },
|
||||
{ "SetGroup", ACTION_TYPE_GROUP_SET },
|
||||
{ "LatchGroup", ACTION_TYPE_GROUP_LATCH },
|
||||
{ "LockGroup", ACTION_TYPE_GROUP_LOCK },
|
||||
{ "MovePtr", ACTION_TYPE_PTR_MOVE },
|
||||
{ "MovePointer", ACTION_TYPE_PTR_MOVE },
|
||||
{ "PtrBtn", ACTION_TYPE_PTR_BUTTON },
|
||||
{ "PointerButton", ACTION_TYPE_PTR_BUTTON },
|
||||
{ "LockPtrBtn", ACTION_TYPE_PTR_LOCK },
|
||||
{ "LockPtrButton", ACTION_TYPE_PTR_LOCK },
|
||||
{ "LockPointerButton", ACTION_TYPE_PTR_LOCK },
|
||||
{ "LockPointerBtn", ACTION_TYPE_PTR_LOCK },
|
||||
{ "SetPtrDflt", ACTION_TYPE_PTR_DEFAULT },
|
||||
{ "SetPointerDefault", ACTION_TYPE_PTR_DEFAULT },
|
||||
{ "Terminate", ACTION_TYPE_TERMINATE },
|
||||
{ "TerminateServer", ACTION_TYPE_TERMINATE },
|
||||
{ "SwitchScreen", ACTION_TYPE_SWITCH_VT },
|
||||
{ "SetControls", ACTION_TYPE_CTRL_SET },
|
||||
{ "LockControls", ACTION_TYPE_CTRL_LOCK },
|
||||
{ "RedirectKey", ACTION_TYPE_KEY_REDIRECT },
|
||||
{ "Redirect", ACTION_TYPE_KEY_REDIRECT },
|
||||
{ "Private", ACTION_TYPE_PRIVATE },
|
||||
/* deprecated actions below here - unused */
|
||||
{ "ISOLock", XkbSA_NoAction },
|
||||
{ "ActionMessage", XkbSA_NoAction },
|
||||
{ "MessageAction", XkbSA_NoAction },
|
||||
{ "Message", XkbSA_NoAction },
|
||||
{ "DeviceBtn", XkbSA_NoAction },
|
||||
{ "DevBtn", XkbSA_NoAction },
|
||||
{ "DevButton", XkbSA_NoAction },
|
||||
{ "DeviceButton", XkbSA_NoAction },
|
||||
{ "LockDeviceBtn", XkbSA_NoAction },
|
||||
{ "LockDevBtn", XkbSA_NoAction },
|
||||
{ "LockDevButton", XkbSA_NoAction },
|
||||
{ "LockDeviceButton", XkbSA_NoAction },
|
||||
{ "DeviceValuator", XkbSA_NoAction },
|
||||
{ "DevVal", XkbSA_NoAction },
|
||||
{ "DeviceVal", XkbSA_NoAction },
|
||||
{ "DevValuator", XkbSA_NoAction },
|
||||
{ "ISOLock", ACTION_TYPE_NONE },
|
||||
{ "ActionMessage", ACTION_TYPE_NONE },
|
||||
{ "MessageAction", ACTION_TYPE_NONE },
|
||||
{ "Message", ACTION_TYPE_NONE },
|
||||
{ "DeviceBtn", ACTION_TYPE_NONE },
|
||||
{ "DevBtn", ACTION_TYPE_NONE },
|
||||
{ "DevButton", ACTION_TYPE_NONE },
|
||||
{ "DeviceButton", ACTION_TYPE_NONE },
|
||||
{ "LockDeviceBtn", ACTION_TYPE_NONE },
|
||||
{ "LockDevBtn", ACTION_TYPE_NONE },
|
||||
{ "LockDevButton", ACTION_TYPE_NONE },
|
||||
{ "LockDeviceButton", ACTION_TYPE_NONE },
|
||||
{ "DeviceValuator", ACTION_TYPE_NONE },
|
||||
{ "DevVal", ACTION_TYPE_NONE },
|
||||
{ "DeviceVal", ACTION_TYPE_NONE },
|
||||
{ "DevValuator", ACTION_TYPE_NONE },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
|
|
|
@ -132,44 +132,65 @@ struct xkb_component_names {
|
|||
char *symbols;
|
||||
};
|
||||
|
||||
enum xkb_action_type {
|
||||
ACTION_TYPE_NONE = 0,
|
||||
ACTION_TYPE_MOD_SET,
|
||||
ACTION_TYPE_MOD_LATCH,
|
||||
ACTION_TYPE_MOD_LOCK,
|
||||
ACTION_TYPE_GROUP_SET,
|
||||
ACTION_TYPE_GROUP_LATCH,
|
||||
ACTION_TYPE_GROUP_LOCK,
|
||||
ACTION_TYPE_PTR_MOVE,
|
||||
ACTION_TYPE_PTR_BUTTON,
|
||||
ACTION_TYPE_PTR_LOCK,
|
||||
ACTION_TYPE_PTR_DEFAULT,
|
||||
ACTION_TYPE_TERMINATE,
|
||||
ACTION_TYPE_SWITCH_VT,
|
||||
ACTION_TYPE_CTRL_SET,
|
||||
ACTION_TYPE_CTRL_LOCK,
|
||||
ACTION_TYPE_KEY_REDIRECT,
|
||||
ACTION_TYPE_PRIVATE,
|
||||
ACTION_TYPE_LAST
|
||||
};
|
||||
|
||||
struct xkb_mods {
|
||||
xkb_mod_mask_t mods; /* original real+virtual mods in definition */
|
||||
xkb_mod_mask_t mask; /* computed effective mask */
|
||||
};
|
||||
|
||||
struct xkb_mod_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
struct xkb_mods mods;
|
||||
};
|
||||
|
||||
struct xkb_group_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
int32_t group;
|
||||
};
|
||||
|
||||
struct xkb_controls_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
uint32_t ctrls;
|
||||
};
|
||||
|
||||
struct xkb_pointer_default_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
uint8_t affect;
|
||||
int8_t value;
|
||||
};
|
||||
|
||||
struct xkb_switch_screen_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
int8_t screen;
|
||||
};
|
||||
|
||||
struct xkb_redirect_key_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
xkb_keycode_t new_kc;
|
||||
uint8_t mods_mask;
|
||||
uint8_t mods;
|
||||
|
@ -178,28 +199,26 @@ struct xkb_redirect_key_action {
|
|||
};
|
||||
|
||||
struct xkb_pointer_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
};
|
||||
|
||||
struct xkb_pointer_button_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t flags;
|
||||
uint8_t count;
|
||||
int8_t button;
|
||||
};
|
||||
|
||||
/* Instead of non-sequential XkbSA_XFree86Private. */
|
||||
#define PrivateAction (XkbSA_LastAction + 1)
|
||||
|
||||
struct xkb_private_action {
|
||||
uint8_t type;
|
||||
enum xkb_action_type type;
|
||||
uint8_t data[7];
|
||||
};
|
||||
|
||||
union xkb_action {
|
||||
enum xkb_action_type type;
|
||||
struct xkb_mod_action mods;
|
||||
struct xkb_group_action group;
|
||||
struct xkb_controls_action ctrls;
|
||||
|
@ -209,7 +228,6 @@ union xkb_action {
|
|||
struct xkb_pointer_action ptr;
|
||||
struct xkb_pointer_button_action btn;
|
||||
struct xkb_private_action priv;
|
||||
unsigned char type;
|
||||
};
|
||||
|
||||
struct xkb_kt_map_entry {
|
||||
|
|
|
@ -81,15 +81,15 @@ NewActionsInfo(void)
|
|||
return NULL;
|
||||
|
||||
/* This includes PrivateAction. */
|
||||
for (type = 0; type < XkbSA_NumActions + 1; type++)
|
||||
for (type = 0; type < ACTION_TYPE_LAST; type++)
|
||||
info->actions[type].type = type;
|
||||
|
||||
/* Apply some "factory defaults". */
|
||||
|
||||
/* Increment default button. */
|
||||
info->actions[XkbSA_SetPtrDflt].dflt.affect = XkbSA_AffectDfltBtn;
|
||||
info->actions[XkbSA_SetPtrDflt].dflt.flags = 0;
|
||||
info->actions[XkbSA_SetPtrDflt].dflt.value = 1;
|
||||
info->actions[ACTION_TYPE_PTR_DEFAULT].dflt.affect = XkbSA_AffectDfltBtn;
|
||||
info->actions[ACTION_TYPE_PTR_DEFAULT].dflt.flags = 0;
|
||||
info->actions[ACTION_TYPE_PTR_DEFAULT].dflt.value = 1;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ fieldText(enum action_field field)
|
|||
/***====================================================================***/
|
||||
|
||||
static inline bool
|
||||
ReportMismatch(struct xkb_keymap *keymap, unsigned action,
|
||||
ReportMismatch(struct xkb_keymap *keymap, enum xkb_action_type action,
|
||||
enum action_field field, const char *type)
|
||||
{
|
||||
log_err(keymap->ctx,
|
||||
|
@ -169,7 +169,7 @@ ReportMismatch(struct xkb_keymap *keymap, unsigned action,
|
|||
}
|
||||
|
||||
static inline bool
|
||||
ReportIllegal(struct xkb_keymap *keymap, unsigned action,
|
||||
ReportIllegal(struct xkb_keymap *keymap, enum xkb_action_type action,
|
||||
enum action_field field)
|
||||
{
|
||||
log_err(keymap->ctx,
|
||||
|
@ -180,7 +180,7 @@ ReportIllegal(struct xkb_keymap *keymap, unsigned action,
|
|||
}
|
||||
|
||||
static inline bool
|
||||
ReportActionNotArray(struct xkb_keymap *keymap, unsigned action,
|
||||
ReportActionNotArray(struct xkb_keymap *keymap, enum xkb_action_type action,
|
||||
enum action_field field)
|
||||
{
|
||||
log_err(keymap->ctx,
|
||||
|
@ -191,7 +191,7 @@ ReportActionNotArray(struct xkb_keymap *keymap, unsigned action,
|
|||
}
|
||||
|
||||
static inline bool
|
||||
ReportNotFound(struct xkb_keymap *keymap, unsigned action,
|
||||
ReportNotFound(struct xkb_keymap *keymap, enum xkb_action_type action,
|
||||
enum action_field field, const char *what, const char *bad)
|
||||
{
|
||||
log_err(keymap->ctx,
|
||||
|
@ -211,7 +211,7 @@ HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action,
|
|||
}
|
||||
|
||||
static bool
|
||||
CheckLatchLockFlags(struct xkb_keymap *keymap, unsigned action,
|
||||
CheckLatchLockFlags(struct xkb_keymap *keymap, enum xkb_action_type action,
|
||||
enum action_field field, const ExprDef * value,
|
||||
unsigned *flags_inout)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ CheckLatchLockFlags(struct xkb_keymap *keymap, unsigned action,
|
|||
}
|
||||
|
||||
static bool
|
||||
CheckModifierField(struct xkb_keymap *keymap, unsigned action,
|
||||
CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
|
||||
const ExprDef *value, unsigned *flags_inout,
|
||||
xkb_mod_mask_t *mods_rtrn)
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
|
|||
act->button = btn;
|
||||
return true;
|
||||
}
|
||||
else if (action->type == XkbSA_LockPtrBtn &&
|
||||
else if (action->type == ACTION_TYPE_PTR_LOCK &&
|
||||
field == ACTION_FIELD_AFFECT) {
|
||||
unsigned int val;
|
||||
|
||||
|
@ -717,7 +717,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
|
|||
int type;
|
||||
|
||||
if (!ExprResolveInteger(keymap->ctx, value, &type))
|
||||
return ReportMismatch(keymap, PrivateAction, field, "integer");
|
||||
return ReportMismatch(keymap, ACTION_TYPE_PRIVATE, field, "integer");
|
||||
|
||||
if (type < 0 || type > 255) {
|
||||
log_err(keymap->ctx,
|
||||
|
@ -783,7 +783,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
|
|||
}
|
||||
}
|
||||
|
||||
return ReportIllegal(keymap, PrivateAction, field);
|
||||
return ReportIllegal(keymap, ACTION_TYPE_NONE, field);
|
||||
}
|
||||
|
||||
typedef bool (*actionHandler)(struct xkb_keymap *keymap,
|
||||
|
@ -792,23 +792,23 @@ typedef bool (*actionHandler)(struct xkb_keymap *keymap,
|
|||
const ExprDef *array_ndx,
|
||||
const ExprDef *value);
|
||||
|
||||
static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
||||
[XkbSA_NoAction] = HandleNoAction,
|
||||
[XkbSA_SetMods] = HandleSetLatchMods,
|
||||
[XkbSA_LatchMods] = HandleSetLatchMods,
|
||||
[XkbSA_LockMods] = HandleLockMods,
|
||||
[XkbSA_SetGroup] = HandleSetLatchGroup,
|
||||
[XkbSA_LatchGroup] = HandleSetLatchGroup,
|
||||
[XkbSA_LockGroup] = HandleLockGroup,
|
||||
[XkbSA_MovePtr] = HandleMovePtr,
|
||||
[XkbSA_PtrBtn] = HandlePtrBtn,
|
||||
[XkbSA_LockPtrBtn] = HandlePtrBtn,
|
||||
[XkbSA_SetPtrDflt] = HandleSetPtrDflt,
|
||||
[XkbSA_Terminate] = HandleNoAction,
|
||||
[XkbSA_SwitchScreen] = HandleSwitchScreen,
|
||||
[XkbSA_SetControls] = HandleSetLockControls,
|
||||
[XkbSA_LockControls] = HandleSetLockControls,
|
||||
[PrivateAction] = HandlePrivate,
|
||||
static const actionHandler handleAction[ACTION_TYPE_LAST] = {
|
||||
[ACTION_TYPE_NONE] = HandleNoAction,
|
||||
[ACTION_TYPE_MOD_SET] = HandleSetLatchMods,
|
||||
[ACTION_TYPE_MOD_LATCH] = HandleSetLatchMods,
|
||||
[ACTION_TYPE_MOD_LOCK] = HandleLockMods,
|
||||
[ACTION_TYPE_GROUP_SET] = HandleSetLatchGroup,
|
||||
[ACTION_TYPE_GROUP_LATCH] = HandleSetLatchGroup,
|
||||
[ACTION_TYPE_GROUP_LOCK] = HandleLockGroup,
|
||||
[ACTION_TYPE_PTR_MOVE] = HandleMovePtr,
|
||||
[ACTION_TYPE_PTR_BUTTON] = HandlePtrBtn,
|
||||
[ACTION_TYPE_PTR_LOCK] = HandlePtrBtn,
|
||||
[ACTION_TYPE_PTR_DEFAULT] = HandleSetPtrDflt,
|
||||
[ACTION_TYPE_TERMINATE] = HandleNoAction,
|
||||
[ACTION_TYPE_SWITCH_VT] = HandleSwitchScreen,
|
||||
[ACTION_TYPE_CTRL_SET] = HandleSetLockControls,
|
||||
[ACTION_TYPE_CTRL_LOCK] = HandleSetLockControls,
|
||||
[ACTION_TYPE_PRIVATE] = HandlePrivate,
|
||||
};
|
||||
|
||||
/***====================================================================***/
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* modified within the files (see calls to SetActionField).
|
||||
*/
|
||||
typedef struct {
|
||||
union xkb_action actions[XkbSA_NumActions + 1];
|
||||
union xkb_action actions[ACTION_TYPE_LAST];
|
||||
} ActionsInfo;
|
||||
|
||||
ActionsInfo *
|
||||
|
|
|
@ -240,7 +240,7 @@ InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id,
|
|||
info->dflt.interp.flags = 0;
|
||||
info->dflt.interp.virtual_mod = XKB_MOD_INVALID;
|
||||
memset(&info->dflt.interp.act, 0, sizeof(info->dflt.interp.act));
|
||||
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||
info->dflt.interp.act.type = ACTION_TYPE_NONE;
|
||||
memset(&info->ledDflt, 0, sizeof(info->ledDflt));
|
||||
info->ledDflt.file_id = file_id;
|
||||
info->ledDflt.merge = MERGE_OVERRIDE;
|
||||
|
@ -258,7 +258,7 @@ ClearCompatInfo(CompatInfo *info)
|
|||
info->dflt.interp.flags = 0;
|
||||
info->dflt.interp.virtual_mod = XKB_MOD_INVALID;
|
||||
memset(&info->dflt.interp.act, 0, sizeof(info->dflt.interp.act));
|
||||
info->dflt.interp.act.type = XkbSA_NoAction;
|
||||
info->dflt.interp.act.type = ACTION_TYPE_NONE;
|
||||
memset(&info->ledDflt, 0, sizeof(info->ledDflt));
|
||||
darray_free(info->interps);
|
||||
darray_free(info->leds);
|
||||
|
|
|
@ -50,9 +50,9 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
|
|||
struct xkb_mods *mods;
|
||||
|
||||
switch (act->type) {
|
||||
case XkbSA_SetMods:
|
||||
case XkbSA_LatchMods:
|
||||
case XkbSA_LockMods:
|
||||
case ACTION_TYPE_MOD_SET:
|
||||
case ACTION_TYPE_MOD_LATCH:
|
||||
case ACTION_TYPE_MOD_LOCK:
|
||||
flags = act->mods.flags;
|
||||
mods = &act->mods.mods;
|
||||
break;
|
||||
|
@ -167,7 +167,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key)
|
|||
vmodmask |= (1 << interp->virtual_mod);
|
||||
}
|
||||
|
||||
if (interp->act.type != XkbSA_NoAction) {
|
||||
if (interp->act.type != ACTION_TYPE_NONE) {
|
||||
if (!key->actions) {
|
||||
key->actions = calloc(key->num_groups * key->width,
|
||||
sizeof(*key->actions));
|
||||
|
|
|
@ -320,11 +320,11 @@ MergeKeyGroups(SymbolsInfo * info,
|
|||
if (!darray_empty(into->acts[group]))
|
||||
toAct = &darray_item(into->acts[group], i);
|
||||
|
||||
if (((fromAct == NULL) || (fromAct->type == XkbSA_NoAction))
|
||||
if (((fromAct == NULL) || (fromAct->type == ACTION_TYPE_NONE))
|
||||
&& (toAct != NULL)) {
|
||||
darray_item(resultActs, i) = *toAct;
|
||||
}
|
||||
else if (((toAct == NULL) || (toAct->type == XkbSA_NoAction))
|
||||
else if (((toAct == NULL) || (toAct->type == ACTION_TYPE_NONE))
|
||||
&& (fromAct != NULL)) {
|
||||
darray_item(resultActs, i) = *fromAct;
|
||||
}
|
||||
|
@ -1843,7 +1843,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi,
|
|||
if (tmp < keyi->numLevels[i])
|
||||
key->actions[tmp] = darray_item(keyi->acts[i], tmp);
|
||||
else
|
||||
key->actions[tmp].type = XkbSA_NoAction;
|
||||
key->actions[tmp].type = ACTION_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue