diff options
author | Daniel Stone <daniel@fooishbar.org> | 2012-08-21 14:40:51 +0100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2012-09-10 19:23:35 +0100 |
commit | 314965b1f093fc8cd551e3e64fe1ed699205f2e3 (patch) | |
tree | 2647690ee3d229b06d6c5dc833d15bd269bdc71d | |
parent | b04d896ab25cca055e5bcc3d2e58d9c9fb6ef3c4 (diff) | |
download | libxkbcommon-314965b1f093fc8cd551e3e64fe1ed699205f2e3.tar.gz libxkbcommon-314965b1f093fc8cd551e3e64fe1ed699205f2e3.tar.bz2 libxkbcommon-314965b1f093fc8cd551e3e64fe1ed699205f2e3.zip |
Remove deprecated actions
We didn't do anything with ISO_Lock, ActionMessage, RedirectKey, and the
device-specifying variants of the pointer actions, so remove those.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | src/keymap-dump.c | 5 | ||||
-rw-r--r-- | src/text.c | 33 | ||||
-rw-r--r-- | src/xkb-priv.h | 41 | ||||
-rw-r--r-- | src/xkbcomp/action.c | 332 | ||||
-rw-r--r-- | src/xkbcomp/keymap.c | 5 |
5 files changed, 20 insertions, 396 deletions
diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 4926762..73dced7 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -491,11 +491,6 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, get_control_mask_text(action->ctrls.ctrls), suffix); break; - case XkbSA_ISOLock: - case XkbSA_ActionMessage: - case XkbSA_RedirectKey: - case XkbSA_DeviceBtn: - case XkbSA_LockDeviceBtn: case XkbSA_NoAction: /* XXX TODO */ write_buf(buf, "%sNoAction()%s", prefix, suffix); @@ -173,30 +173,31 @@ const LookupEntry actionTypeNames[] = { { "LockPointerBtn", XkbSA_LockPtrBtn }, { "SetPtrDflt", XkbSA_SetPtrDflt }, { "SetPointerDefault", XkbSA_SetPtrDflt }, - { "ISOLock", XkbSA_ISOLock }, { "Terminate", XkbSA_Terminate }, { "TerminateServer", XkbSA_Terminate }, { "SwitchScreen", XkbSA_SwitchScreen }, { "SetControls", XkbSA_SetControls }, { "LockControls", XkbSA_LockControls }, - { "ActionMessage", XkbSA_ActionMessage }, - { "MessageAction", XkbSA_ActionMessage }, - { "Message", XkbSA_ActionMessage }, { "RedirectKey", XkbSA_RedirectKey }, { "Redirect", XkbSA_RedirectKey }, - { "DeviceBtn", XkbSA_DeviceBtn }, - { "DevBtn", XkbSA_DeviceBtn }, - { "DevButton", XkbSA_DeviceBtn }, - { "DeviceButton", XkbSA_DeviceBtn }, - { "LockDeviceBtn", XkbSA_LockDeviceBtn }, - { "LockDevBtn", XkbSA_LockDeviceBtn }, - { "LockDevButton", XkbSA_LockDeviceBtn }, - { "LockDeviceButton", XkbSA_LockDeviceBtn }, - { "DeviceValuator", XkbSA_DeviceValuator }, - { "DevVal", XkbSA_DeviceValuator }, - { "DeviceVal", XkbSA_DeviceValuator }, - { "DevValuator", XkbSA_DeviceValuator }, { "Private", PrivateAction }, + /* 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 }, { NULL, 0 }, }; diff --git a/src/xkb-priv.h b/src/xkb-priv.h index b9ff714..36554bb 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -149,39 +149,12 @@ struct xkb_group_action { int32_t group; }; -struct xkb_iso_action { - uint8_t type; - uint8_t flags; - struct xkb_mods mods; - int32_t group; - uint8_t affect; -}; - struct xkb_controls_action { uint8_t type; uint8_t flags; uint32_t ctrls; }; -struct xkb_device_button_action { - uint8_t type; - uint8_t flags; - uint8_t count; - uint8_t button; - uint8_t device; -}; - -struct xkb_device_valuator_action { - uint8_t type; - uint8_t device; - uint8_t v1_what; - uint8_t v1_index; - int8_t v1_value; - uint8_t v2_what; - uint8_t v2_index; - int8_t v2_value; -}; - struct xkb_pointer_default_action { uint8_t type; uint8_t flags; @@ -211,12 +184,6 @@ struct xkb_pointer_action { int16_t y; }; -struct xkb_message_action { - uint8_t type; - uint8_t flags; - uint8_t message[6]; -}; - struct xkb_pointer_button_action { uint8_t type; uint8_t flags; @@ -235,16 +202,12 @@ struct xkb_private_action { union xkb_action { struct xkb_mod_action mods; struct xkb_group_action group; - struct xkb_iso_action iso; struct xkb_controls_action ctrls; - struct xkb_device_button_action devbtn; - struct xkb_device_valuator_action devval; struct xkb_pointer_default_action dflt; struct xkb_switch_screen_action screen; struct xkb_redirect_key_action redirect; /* XXX wholly unnecessary? */ - struct xkb_pointer_action ptr; /* XXX delete for DeviceValuator */ - struct xkb_pointer_button_action btn; /* XXX delete for DeviceBtn */ - struct xkb_message_action msg; /* XXX just delete */ + struct xkb_pointer_action ptr; + struct xkb_pointer_button_action btn; struct xkb_private_action priv; unsigned char type; }; diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 24ae68f..617ad3b 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -91,9 +91,6 @@ NewActionsInfo(void) info->actions[XkbSA_SetPtrDflt].dflt.flags = 0; info->actions[XkbSA_SetPtrDflt].dflt.value = 1; - info->actions[XkbSA_ISOLock].iso.mods.mods = - (1 << ModNameToIndex(XKB_MOD_NAME_CAPS)); - return info; } @@ -210,7 +207,7 @@ HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action, const ExprDef *value) { - return ReportIllegal(keymap, action->type, field); + return true; } static bool @@ -628,73 +625,6 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, return ReportIllegal(keymap, action->type, field); } -static const LookupEntry isoNames[] = { - { "mods", XkbSA_ISONoAffectMods }, - { "modifiers", XkbSA_ISONoAffectMods }, - { "group", XkbSA_ISONoAffectGroup }, - { "groups", XkbSA_ISONoAffectGroup }, - { "ptr", XkbSA_ISONoAffectPtr }, - { "pointer", XkbSA_ISONoAffectPtr }, - { "ctrls", XkbSA_ISONoAffectCtrls }, - { "controls", XkbSA_ISONoAffectCtrls }, - { "all", ~((unsigned) 0) }, - { "none", 0 }, - { NULL, 0 }, -}; - -static bool -HandleISOLock(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) -{ - struct xkb_iso_action *act = &action->iso; - - if (field == ACTION_FIELD_MODIFIERS) { - unsigned flags; - xkb_mod_mask_t mods; - - if (array_ndx) - return ReportActionNotArray(keymap, action->type, field); - - flags = act->flags; - if (!CheckModifierField(keymap, action->type, value, &flags, &mods)) - return false; - - act->flags = flags & (~XkbSA_ISODfltIsGroup); - act->mods.mods = mods; - return true; - } - else if (field == ACTION_FIELD_GROUP) { - xkb_group_index_t group; - unsigned flags; - - if (array_ndx) - return ReportActionNotArray(keymap, action->type, field); - - flags = act->flags; - if (!CheckGroupField(keymap, action->type, value, &flags, &group)) - return false; - - act->flags = flags | XkbSA_ISODfltIsGroup; - act->group = group; - return true; - } else if (ACTION_FIELD_AFFECT) { - xkb_mod_mask_t mask; - - if (array_ndx) - return ReportActionNotArray(keymap, action->type, field); - - if (!ExprResolveMask(keymap->ctx, value, &mask, isoNames)) - return ReportMismatch(keymap, action->type, field, - "keyboard component"); - - act->affect = (~mask) & XkbSA_ISOAffectMask; - return true; - } - - return ReportIllegal(keymap, action->type, field); -} - static bool HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action, enum action_field field, const ExprDef *array_ndx, @@ -776,260 +706,6 @@ HandleSetLockControls(struct xkb_keymap *keymap, union xkb_action *action, return ReportIllegal(keymap, action->type, field); } -static const LookupEntry evNames[] = { - { "press", XkbSA_MessageOnPress }, - { "keypress", XkbSA_MessageOnPress }, - { "release", XkbSA_MessageOnRelease }, - { "keyrelease", XkbSA_MessageOnRelease }, - { "all", XkbSA_MessageOnPress | XkbSA_MessageOnRelease }, - { "none", 0 }, - { NULL, 0 } -}; - -static bool -HandleActionMessage(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) -{ - struct xkb_message_action *act = &action->msg; - - if (field == ACTION_FIELD_REPORT) { - unsigned int mask; - - if (array_ndx) - return ReportActionNotArray(keymap, action->type, field); - - if (!ExprResolveMask(keymap->ctx, value, &mask, evNames)) - return ReportMismatch(keymap, action->type, field, - "key event mask"); - - /* FIXME: Something seems wrong here... */ - act->flags &= ~(XkbSA_MessageOnPress | XkbSA_MessageOnRelease); - act->flags = mask & (XkbSA_MessageOnPress | XkbSA_MessageOnRelease); - return true; - } - else if (field == ACTION_FIELD_GEN_KEY_EVENT) { - bool set; - - if (array_ndx) - return ReportActionNotArray(keymap, action->type, field); - - if (!ExprResolveBoolean(keymap->ctx, value, &set)) - return ReportMismatch(keymap, action->type, field, "boolean"); - - if (set) - act->flags |= XkbSA_MessageGenKeyEvent; - else - act->flags &= ~XkbSA_MessageGenKeyEvent; - - return true; - } - else if (field == ACTION_FIELD_DATA && !array_ndx) { - xkb_atom_t val; - const char *str; - int len; - - if (!ExprResolveString(keymap->ctx, value, &val)) - return ReportMismatch(keymap, action->type, field, "string"); - - str = xkb_atom_text(keymap->ctx, val); - len = strlen(str); - if (len < 1 || len > 6) { - log_warn(keymap->ctx, - "An action message can hold only 6 bytes; " - "Extra %d bytes ignored\n", len - 6); - } - - strncpy((char *) act->message, str, 6); - return true; - } - else if (field == ACTION_FIELD_DATA && array_ndx) { - int ndx, datum; - - if (!ExprResolveInteger(keymap->ctx, array_ndx, &ndx)) { - log_err(keymap->ctx, - "Array subscript must be integer; " - "Illegal subscript ignored\n"); - return false; - } - - if (ndx < 0 || ndx > 5) { - log_err(keymap->ctx, - "An action message is at most 6 bytes long; " - "Attempt to use data[%d] ignored\n", ndx); - return false; - } - - if (!ExprResolveInteger(keymap->ctx, value, &datum)) - return ReportMismatch(keymap, action->type, field, "integer"); - - if (datum < 0 || datum > 255) { - log_err(keymap->ctx, - "Message data must be in the range 0..255; " - "Illegal datum %d ignored\n", datum); - return false; - } - - act->message[ndx] = (uint8_t) datum; - return true; - } - - return ReportIllegal(keymap, action->type, field); -} - -static bool -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 >> XKB_NUM_CORE_MODS) & 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, @@ -1128,16 +804,10 @@ static const actionHandler handleAction[XkbSA_NumActions + 1] = { [XkbSA_PtrBtn] = HandlePtrBtn, [XkbSA_LockPtrBtn] = HandlePtrBtn, [XkbSA_SetPtrDflt] = HandleSetPtrDflt, - [XkbSA_ISOLock] = HandleISOLock, [XkbSA_Terminate] = HandleNoAction, [XkbSA_SwitchScreen] = HandleSwitchScreen, [XkbSA_SetControls] = HandleSetLockControls, [XkbSA_LockControls] = HandleSetLockControls, - [XkbSA_ActionMessage] = HandleActionMessage, - [XkbSA_RedirectKey] = HandleRedirectKey, - [XkbSA_DeviceBtn] = HandleDeviceBtn, - [XkbSA_LockDeviceBtn] = HandleDeviceBtn, - [XkbSA_DeviceValuator] = HandleDeviceValuator, [PrivateAction] = HandlePrivate, }; diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index b1cd369..5875ca7 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -57,11 +57,6 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act, mods = &act->mods.mods; break; - case XkbSA_ISOLock: - flags = act->iso.flags; - mods = &act->iso.mods; - break; - default: return; } |