File indexing completed on 2025-01-18 10:14:28
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 #ifndef _XtinitialI_h
0049 #define _XtinitialI_h
0050
0051
0052
0053
0054
0055
0056
0057 #ifndef X_NOT_POSIX
0058 #ifdef _POSIX_SOURCE
0059 #include <limits.h>
0060 #else
0061 #define _POSIX_SOURCE
0062 #include <limits.h>
0063 #undef _POSIX_SOURCE
0064 #endif
0065 #endif
0066 #ifndef PATH_MAX
0067 #ifdef WIN32
0068 #define PATH_MAX 512
0069 #else
0070 #include <sys/param.h>
0071 #endif
0072 #ifndef PATH_MAX
0073 #ifdef MAXPATHLEN
0074 #define PATH_MAX MAXPATHLEN
0075 #else
0076 #define PATH_MAX 1024
0077 #endif
0078 #endif
0079 #endif
0080
0081 #include <X11/Xos.h>
0082 #include <X11/Xpoll.h>
0083
0084 _XFUNCPROTOBEGIN
0085
0086 typedef struct _TimerEventRec {
0087 struct timeval te_timer_value;
0088 struct _TimerEventRec *te_next;
0089 XtTimerCallbackProc te_proc;
0090 XtAppContext app;
0091 XtPointer te_closure;
0092 } TimerEventRec;
0093
0094 typedef struct _InputEvent {
0095 XtInputCallbackProc ie_proc;
0096 XtPointer ie_closure;
0097 struct _InputEvent *ie_next;
0098 struct _InputEvent *ie_oq;
0099 XtAppContext app;
0100 int ie_source;
0101 XtInputMask ie_condition;
0102 } InputEvent;
0103
0104 typedef struct _SignalEventRec {
0105 XtSignalCallbackProc se_proc;
0106 XtPointer se_closure;
0107 struct _SignalEventRec *se_next;
0108 XtAppContext app;
0109 Boolean se_notice;
0110 } SignalEventRec;
0111
0112 typedef struct _WorkProcRec {
0113 XtWorkProc proc;
0114 XtPointer closure;
0115 struct _WorkProcRec *next;
0116 XtAppContext app;
0117 } WorkProcRec;
0118
0119
0120 typedef struct
0121 {
0122 #ifndef USE_POLL
0123 fd_set rmask;
0124 fd_set wmask;
0125 fd_set emask;
0126 #endif
0127 int nfds;
0128 } FdStruct;
0129
0130 typedef struct _LangProcRec {
0131 XtLanguageProc proc;
0132 XtPointer closure;
0133 } LangProcRec;
0134
0135 typedef struct _ProcessContextRec {
0136 XtAppContext defaultAppContext;
0137 XtAppContext appContextList;
0138 ConverterTable globalConverterTable;
0139 LangProcRec globalLangProcRec;
0140 } ProcessContextRec, *ProcessContext;
0141
0142 typedef struct {
0143 char* start;
0144 char* current;
0145 int bytes_remaining;
0146 } Heap;
0147
0148 typedef struct _DestroyRec DestroyRec;
0149
0150
0151 typedef struct _XtAppStruct {
0152 XtAppContext next;
0153 ProcessContext process;
0154 InternalCallbackList destroy_callbacks;
0155 Display **list;
0156 TimerEventRec *timerQueue;
0157 WorkProcRec *workQueue;
0158 InputEvent **input_list;
0159 InputEvent *outstandingQueue;
0160 SignalEventRec *signalQueue;
0161 XrmDatabase errorDB;
0162 XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
0163 XtErrorHandler errorHandler, warningHandler;
0164 struct _ActionListRec *action_table;
0165 ConverterTable converterTable;
0166 unsigned long selectionTimeout;
0167 FdStruct fds;
0168 short count;
0169 short max;
0170 short last;
0171 short input_count;
0172 short input_max;
0173 Boolean sync, being_destroyed, error_inited;
0174 #ifndef NO_IDENTIFY_WINDOWS
0175 Boolean identify_windows;
0176 #endif
0177 Heap heap;
0178 String * fallback_resources;
0179 struct _ActionHookRec* action_hook_list;
0180 struct _BlockHookRec* block_hook_list;
0181 int destroy_list_size;
0182 int destroy_count;
0183 int dispatch_level;
0184 DestroyRec* destroy_list;
0185 Widget in_phase2_destroy;
0186 LangProcRec langProcRec;
0187 struct _TMBindCacheRec * free_bindings;
0188 _XtString display_name_tried;
0189 Display **dpy_destroy_list;
0190 int dpy_destroy_count;
0191 Boolean exit_flag;
0192 Boolean rebuild_fdlist;
0193 #ifdef XTHREADS
0194 LockPtr lock_info;
0195 ThreadAppProc lock;
0196 ThreadAppProc unlock;
0197 ThreadAppYieldLockProc yield_lock;
0198 ThreadAppRestoreLockProc restore_lock;
0199 ThreadAppProc free_lock;
0200 #endif
0201 } XtAppStruct;
0202
0203 extern void _XtHeapInit(Heap* heap);
0204 extern void _XtHeapFree(Heap* heap);
0205
0206 #ifdef XTTRACEMEMORY
0207
0208
0209 extern char *_XtHeapMalloc(
0210 Heap* ,
0211 Cardinal ,
0212 const char *,
0213 int
0214 );
0215
0216 #define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
0217
0218 #else
0219
0220 extern char* _XtHeapAlloc(
0221 Heap* ,
0222 Cardinal
0223 );
0224
0225 #endif
0226
0227 extern void _XtSetDefaultErrorHandlers(
0228 XtErrorMsgHandler* ,
0229 XtErrorMsgHandler* ,
0230 XtErrorHandler* ,
0231 XtErrorHandler*
0232 );
0233
0234 extern void _XtSetDefaultSelectionTimeout(
0235 unsigned long*
0236 );
0237
0238 extern XtAppContext _XtDefaultAppContext(
0239 void
0240 );
0241
0242 extern ProcessContext _XtGetProcessContext(
0243 void
0244 );
0245
0246 Display *
0247 _XtAppInit(
0248 XtAppContext* ,
0249 String ,
0250 XrmOptionDescRec* ,
0251 Cardinal ,
0252 int* ,
0253 _XtString** ,
0254 String*
0255 );
0256
0257 extern void _XtDestroyAppContexts(
0258 void
0259 );
0260
0261 extern void _XtCloseDisplays(
0262 XtAppContext
0263 );
0264
0265 extern int _XtAppDestroyCount;
0266
0267 extern int _XtWaitForSomething(
0268 XtAppContext ,
0269 _XtBoolean ,
0270 _XtBoolean ,
0271 _XtBoolean ,
0272 _XtBoolean ,
0273 _XtBoolean ,
0274 #ifdef XTHREADS
0275 _XtBoolean ,
0276 #endif
0277 unsigned long*
0278 );
0279
0280 typedef struct _CaseConverterRec *CaseConverterPtr;
0281 typedef struct _CaseConverterRec {
0282 KeySym start;
0283 KeySym stop;
0284 XtCaseProc proc;
0285 CaseConverterPtr next;
0286 } CaseConverterRec;
0287
0288 typedef struct _ExtensionSelectorRec {
0289 XtExtensionSelectProc proc;
0290 int min, max;
0291 XtPointer client_data;
0292 } ExtSelectRec;
0293
0294 typedef struct _XtPerDisplayStruct {
0295 InternalCallbackList destroy_callbacks;
0296 Region region;
0297 CaseConverterPtr case_cvt;
0298 XtKeyProc defaultKeycodeTranslator;
0299 XtAppContext appContext;
0300 unsigned long keysyms_serial;
0301 KeySym *keysyms;
0302 int keysyms_per_keycode;
0303 int min_keycode, max_keycode;
0304 KeySym *modKeysyms;
0305 ModToKeysymTable *modsToKeysyms;
0306 unsigned char isModifier[32];
0307 KeySym lock_meaning;
0308 Modifiers mode_switch;
0309 Modifiers num_lock;
0310 Boolean being_destroyed;
0311 Boolean rv;
0312 XrmName name;
0313 XrmClass class;
0314 Heap heap;
0315 struct _GCrec *GClist;
0316 Drawable **pixmap_tab;
0317 String language;
0318 XEvent last_event;
0319 Time last_timestamp;
0320 int multi_click_time;
0321 struct _TMKeyContextRec* tm_context;
0322 InternalCallbackList mapping_callbacks;
0323 XtPerDisplayInputRec pdi;
0324 struct _WWTable *WWtable;
0325 XrmDatabase *per_screen_db;
0326 XrmDatabase cmd_db;
0327 XrmDatabase server_db;
0328 XtEventDispatchProc* dispatcher_list;
0329 ExtSelectRec* ext_select_list;
0330 int ext_select_count;
0331 Widget hook_object;
0332 #ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
0333 Atom rcm_init;
0334 Atom rcm_data;
0335 #endif
0336 } XtPerDisplayStruct, *XtPerDisplay;
0337
0338 typedef struct _PerDisplayTable {
0339 Display *dpy;
0340 XtPerDisplayStruct perDpy;
0341 struct _PerDisplayTable *next;
0342 } PerDisplayTable, *PerDisplayTablePtr;
0343
0344 extern PerDisplayTablePtr _XtperDisplayList;
0345
0346 extern XtPerDisplay _XtSortPerDisplayList(
0347 Display*
0348 );
0349
0350 extern XtPerDisplay _XtGetPerDisplay(
0351 Display*
0352 );
0353
0354 extern XtPerDisplayInputRec* _XtGetPerDisplayInput(
0355 Display*
0356 );
0357
0358 #if 0
0359 #ifdef DEBUG
0360 #define _XtGetPerDisplay(display) \
0361 ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
0362 ? &_XtperDisplayList->perDpy \
0363 : _XtSortPerDisplayList(display))
0364 #define _XtGetPerDisplayInput(display) \
0365 ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
0366 ? &_XtperDisplayList->perDpy.pdi \
0367 : &_XtSortPerDisplayList(display)->pdi)
0368 #else
0369 #define _XtGetPerDisplay(display) \
0370 ((_XtperDisplayList->dpy == (display)) \
0371 ? &_XtperDisplayList->perDpy \
0372 : _XtSortPerDisplayList(display))
0373 #define _XtGetPerDisplayInput(display) \
0374 ((_XtperDisplayList->dpy == (display)) \
0375 ? &_XtperDisplayList->perDpy.pdi \
0376 : &_XtSortPerDisplayList(display)->pdi)
0377 #endif
0378 #endif
0379
0380 extern void _XtDisplayInitialize(
0381 Display* ,
0382 XtPerDisplay ,
0383 _Xconst char* ,
0384 XrmOptionDescRec* ,
0385 Cardinal ,
0386 int* ,
0387 _XtString*
0388 );
0389
0390 extern void _XtCacheFlushTag(
0391 XtAppContext ,
0392 XtPointer
0393 );
0394
0395 extern void _XtFreeActions(
0396 struct _ActionListRec*
0397 );
0398
0399 extern void _XtDoPhase2Destroy(
0400 XtAppContext ,
0401 int
0402 );
0403
0404 extern void _XtDoFreeBindings(
0405 XtAppContext
0406 );
0407
0408 extern void _XtExtensionSelect(
0409 Widget
0410 );
0411
0412 #define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
0413
0414 extern void _XtAllocWWTable(
0415 XtPerDisplay pd
0416 );
0417
0418 extern void _XtFreeWWTable(
0419 XtPerDisplay pd
0420 );
0421
0422 extern String _XtGetUserName(_XtString dest, int len);
0423 extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist,
0424 Cardinal num_urs, int argc, _XtString *argv,
0425 String *applName, String *displayName,
0426 String *language);
0427
0428 _XFUNCPROTOEND
0429
0430 #endif