/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
******************************************************************/
* TranslateI.h - Header file private to translation management
* Author: Gabe Beged-Dov, HP
* Former Author: Charles Haynes
* Digital Equipment Corporation
* Western Research Laboratory
/*#define REFCNT_TRANSLATIONS*/
#define CACHE_TRANSLATIONS
#define _XtRStateTablePair "_XtStateTablePair"
typedef unsigned char TMByteCard;
typedef unsigned short TMShortCard;
typedef unsigned long TMLongCard;
typedef short TMShortInt;
typedef struct _TMTypeMatchRec *TMTypeMatch;
typedef struct _TMModifierMatchRec *TMModifierMatch;
typedef struct _TMEventRec *TMEventPtr;
typedef Boolean (*MatchProc)(TMTypeMatch typeMatch,
TMModifierMatch modMatch,
typedef struct _ModToKeysymTable {
typedef struct _LateBindings {
unsigned short ref_count; /* garbage collection */
} LateBindings, *LateBindingsPtr;
typedef short ModifierMask;
typedef struct _ActionsRec *ActionPtr;
typedef struct _ActionsRec {
int idx; /* index into quarkTable to find proc */
String *params; /* pointer to array of params */
Cardinal num_params; /* number of params */
ActionPtr next; /* next action to perform */
typedef struct _XtStateRec *StatePtr;
typedef struct _XtStateRec {
unsigned int isCycleStart:1;
unsigned int isCycleEnd:1;
ActionPtr actions; /* rhs list of actions to perform */
#define XtTableOverride 2
typedef unsigned int _XtTranslateOp;
typedef struct _TMModifierMatchRec{
LateBindingsPtr lateModifiers;
typedef struct _TMTypeMatchRec{
TMLongCard eventCodeMask;
typedef struct _TMBranchHeadRec {
unsigned int hasActions:1;
unsigned int hasCycles:1;
}TMBranchHeadRec, *TMBranchHead;
/* NOTE: elements of this structure must match those of
* TMComplexStateTreeRec and TMParseStateTreeRec.
typedef struct _TMSimpleStateTreeRec{
unsigned int isAccelerator:1;
unsigned int mappingNotifyInterest:1;
unsigned int refCount:13;
TMShortCard numBranchHeads;
TMShortCard numQuarks; /* # of entries in quarkTbl */
TMShortCard unused; /* to ensure same alignment */
TMBranchHeadRec *branchHeadTbl;
XrmQuark *quarkTbl; /* table of quarkified rhs*/
}TMSimpleStateTreeRec, *TMSimpleStateTree;
/* NOTE: elements of this structure must match those of
* TMSimpleStateTreeRec and TMParseStateTreeRec.
typedef struct _TMComplexStateTreeRec{
unsigned int isAccelerator:1;
unsigned int mappingNotifyInterest:1;
unsigned int refCount:13;
TMShortCard numBranchHeads;
TMShortCard numQuarks; /* # of entries in quarkTbl */
TMShortCard numComplexBranchHeads;
TMBranchHeadRec *branchHeadTbl;
XrmQuark *quarkTbl; /* table of quarkified rhs*/
StatePtr *complexBranchHeadTbl;
}TMComplexStateTreeRec, *TMComplexStateTree;
/* NOTE: elements of this structure must match those of
* TMSimpleStateTreeRec and TMComplexStateTreeRec.
typedef struct _TMParseStateTreeRec{
unsigned int isAccelerator:1;
unsigned int mappingNotifyInterest:1;
unsigned int isStackQuarks:1;
unsigned int isStackBranchHeads:1;
unsigned int isStackComplexBranchHeads:1;
unsigned int unused:10; /* to ensure correct alignment */
TMShortCard numBranchHeads;
TMShortCard numQuarks; /* # of entries in quarkTbl */
TMShortCard numComplexBranchHeads;
TMBranchHeadRec *branchHeadTbl;
XrmQuark *quarkTbl; /* table of quarkified rhs*/
StatePtr *complexBranchHeadTbl;
TMShortCard branchHeadTblSize;
TMShortCard quarkTblSize; /*total size of quarkTbl */
TMShortCard complexBranchHeadTblSize;
}TMParseStateTreeRec, *TMParseStateTree;
typedef union _TMStateTreeRec{
TMSimpleStateTreeRec simple;
TMParseStateTreeRec parse;
TMComplexStateTreeRec complex;
}*TMStateTree, **TMStateTreePtr, **TMStateTreeList;
typedef struct _TMSimpleBindProcsRec {
}TMSimpleBindProcsRec, *TMSimpleBindProcs;
typedef struct _TMComplexBindProcsRec {
Widget widget; /*widgetID to pass to action Proc*/
XtTranslations aXlations;
}TMComplexBindProcsRec, *TMComplexBindProcs;
typedef struct _TMSimpleBindDataRec {
unsigned int isComplex:1; /* must be first */
TMSimpleBindProcsRec bindTbl[1]; /* variable length */
}TMSimpleBindDataRec, *TMSimpleBindData;
typedef struct _TMComplexBindDataRec {
unsigned int isComplex:1; /* must be first */
struct _ATranslationData *accel_context; /* for GetValues */
TMComplexBindProcsRec bindTbl[1]; /* variable length */
}TMComplexBindDataRec, *TMComplexBindData;
typedef union _TMBindDataRec{
TMSimpleBindDataRec simple;
TMComplexBindDataRec complex;
typedef struct _TranslationData{
unsigned char hasBindings; /* must be first */
unsigned char operation; /*replace,augment,override*/
TMShortCard numStateTrees;
struct _TranslationData *composers[2];
TMStateTree stateTreeTbl[1]; /* variable length */
* ATranslations is returned by GetValues for translations that contain
* accelerators. The TM can differentiate between this and TranslationData
* (that don't have a bindTbl) by looking at the first field (hasBindings)
* of either structure. All ATranslationData structures associated with a
* widget are chained off the BindData record of the widget.
typedef struct _ATranslationData{
unsigned char hasBindings; /* must be first */
struct _TranslationData *xlations; /* actual translations */
struct _ATranslationData *next; /* chain the contexts together */
TMComplexBindProcsRec bindTbl[1]; /* accelerator bindings */
}ATranslationData, *ATranslations;
typedef struct _TMConvertRec {
XtTranslations old; /* table to merge into */
XtTranslations new; /* table to merge from */
#define _XtEventTimerEventType ((TMLongCard)~0L)
#define KeysymModMask (1L<<27) /* private to TM */
#define AnyButtonMask (1L<<28) /* private to TM */
typedef struct _EventRec {
LateBindingsPtr lateModifiers;
TMLongCard eventCodeMask;
typedef struct _EventSeqRec *EventSeqPtr;
typedef struct _EventSeqRec {
Event event; /* X event description */
StatePtr state; /* private to state table builder */
EventSeqPtr next; /* next event on line */
ActionPtr actions; /* r.h.s. list of actions to perform */
typedef EventSeqRec EventRec;
typedef EventSeqPtr EventPtr;
typedef struct _TMEventRec {
typedef struct _ActionHookRec {
struct _ActionHookRec* next; /* must remain first */
} ActionHookRec, *ActionHook;
/* choose a number between 2 and 8 */
#define TMKEYCACHESIZE (1<<TMKEYCACHELOG2)
typedef struct _KeyCacheRec {
unsigned char modifiers_return[256]; /* constant per KeyCode, key proc */
KeyCode keycode[TMKEYCACHESIZE];
unsigned char modifiers[TMKEYCACHESIZE];
KeySym keysym[TMKEYCACHESIZE];
typedef struct _TMKeyContextRec {
TMKeyCache keycache; /* keep this last, to keep offsets to others small */
} TMKeyContextRec, *TMKeyContext;
typedef struct _TMGlobalRec{
TMTypeMatchRec **typeMatchSegmentTbl;
TMShortCard numTypeMatches;
TMShortCard numTypeMatchSegments;
TMShortCard typeMatchSegmentTblSize;
TMModifierMatchRec **modMatchSegmentTbl;
TMShortCard numModMatches;
TMShortCard numModMatchSegments;
TMShortCard modMatchSegmentTblSize;
Boolean newMatchSemantics;
struct _TMBindCacheRec **bindCacheTbl;
TMShortCard numBindCache;
TMShortCard bindCacheTblSize;
TMShortCard numLateBindings;
TMShortCard numBranchHeads;
TMShortCard numComplexStates;
TMShortCard numComplexActions;
extern TMGlobalRec _XtGlobalTM;
#define TM_MOD_SEGMENT_SIZE 16
#define TM_TYPE_SEGMENT_SIZE 16
#define TMGetTypeMatch(idx) \
&((_XtGlobalTM.typeMatchSegmentTbl[((idx) >> 4)])[(idx) & 15]))
#define TMGetModifierMatch(idx) \
&((_XtGlobalTM.modMatchSegmentTbl[(idx) >> 4])[(idx) & 15]))
/* Useful Access Macros */
#define TMNewMatchSemantics() (_XtGlobalTM.newMatchSemantics)
#define TMBranchMore(branch) (branch->more)
#define TMComplexBranchHead(tree, br) \
(((TMComplexStateTree)tree)->complexBranchHeadTbl[TMBranchMore(br)])
#define TMGetComplexBindEntry(bindData, idx) \
((TMComplexBindProcs)&(((TMComplexBindData)bindData)->bindTbl[idx]))
#define TMGetSimpleBindEntry(bindData, idx) \
((TMSimpleBindProcs)&(((TMSimpleBindData)bindData)->bindTbl[idx]))
#define _InitializeKeysymTables(dpy, pd) \
if (pd->keysyms == NULL) \
_XtBuildKeysymTables(dpy, pd)
XtGrabKind /* grab_kind */,
_XtBoolean /* spring_loaded */
extern String _XtPrintXlations(
XtTranslations /* xlations */,
Widget /* accelWidget */,
_XtBoolean /* includeRHS */
extern void _XtRegisterGrabs(
extern XtPointer _XtInitializeActionData(
struct _XtActionsRec * /* actions */,
extern void _XtAddEventSeqToStateTree(
EventSeqPtr /* eventSeq */,
TMParseStateTree /* stateTree */
extern Boolean _XtMatchUsingStandardMods(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
extern Boolean _XtMatchUsingDontCareMods(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
extern Boolean _XtRegularMatch(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
extern Boolean _XtMatchAtom(
TMTypeMatch /* typeMatch */,
TMModifierMatch /* modMatch */,
TMEventPtr /* eventSeq */
extern void _XtTranslateEvent(
extern void _XtBuildKeysymTables(Display *dpy, XtPerDisplay pd);
extern void _XtDisplayTranslations(
Cardinal* /* num_params */
extern void _XtDisplayAccelerators(
Cardinal* /* num_params */
extern void _XtDisplayInstalledAccelerators(
Cardinal* /* num_params */
#endif /* ifndef NO_MIT_HACKS */
extern void _XtPopupInitialize(
XtAppContext /* app_context */
extern void _XtBindActions(
extern Boolean _XtComputeLateBindings(
LateBindingsPtr /* lateModifiers */,
Modifiers* /* computed */,
Modifiers* /* computedMask */
extern XtTranslations _XtCreateXlations(
TMStateTree * /* stateTrees */,
TMShortCard /* numStateTrees */,
XtTranslations /* first */,
XtTranslations /* second */
extern Boolean _XtCvtMergeTranslations(
Cardinal* /* num_args */,
XtPointer* /* closure_ret */
void _XtRemoveStateTreeByIndex(