File indexing completed on 2025-01-18 10:14:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 #define CACHE_TRANSLATIONS
0061
0062 #define TM_NO_MATCH (-2)
0063
0064 #define _XtRStateTablePair "_XtStateTablePair"
0065
0066 typedef unsigned char TMByteCard;
0067 typedef unsigned short TMShortCard;
0068 typedef unsigned long TMLongCard;
0069 typedef short TMShortInt;
0070
0071 typedef struct _TMTypeMatchRec *TMTypeMatch;
0072 typedef struct _TMModifierMatchRec *TMModifierMatch;
0073 typedef struct _TMEventRec *TMEventPtr;
0074
0075 typedef Boolean (*MatchProc)(TMTypeMatch typeMatch,
0076 TMModifierMatch modMatch,
0077 TMEventPtr eventSeq);
0078
0079 typedef struct _ModToKeysymTable {
0080 Modifiers mask;
0081 int count;
0082 int idx;
0083 } ModToKeysymTable;
0084
0085 typedef struct _LateBindings {
0086 unsigned int knot:1;
0087 unsigned int pair:1;
0088 unsigned short ref_count;
0089 KeySym keysym;
0090 } LateBindings, *LateBindingsPtr;
0091
0092 typedef short ModifierMask;
0093
0094 typedef struct _ActionsRec *ActionPtr;
0095 typedef struct _ActionsRec {
0096 int idx;
0097 String *params;
0098 Cardinal num_params;
0099 ActionPtr next;
0100 } ActionRec;
0101
0102 typedef struct _XtStateRec *StatePtr;
0103 typedef struct _XtStateRec {
0104 unsigned int isCycleStart:1;
0105 unsigned int isCycleEnd:1;
0106 TMShortCard typeIndex;
0107 TMShortCard modIndex;
0108 ActionPtr actions;
0109 StatePtr nextLevel;
0110 }StateRec;
0111
0112
0113 #define XtTableReplace 0
0114 #define XtTableAugment 1
0115 #define XtTableOverride 2
0116 #define XtTableUnmerge 3
0117
0118 typedef unsigned int _XtTranslateOp;
0119
0120
0121
0122
0123 typedef struct _TMModifierMatchRec{
0124 TMLongCard modifiers;
0125 TMLongCard modifierMask;
0126 LateBindingsPtr lateModifiers;
0127 Boolean standard;
0128 }TMModifierMatchRec;
0129
0130 typedef struct _TMTypeMatchRec{
0131 TMLongCard eventType;
0132 TMLongCard eventCode;
0133 TMLongCard eventCodeMask;
0134 MatchProc matchEvent;
0135 }TMTypeMatchRec;
0136
0137 typedef struct _TMBranchHeadRec {
0138 unsigned int isSimple:1;
0139 unsigned int hasActions:1;
0140 unsigned int hasCycles:1;
0141 unsigned int more:13;
0142 TMShortCard typeIndex;
0143 TMShortCard modIndex;
0144 }TMBranchHeadRec, *TMBranchHead;
0145
0146
0147
0148
0149 typedef struct _TMSimpleStateTreeRec{
0150 unsigned int isSimple:1;
0151 unsigned int isAccelerator:1;
0152 unsigned int mappingNotifyInterest:1;
0153 unsigned int refCount:13;
0154 TMShortCard numBranchHeads;
0155 TMShortCard numQuarks;
0156 TMShortCard unused;
0157 TMBranchHeadRec *branchHeadTbl;
0158 XrmQuark *quarkTbl;
0159 }TMSimpleStateTreeRec, *TMSimpleStateTree;
0160
0161
0162
0163
0164 typedef struct _TMComplexStateTreeRec{
0165 unsigned int isSimple:1;
0166 unsigned int isAccelerator:1;
0167 unsigned int mappingNotifyInterest:1;
0168 unsigned int refCount:13;
0169 TMShortCard numBranchHeads;
0170 TMShortCard numQuarks;
0171 TMShortCard numComplexBranchHeads;
0172 TMBranchHeadRec *branchHeadTbl;
0173 XrmQuark *quarkTbl;
0174 StatePtr *complexBranchHeadTbl;
0175 }TMComplexStateTreeRec, *TMComplexStateTree;
0176
0177
0178
0179
0180 typedef struct _TMParseStateTreeRec{
0181 unsigned int isSimple:1;
0182 unsigned int isAccelerator:1;
0183 unsigned int mappingNotifyInterest:1;
0184 unsigned int isStackQuarks:1;
0185 unsigned int isStackBranchHeads:1;
0186 unsigned int isStackComplexBranchHeads:1;
0187 unsigned int unused:10;
0188 TMShortCard numBranchHeads;
0189 TMShortCard numQuarks;
0190 TMShortCard numComplexBranchHeads;
0191 TMBranchHeadRec *branchHeadTbl;
0192 XrmQuark *quarkTbl;
0193 StatePtr *complexBranchHeadTbl;
0194 TMShortCard branchHeadTblSize;
0195 TMShortCard quarkTblSize;
0196 TMShortCard complexBranchHeadTblSize;
0197 StatePtr head;
0198 }TMParseStateTreeRec, *TMParseStateTree;
0199
0200 typedef union _TMStateTreeRec{
0201 TMSimpleStateTreeRec simple;
0202 TMParseStateTreeRec parse;
0203 TMComplexStateTreeRec complex;
0204 }*TMStateTree, **TMStateTreePtr, **TMStateTreeList;
0205
0206 typedef struct _TMSimpleBindProcsRec {
0207 XtActionProc *procs;
0208 }TMSimpleBindProcsRec, *TMSimpleBindProcs;
0209
0210 typedef struct _TMComplexBindProcsRec {
0211 Widget widget;
0212 XtTranslations aXlations;
0213 XtActionProc *procs;
0214 }TMComplexBindProcsRec, *TMComplexBindProcs;
0215
0216 typedef struct _TMSimpleBindDataRec {
0217 unsigned int isComplex:1;
0218 TMSimpleBindProcsRec bindTbl[1];
0219 }TMSimpleBindDataRec, *TMSimpleBindData;
0220
0221 typedef struct _TMComplexBindDataRec {
0222 unsigned int isComplex:1;
0223 struct _ATranslationData *accel_context;
0224 TMComplexBindProcsRec bindTbl[1];
0225 }TMComplexBindDataRec, *TMComplexBindData;
0226
0227 typedef union _TMBindDataRec{
0228 TMSimpleBindDataRec simple;
0229 TMComplexBindDataRec complex;
0230 }*TMBindData;
0231
0232 typedef struct _TranslationData{
0233 unsigned char hasBindings;
0234 unsigned char operation;
0235 TMShortCard numStateTrees;
0236 struct _TranslationData *composers[2];
0237 EventMask eventMask;
0238 TMStateTree stateTreeTbl[1];
0239 }TranslationData;
0240
0241
0242
0243
0244
0245
0246
0247
0248 typedef struct _ATranslationData{
0249 unsigned char hasBindings;
0250 unsigned char operation;
0251 struct _TranslationData *xlations;
0252 struct _ATranslationData *next;
0253 TMComplexBindProcsRec bindTbl[1];
0254 }ATranslationData, *ATranslations;
0255
0256 typedef struct _TMConvertRec {
0257 XtTranslations old;
0258 XtTranslations new;
0259 } TMConvertRec;
0260
0261 #define _XtEventTimerEventType ((TMLongCard)~0L)
0262 #define KeysymModMask (1L<<27)
0263 #define AnyButtonMask (1L<<28)
0264
0265 typedef struct _EventRec {
0266 TMLongCard modifiers;
0267 TMLongCard modifierMask;
0268 LateBindingsPtr lateModifiers;
0269 TMLongCard eventType;
0270 TMLongCard eventCode;
0271 TMLongCard eventCodeMask;
0272 MatchProc matchEvent;
0273 Boolean standard;
0274 } Event;
0275
0276 typedef struct _EventSeqRec *EventSeqPtr;
0277 typedef struct _EventSeqRec {
0278 Event event;
0279 StatePtr state;
0280 EventSeqPtr next;
0281 ActionPtr actions;
0282 } EventSeqRec;
0283
0284 typedef EventSeqRec EventRec;
0285 typedef EventSeqPtr EventPtr;
0286
0287 typedef struct _TMEventRec {
0288 XEvent *xev;
0289 Event event;
0290 }TMEventRec;
0291
0292 typedef struct _ActionHookRec {
0293 struct _ActionHookRec* next;
0294 XtAppContext app;
0295 XtActionHookProc proc;
0296 XtPointer closure;
0297 } ActionHookRec, *ActionHook;
0298
0299
0300 #define TMKEYCACHELOG2 6
0301 #define TMKEYCACHESIZE (1<<TMKEYCACHELOG2)
0302
0303 typedef struct _KeyCacheRec {
0304 unsigned char modifiers_return[256];
0305 KeyCode keycode[TMKEYCACHESIZE];
0306 unsigned char modifiers[TMKEYCACHESIZE];
0307 KeySym keysym[TMKEYCACHESIZE];
0308 } TMKeyCache;
0309
0310 typedef struct _TMKeyContextRec {
0311 XEvent *event;
0312 unsigned long serial;
0313 KeySym keysym;
0314 Modifiers modifiers;
0315 TMKeyCache keycache;
0316 } TMKeyContextRec, *TMKeyContext;
0317
0318 typedef struct _TMGlobalRec{
0319 TMTypeMatchRec **typeMatchSegmentTbl;
0320 TMShortCard numTypeMatches;
0321 TMShortCard numTypeMatchSegments;
0322 TMShortCard typeMatchSegmentTblSize;
0323 TMModifierMatchRec **modMatchSegmentTbl;
0324 TMShortCard numModMatches;
0325 TMShortCard numModMatchSegments;
0326 TMShortCard modMatchSegmentTblSize;
0327 Boolean newMatchSemantics;
0328 #ifdef TRACE_TM
0329 XtTranslations *tmTbl;
0330 TMShortCard numTms;
0331 TMShortCard tmTblSize;
0332 struct _TMBindCacheRec **bindCacheTbl;
0333 TMShortCard numBindCache;
0334 TMShortCard bindCacheTblSize;
0335 TMShortCard numLateBindings;
0336 TMShortCard numBranchHeads;
0337 TMShortCard numComplexStates;
0338 TMShortCard numComplexActions;
0339 #endif
0340 }TMGlobalRec;
0341
0342 _XFUNCPROTOBEGIN
0343
0344 extern TMGlobalRec _XtGlobalTM;
0345
0346 #define TM_MOD_SEGMENT_SIZE 16
0347 #define TM_TYPE_SEGMENT_SIZE 16
0348
0349 #define TMGetTypeMatch(idx) \
0350 ((TMTypeMatch) \
0351 &((_XtGlobalTM.typeMatchSegmentTbl[((idx) >> 4)])[(idx) & 15]))
0352 #define TMGetModifierMatch(idx) \
0353 ((TMModifierMatch) \
0354 &((_XtGlobalTM.modMatchSegmentTbl[(idx) >> 4])[(idx) & 15]))
0355
0356
0357 #define TMNewMatchSemantics() (_XtGlobalTM.newMatchSemantics)
0358 #define TMBranchMore(branch) (branch->more)
0359 #define TMComplexBranchHead(tree, br) \
0360 (((TMComplexStateTree)tree)->complexBranchHeadTbl[TMBranchMore(br)])
0361
0362 #define TMGetComplexBindEntry(bindData, idx) \
0363 ((TMComplexBindProcs)&(((TMComplexBindData)bindData)->bindTbl[idx]))
0364
0365 #define TMGetSimpleBindEntry(bindData, idx) \
0366 ((TMSimpleBindProcs)&(((TMSimpleBindData)bindData)->bindTbl[idx]))
0367
0368
0369 #define _InitializeKeysymTables(dpy, pd) \
0370 if (pd->keysyms == NULL) \
0371 _XtBuildKeysymTables(dpy, pd)
0372
0373
0374
0375
0376
0377 extern void _XtPopup(
0378 Widget ,
0379 XtGrabKind ,
0380 _XtBoolean
0381 );
0382
0383 extern _XtString _XtPrintXlations(
0384 Widget ,
0385 XtTranslations ,
0386 Widget ,
0387 _XtBoolean
0388 );
0389
0390 extern void _XtRegisterGrabs(
0391 Widget
0392 );
0393
0394 extern XtPointer _XtInitializeActionData(
0395 struct _XtActionsRec * ,
0396 Cardinal ,
0397 _XtBoolean
0398 );
0399
0400 extern void _XtAddEventSeqToStateTree(
0401 EventSeqPtr ,
0402 TMParseStateTree
0403 );
0404
0405 extern Boolean _XtMatchUsingStandardMods(
0406 TMTypeMatch ,
0407 TMModifierMatch ,
0408 TMEventPtr
0409 );
0410
0411 extern Boolean _XtMatchUsingDontCareMods(
0412 TMTypeMatch ,
0413 TMModifierMatch ,
0414 TMEventPtr
0415 );
0416
0417 extern Boolean _XtRegularMatch(
0418 TMTypeMatch ,
0419 TMModifierMatch ,
0420 TMEventPtr
0421 );
0422
0423 extern Boolean _XtMatchAtom(
0424 TMTypeMatch ,
0425 TMModifierMatch ,
0426 TMEventPtr
0427 );
0428
0429 extern void _XtTranslateEvent(
0430 Widget ,
0431 XEvent*
0432 );
0433
0434 #include "CallbackI.h"
0435 #include "EventI.h"
0436 #include "HookObjI.h"
0437 #include "PassivGraI.h"
0438 #include "ThreadsI.h"
0439 #include "InitialI.h"
0440 #include "ResourceI.h"
0441 #include "StringDefs.h"
0442
0443 extern void _XtBuildKeysymTables(Display *dpy, XtPerDisplay pd);
0444
0445 #ifndef NO_MIT_HACKS
0446 extern void _XtDisplayTranslations(
0447 Widget ,
0448 XEvent* ,
0449 String* ,
0450 Cardinal*
0451 );
0452
0453 extern void _XtDisplayAccelerators(
0454 Widget ,
0455 XEvent* ,
0456 String* ,
0457 Cardinal*
0458 );
0459
0460 extern void _XtDisplayInstalledAccelerators(
0461 Widget ,
0462 XEvent* ,
0463 String* ,
0464 Cardinal*
0465 );
0466 #endif
0467
0468 extern void _XtPopupInitialize(
0469 XtAppContext
0470 );
0471
0472 extern void _XtBindActions(
0473 Widget ,
0474 XtTM
0475 );
0476
0477 extern Boolean _XtComputeLateBindings(
0478 Display* ,
0479 LateBindingsPtr ,
0480 Modifiers* ,
0481 Modifiers*
0482 );
0483
0484 extern XtTranslations _XtCreateXlations(
0485 TMStateTree * ,
0486 TMShortCard ,
0487 XtTranslations ,
0488 XtTranslations
0489 );
0490
0491 extern Boolean _XtCvtMergeTranslations(
0492 Display* ,
0493 XrmValuePtr ,
0494 Cardinal* ,
0495 XrmValuePtr ,
0496 XrmValuePtr ,
0497 XtPointer*
0498 );
0499
0500 void _XtRemoveStateTreeByIndex(
0501 XtTranslations ,
0502 TMShortCard );
0503
0504 void _XtFreeTranslations(
0505 XtAppContext ,
0506 XrmValuePtr ,
0507 XtPointer ,
0508 XrmValuePtr ,
0509 Cardinal*
0510 );
0511
0512 extern TMShortCard _XtGetModifierIndex(
0513 Event*
0514 );
0515
0516 extern TMShortCard _XtGetQuarkIndex(
0517 TMParseStateTree ,
0518 XrmQuark
0519 );
0520
0521 extern XtTranslations _XtGetTranslationValue(
0522 Widget
0523 );
0524
0525 extern TMShortCard _XtGetTypeIndex(
0526 Event*
0527 );
0528
0529 extern void _XtGrabInitialize(
0530 XtAppContext
0531 );
0532
0533 extern void _XtInstallTranslations(
0534 Widget
0535 );
0536
0537 extern void _XtRemoveTranslations(
0538 Widget
0539 );
0540
0541 extern void _XtDestroyTMData(
0542 Widget
0543 );
0544
0545 extern void _XtMergeTranslations(
0546 Widget ,
0547 XtTranslations ,
0548 _XtTranslateOp
0549 );
0550
0551 extern void _XtActionInitialize(
0552 XtAppContext
0553 );
0554
0555 extern TMStateTree _XtParseTreeToStateTree(
0556 TMParseStateTree
0557 );
0558
0559 extern String _XtPrintActions(
0560 ActionRec* ,
0561 XrmQuark*
0562 );
0563
0564 extern String _XtPrintState(
0565 TMStateTree ,
0566 TMBranchHead );
0567
0568 extern String _XtPrintEventSeq(
0569 EventSeqPtr ,
0570 Display*
0571 );
0572
0573 typedef Boolean (*_XtTraversalProc)(
0574 StatePtr ,
0575 XtPointer
0576 );
0577
0578 extern void _XtTraverseStateTree(
0579 TMStateTree ,
0580 _XtTraversalProc ,
0581 XtPointer
0582 );
0583
0584 extern void _XtTranslateInitialize(
0585 void
0586 );
0587
0588 extern void _XtAddTMConverters(
0589 ConverterTable
0590 );
0591
0592 extern void _XtUnbindActions(
0593 Widget ,
0594 XtTranslations ,
0595 TMBindData
0596 );
0597
0598 extern void _XtUnmergeTranslations(
0599 Widget ,
0600 XtTranslations
0601 );
0602
0603
0604 extern void _XtAllocTMContext(XtPerDisplay pd);
0605
0606 _XFUNCPROTOEND