From 9258cc3dca504479233bcd4eaefb5a0930c998cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 30 Jun 2010 13:31:21 -0400 Subject: [PATCH] Rename Xkbc*Action to struct xkb_*_action --- include/X11/extensions/XKBcommon.h | 67 +++++++++++++++++++------------------- src/malloc.c | 18 +++++----- src/xkballoc.h | 2 +- src/xkbcomp/action.c | 56 +++++++++++++++---------------- src/xkbcomp/action.h | 2 +- src/xkbcomp/symbols.c | 34 +++++++++---------- 6 files changed, 90 insertions(+), 89 deletions(-) diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h index a81779b..6fc34b5 100644 --- a/include/X11/extensions/XKBcommon.h +++ b/include/X11/extensions/XKBcommon.h @@ -65,50 +65,51 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Action structures used in the server */ #define XkbcAnyActionDataSize 18 -typedef struct _XkbcAnyAction { +struct xkb_any_action { unsigned char type; unsigned char pad[XkbcAnyActionDataSize]; -} XkbcAnyAction; +}; -typedef struct _XkbcModAction { +struct xkb_mod_action { unsigned char type; uint8_t flags; uint8_t real_mods; uint32_t mask; uint32_t vmods; -} XkbcModAction; +}; -typedef struct _XkbcGroupAction { +struct xkb_group_action { unsigned char type; unsigned char flags; int16_t group; -} XkbcGroupAction; +}; -typedef struct _XkbcISOAction { +struct xkb_iso_action { unsigned char type; uint8_t flags; int16_t group; uint32_t mask; uint32_t vmods; uint8_t real_mods; - uint8_t affect; -} XkbcISOAction; + + uint8_t affect; +}; -typedef struct _XkbcCtrlsAction { +struct xkb_controls_action { unsigned char type; uint8_t flags; uint32_t ctrls; -} XkbcCtrlsAction; +}; -typedef struct _XkbcDeviceBtnAction { +struct xkb_device_button_action { unsigned char type; uint8_t flags; uint16_t device; uint16_t button; uint8_t count; -} XkbcDeviceBtnAction; +}; -typedef struct _XkbcDeviceValuatorAction { +struct xkb_device_valuator_action { unsigned char type; uint8_t v1_what; uint16_t device; @@ -117,37 +118,37 @@ typedef struct _XkbcDeviceValuatorAction { uint16_t v2_index; int16_t v2_value; uint8_t v2_what; -} XkbcDeviceValuatorAction; +}; -typedef struct _XkbcPtrDfltAction { +struct xkb_pointer_default_action { unsigned char type; uint8_t flags; uint8_t affect; uint8_t value; -} XkbcPtrDfltAction; +}; -typedef struct _XkbcSwitchScreenAction { +struct xkb_switch_screen_action { unsigned char type; uint8_t flags; uint8_t screen; -} XkbcSwitchScreenAction; - -typedef union _XkbcAction { - XkbcAnyAction any; - XkbcModAction mods; - XkbcGroupAction group; - XkbcISOAction iso; - XkbcCtrlsAction ctrls; - XkbcDeviceBtnAction devbtn; - XkbcDeviceValuatorAction devval; - XkbcPtrDfltAction dflt; - XkbcSwitchScreenAction screen; +}; + +union xkb_action { + struct xkb_any_action any; + 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; XkbRedirectKeyAction redirect; /* XXX wholly unnecessary? */ XkbPtrAction ptr; /* XXX delete for DeviceValuator */ XkbPtrBtnAction btn; /* XXX delete for DeviceBtn */ XkbMessageAction msg; /* XXX just delete */ unsigned char type; -} XkbcAction; +}; typedef struct _XkbcMods { uint32_t mask; /* effective mods */ @@ -177,7 +178,7 @@ typedef struct _XkbcSymInterpretRec { unsigned char match; uint8_t mods; /* XXX real or virt? */ uint32_t virtual_mod; - XkbcAnyAction act; + struct xkb_any_action act; } XkbcSymInterpretRec, *XkbcSymInterpretPtr; typedef struct _XkbcCompatMapRec { @@ -211,7 +212,7 @@ typedef struct _XkbcServerMapRec { unsigned char * explicit; #endif - XkbcAction *acts; + union xkb_action *acts; XkbBehavior *behaviors; unsigned short *key_acts; unsigned char *explicits; diff --git a/src/malloc.c b/src/malloc.c index f3db1d0..08d419d 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -168,7 +168,7 @@ XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions) nNewActions = 1; if (!map->acts) { - map->acts = _XkbTypedCalloc(nNewActions + 1, XkbcAction); + map->acts = _XkbTypedCalloc(nNewActions + 1, union xkb_action); if (!map->acts) return BadAlloc; map->num_acts = 1; @@ -176,10 +176,10 @@ XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions) } else if ((map->size_acts - map->num_acts) < nNewActions) { unsigned need; - XkbcAction *prev_acts = map->acts; + union xkb_action *prev_acts = map->acts; need = map->num_acts + nNewActions; - map->acts = _XkbTypedRealloc(map->acts, need, XkbcAction); + map->acts = _XkbTypedRealloc(map->acts, need, union xkb_action); if (!map->acts) { _XkbFree(prev_acts); map->num_acts = map->size_acts = 0; @@ -188,7 +188,7 @@ XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions) map->size_acts = need; bzero(&map->acts[map->num_acts], - (map->size_acts - map->num_acts) * sizeof(XkbcAction)); + (map->size_acts - map->num_acts) * sizeof(union xkb_action)); } if (!map->key_acts) { @@ -815,11 +815,11 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC, return Success; } -XkbcAction * +union xkb_action * XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed) { int i, nActs; - XkbcAction *newActs; + union xkb_action *newActs; if (needed == 0) { xkb->server->key_acts[key] = 0; @@ -838,7 +838,7 @@ XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed) } xkb->server->size_acts = xkb->server->num_acts + needed + 8; - newActs = _XkbTypedCalloc(xkb->server->size_acts, XkbcAction); + newActs = _XkbTypedCalloc(xkb->server->size_acts, union xkb_action); if (!newActs) return NULL; newActs[0].type = XkbSA_NoAction; @@ -859,10 +859,10 @@ XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed) if (nCopy > 0) memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i), - nCopy * sizeof(XkbcAction)); + nCopy * sizeof(union xkb_action)); if (nCopy < nKeyActs) bzero(&newActs[nActs + nCopy], - (nKeyActs - nCopy) * sizeof(XkbcAction)); + (nKeyActs - nCopy) * sizeof(union xkb_action)); xkb->server->key_acts[i] = nActs; nActs += nKeyActs; diff --git a/src/xkballoc.h b/src/xkballoc.h index 98a9183..7c4b2cf 100644 --- a/src/xkballoc.h +++ b/src/xkballoc.h @@ -89,7 +89,7 @@ extern int XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC, XkbChangesPtr changes); -extern XkbcAction * +extern union xkb_action * XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed); extern void diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 63b2591..76c9b18 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -334,7 +334,7 @@ ReportNotFound(unsigned action, unsigned field, const char *what, char *bad) static Bool HandleNoAction(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { return ReportIllegal(action->type, field); @@ -392,14 +392,14 @@ CheckModifierField(XkbcDescPtr xkb, static Bool HandleSetLatchMods(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { - XkbcModAction *act; + struct xkb_mod_action *act; unsigned rtrn; unsigned t1, t2; - act = (XkbcModAction *) action; + act = (struct xkb_mod_action *) action; if (array_ndx != NULL) { switch (field) @@ -437,13 +437,13 @@ HandleSetLatchMods(XkbcDescPtr xkb, static Bool HandleLockMods(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { - XkbcModAction *act; + struct xkb_mod_action *act; unsigned t1, t2; - act = (XkbcModAction *) action; + act = (struct xkb_mod_action *) action; if ((array_ndx != NULL) && (field == F_Modifiers)) return ReportActionNotArray(action->type, field); switch (field) @@ -512,7 +512,7 @@ CheckGroupField(unsigned action, static Bool HandleSetLatchGroup(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { XkbGroupAction *act; @@ -557,7 +557,7 @@ HandleSetLatchGroup(XkbcDescPtr xkb, static Bool HandleLockGroup(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { XkbGroupAction *act; @@ -583,7 +583,7 @@ HandleLockGroup(XkbcDescPtr xkb, static Bool HandleMovePtr(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -648,7 +648,7 @@ static LookupEntry lockWhich[] = { static Bool HandlePtrBtn(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -710,7 +710,7 @@ static LookupEntry ptrDflts[] = { static Bool HandleSetPtrDflt(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -783,15 +783,15 @@ static LookupEntry isoNames[] = { static Bool HandleISOLock(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; - XkbcISOAction *act; + struct xkb_iso_action *act; unsigned flags, mods; int group; - act = (XkbcISOAction *) action; + act = (struct xkb_iso_action *) action; switch (field) { case F_Modifiers: @@ -830,7 +830,7 @@ HandleISOLock(XkbcDescPtr xkb, static Bool HandleSwitchScreen(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -922,13 +922,13 @@ LookupEntry ctrlNames[] = { static Bool HandleSetLockControls(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; - XkbcCtrlsAction *act; + struct xkb_controls_action *act; - act = (XkbcCtrlsAction *) action; + act = (struct xkb_controls_action *) action; if (field == F_Controls) { if (array_ndx != NULL) @@ -954,7 +954,7 @@ static LookupEntry evNames[] = { static Bool HandleActionMessage(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1032,7 +1032,7 @@ HandleActionMessage(XkbcDescPtr xkb, static Bool HandleRedirectKey(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1083,7 +1083,7 @@ HandleRedirectKey(XkbcDescPtr xkb, static Bool HandleDeviceBtn(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1153,7 +1153,7 @@ HandleDeviceBtn(XkbcDescPtr xkb, static Bool HandleDeviceValuator(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { #if 0 @@ -1168,7 +1168,7 @@ HandleDeviceValuator(XkbcDescPtr xkb, static Bool HandlePrivate(XkbcDescPtr xkb, - XkbcAnyAction * action, + struct xkb_any_action * action, unsigned field, ExprDef * array_ndx, ExprDef * value) { ExprResult rtrn; @@ -1237,7 +1237,7 @@ HandlePrivate(XkbcDescPtr xkb, } typedef Bool(*actionHandler) (XkbcDescPtr /* xkb */ , - XkbcAnyAction * /* action */ , + struct xkb_any_action * /* action */ , unsigned /* field */ , ExprDef * /* array_ndx */ , ExprDef * /* value */ @@ -1271,7 +1271,7 @@ static actionHandler handleAction[XkbSA_NumActions + 1] = { /***====================================================================***/ static void -ApplyActionFactoryDefaults(XkbcAction * action) +ApplyActionFactoryDefaults(union xkb_action * action) { if (action->type == XkbSA_SetPtrDflt) { /* increment default button */ @@ -1290,7 +1290,7 @@ ApplyActionFactoryDefaults(XkbcAction * action) int HandleActionDef(ExprDef * def, XkbcDescPtr xkb, - XkbcAnyAction * action, unsigned mergeMode, ActionInfo * info) + struct xkb_any_action * action, unsigned mergeMode, ActionInfo * info) { ExprDef *arg; register char *str; @@ -1319,7 +1319,7 @@ HandleActionDef(ExprDef * def, action->type = hndlrType = tmp; if (action->type != XkbSA_NoAction) { - ApplyActionFactoryDefaults((XkbcAction *) action); + ApplyActionFactoryDefaults((union xkb_action *) action); while (info) { if ((info->action == XkbSA_NoAction) diff --git a/src/xkbcomp/action.h b/src/xkbcomp/action.h index 685dbcf..8a7027d 100644 --- a/src/xkbcomp/action.h +++ b/src/xkbcomp/action.h @@ -66,7 +66,7 @@ typedef struct _ActionInfo extern int HandleActionDef(ExprDef * /* def */ , XkbcDescPtr /* xkb */ , - XkbcAnyAction * /* action */ , + struct xkb_any_action * /* action */ , unsigned /* mergeMode */ , ActionInfo * /* info */ ); diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 3e8c5d5..ca85a46 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -71,7 +71,7 @@ typedef struct _KeyInfo unsigned char actsDefined; short numLevels[XkbNumKbdGroups]; uint32_t *syms[XkbNumKbdGroups]; - XkbcAction *acts[XkbNumKbdGroups]; + union xkb_action *acts[XkbNumKbdGroups]; uint32_t types[XkbNumKbdGroups]; unsigned repeat; XkbBehavior behavior; @@ -190,14 +190,14 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld) } if (old->acts[i] != NULL) { - new->acts[i] = uTypedCalloc(width, XkbcAction); + new->acts[i] = uTypedCalloc(width, union xkb_action); if (!new->acts[i]) { new->acts[i] = NULL; return False; } memcpy((char *) new->acts[i], (char *) old->acts[i], - width * sizeof(XkbcAction)); + width * sizeof(union xkb_action)); } } } @@ -324,7 +324,7 @@ ResizeKeyGroup(KeyInfo * key, { key->acts[group] = uTypedRecalloc(key->acts[group], key->numLevels[group], newWidth, - XkbcAction); + union xkb_action); if (!key->acts[group]) return False; } @@ -337,7 +337,7 @@ MergeKeyGroups(SymbolsInfo * info, KeyInfo * into, KeyInfo * from, unsigned group) { uint32_t *resultSyms; - XkbcAction *resultActs; + union xkb_action *resultActs; int resultWidth; register int i; Bool report, clobber; @@ -370,7 +370,7 @@ MergeKeyGroups(SymbolsInfo * info, } if ((resultActs == NULL) && (into->acts[group] || from->acts[group])) { - resultActs = uTypedCalloc(resultWidth, XkbcAction); + resultActs = uTypedCalloc(resultWidth, union xkb_action); if (!resultActs) { WSGO("Could not allocate actions for group merge\n"); @@ -419,7 +419,7 @@ MergeKeyGroups(SymbolsInfo * info, } if (resultActs != NULL) { - XkbcAction *fromAct, *toAct; + union xkb_action *fromAct, *toAct; fromAct = (from->acts[group] ? &from->acts[group][i] : NULL); toAct = (into->acts[group] ? &into->acts[group][i] : NULL); if (((fromAct == NULL) || (fromAct->type == XkbSA_NoAction)) @@ -434,7 +434,7 @@ MergeKeyGroups(SymbolsInfo * info, } else { - XkbcAction *use, *ignore; + union xkb_action *use, *ignore; if (clobber) { use = fromAct; @@ -993,7 +993,7 @@ AddActionsToKey(KeyInfo * key, register int i; unsigned ndx, nActs; ExprDef *act; - XkbcAnyAction *toAct; + struct xkb_any_action *toAct; if (!GetGroupIndex(key, arrayNdx, ACTIONS, &ndx)) return False; @@ -1035,7 +1035,7 @@ AddActionsToKey(KeyInfo * key, } key->actsDefined |= (1 << ndx); - toAct = (XkbcAnyAction *) key->acts[ndx]; + toAct = (struct xkb_any_action *) key->acts[ndx]; act = value->value.child; for (i = 0; i < nActs; i++, toAct++) { @@ -1568,7 +1568,7 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key) key->syms[i] = (uint32_t *) NULL; if (key->acts[i] != NULL) free(key->acts[i]); - key->acts[i] = (XkbcAction *) NULL; + key->acts[i] = (union xkb_action *) NULL; key->types[i] = (uint32_t) 0; } } @@ -1579,7 +1579,7 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key) key->syms[group] = key->syms[0]; key->syms[0] = (uint32_t *) NULL; key->acts[group] = key->acts[0]; - key->acts[0] = (XkbcAction *) NULL; + key->acts[0] = (union xkb_action *) NULL; key->types[group] = key->types[0]; key->types[0] = (uint32_t) 0; return True; @@ -1876,11 +1876,11 @@ PrepareKeyDef(KeyInfo * key) } if ((key->actsDefined & 1) && key->acts[0]) { - key->acts[i] = uTypedCalloc(width, XkbcAction); + key->acts[i] = uTypedCalloc(width, union xkb_action); if (key->acts[i] == NULL) continue; memcpy((void *) key->acts[i], (void *) key->acts[0], - width * sizeof(XkbcAction)); + width * sizeof(union xkb_action)); key->actsDefined |= 1 << i; } if ((key->symsDefined & 1) && key->syms[0]) @@ -1919,7 +1919,7 @@ PrepareKeyDef(KeyInfo * key) if ((key->acts[i] != key->acts[0]) && (key->acts[i] == NULL || key->acts[0] == NULL || memcmp((void *) key->acts[i], (void *) key->acts[0], - sizeof(XkbcAction) * key->numLevels[0]))) + sizeof(union xkb_action) * key->numLevels[0]))) { identical = False; break; @@ -1935,7 +1935,7 @@ PrepareKeyDef(KeyInfo * key) key->syms[i] = (uint32_t *) NULL; if (key->acts[i] != NULL) free(key->acts[i]); - key->acts[i] = (XkbcAction *) NULL; + key->acts[i] = (union xkb_action *) NULL; key->types[i] = (uint32_t) 0; } key->symsDefined &= 1; @@ -1958,7 +1958,7 @@ CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from) XkbcKeyTypePtr type; Bool haveActions, autoType, useAlias; uint32_t *outSyms; - XkbcAction *outActs; + union xkb_action *outActs; unsigned types[XkbNumKbdGroups]; useAlias = (start_from == 0); -- 2.7.4