| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | #ifndef _XtinitialI_h |
| 49 | #define _XtinitialI_h |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | #ifndef X_NOT_POSIX |
| 58 | #ifdef _POSIX_SOURCE |
| 59 | #include <limits.h> |
| 60 | #else |
| 61 | #define _POSIX_SOURCE |
| 62 | #include <limits.h> |
| 63 | #undef _POSIX_SOURCE |
| 64 | #endif |
| 65 | #endif |
| 66 | #ifndef PATH_MAX |
| 67 | #ifdef WIN32 |
| 68 | #define PATH_MAX 512 |
| 69 | #else |
| 70 | #include <sys/param.h> |
| 71 | #endif |
| 72 | #ifndef PATH_MAX |
| 73 | #ifdef MAXPATHLEN |
| 74 | #define PATH_MAX MAXPATHLEN |
| 75 | #else |
| 76 | #define PATH_MAX 1024 |
| 77 | #endif |
| 78 | #endif |
| 79 | #endif |
| 80 | |
| 81 | #include <X11/Xos.h> |
| 82 | #include <X11/Xpoll.h> |
| 83 | |
| 84 | _XFUNCPROTOBEGIN |
| 85 | |
| 86 | typedef struct _TimerEventRec { |
| 87 | struct timeval te_timer_value; |
| 88 | struct _TimerEventRec *te_next; |
| 89 | XtTimerCallbackProc te_proc; |
| 90 | XtAppContext app; |
| 91 | XtPointer te_closure; |
| 92 | } TimerEventRec; |
| 93 | |
| 94 | typedef struct _InputEvent { |
| 95 | XtInputCallbackProc ie_proc; |
| 96 | XtPointer ie_closure; |
| 97 | struct _InputEvent *ie_next; |
| 98 | struct _InputEvent *ie_oq; |
| 99 | XtAppContext app; |
| 100 | int ie_source; |
| 101 | XtInputMask ie_condition; |
| 102 | } InputEvent; |
| 103 | |
| 104 | typedef struct _SignalEventRec { |
| 105 | XtSignalCallbackProc se_proc; |
| 106 | XtPointer se_closure; |
| 107 | struct _SignalEventRec *se_next; |
| 108 | XtAppContext app; |
| 109 | Boolean se_notice; |
| 110 | } SignalEventRec; |
| 111 | |
| 112 | typedef struct _WorkProcRec { |
| 113 | XtWorkProc proc; |
| 114 | XtPointer closure; |
| 115 | struct _WorkProcRec *next; |
| 116 | XtAppContext app; |
| 117 | } WorkProcRec; |
| 118 | |
| 119 | |
| 120 | typedef struct |
| 121 | { |
| 122 | #ifndef USE_POLL |
| 123 | fd_set rmask; |
| 124 | fd_set wmask; |
| 125 | fd_set emask; |
| 126 | #endif |
| 127 | int nfds; |
| 128 | } FdStruct; |
| 129 | |
| 130 | typedef struct _LangProcRec { |
| 131 | XtLanguageProc proc; |
| 132 | XtPointer closure; |
| 133 | } LangProcRec; |
| 134 | |
| 135 | typedef struct _ProcessContextRec { |
| 136 | XtAppContext defaultAppContext; |
| 137 | XtAppContext appContextList; |
| 138 | ConverterTable globalConverterTable; |
| 139 | LangProcRec globalLangProcRec; |
| 140 | } ProcessContextRec, *ProcessContext; |
| 141 | |
| 142 | typedef struct { |
| 143 | char* start; |
| 144 | char* current; |
| 145 | int bytes_remaining; |
| 146 | } Heap; |
| 147 | |
| 148 | typedef struct _DestroyRec DestroyRec; |
| 149 | |
| 150 | |
| 151 | typedef struct _XtAppStruct { |
| 152 | XtAppContext next; |
| 153 | ProcessContext process; |
| 154 | InternalCallbackList destroy_callbacks; |
| 155 | Display **list; |
| 156 | TimerEventRec *timerQueue; |
| 157 | WorkProcRec *workQueue; |
| 158 | InputEvent **input_list; |
| 159 | InputEvent *outstandingQueue; |
| 160 | SignalEventRec *signalQueue; |
| 161 | XrmDatabase errorDB; |
| 162 | XtErrorMsgHandler errorMsgHandler, warningMsgHandler; |
| 163 | XtErrorHandler errorHandler, warningHandler; |
| 164 | struct _ActionListRec *action_table; |
| 165 | ConverterTable converterTable; |
| 166 | unsigned long selectionTimeout; |
| 167 | FdStruct fds; |
| 168 | short count; |
| 169 | short max; |
| 170 | short last; |
| 171 | short input_count; |
| 172 | short input_max; |
| 173 | Boolean sync, being_destroyed, error_inited; |
| 174 | #ifndef NO_IDENTIFY_WINDOWS |
| 175 | Boolean identify_windows; |
| 176 | #endif |
| 177 | Heap heap; |
| 178 | String * fallback_resources; |
| 179 | struct _ActionHookRec* action_hook_list; |
| 180 | struct _BlockHookRec* block_hook_list; |
| 181 | int destroy_list_size; |
| 182 | int destroy_count; |
| 183 | int dispatch_level; |
| 184 | DestroyRec* destroy_list; |
| 185 | Widget in_phase2_destroy; |
| 186 | LangProcRec langProcRec; |
| 187 | struct _TMBindCacheRec * free_bindings; |
| 188 | _XtString display_name_tried; |
| 189 | Display **dpy_destroy_list; |
| 190 | int dpy_destroy_count; |
| 191 | Boolean exit_flag; |
| 192 | Boolean rebuild_fdlist; |
| 193 | #ifdef XTHREADS |
| 194 | LockPtr lock_info; |
| 195 | ThreadAppProc lock; |
| 196 | ThreadAppProc unlock; |
| 197 | ThreadAppYieldLockProc yield_lock; |
| 198 | ThreadAppRestoreLockProc restore_lock; |
| 199 | ThreadAppProc free_lock; |
| 200 | #endif |
| 201 | } XtAppStruct; |
| 202 | |
| 203 | extern void _XtHeapInit(Heap* heap); |
| 204 | extern void _XtHeapFree(Heap* heap); |
| 205 | |
| 206 | #ifdef XTTRACEMEMORY |
| 207 | |
| 208 | |
| 209 | extern char *_XtHeapMalloc( |
| 210 | Heap* , |
| 211 | Cardinal , |
| 212 | const char *, |
| 213 | int |
| 214 | ); |
| 215 | |
| 216 | #define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__) |
| 217 | |
| 218 | #else |
| 219 | |
| 220 | extern char* _XtHeapAlloc( |
| 221 | Heap* , |
| 222 | Cardinal |
| 223 | ); |
| 224 | |
| 225 | #endif |
| 226 | |
| 227 | extern void _XtSetDefaultErrorHandlers( |
| 228 | XtErrorMsgHandler* , |
| 229 | XtErrorMsgHandler* , |
| 230 | XtErrorHandler* , |
| 231 | XtErrorHandler* |
| 232 | ); |
| 233 | |
| 234 | extern void _XtSetDefaultSelectionTimeout( |
| 235 | unsigned long* |
| 236 | ); |
| 237 | |
| 238 | extern XtAppContext _XtDefaultAppContext( |
| 239 | void |
| 240 | ); |
| 241 | |
| 242 | extern ProcessContext _XtGetProcessContext( |
| 243 | void |
| 244 | ); |
| 245 | |
| 246 | Display * |
| 247 | _XtAppInit( |
| 248 | XtAppContext* , |
| 249 | String , |
| 250 | XrmOptionDescRec* , |
| 251 | Cardinal , |
| 252 | int* , |
| 253 | _XtString** , |
| 254 | String* |
| 255 | ); |
| 256 | |
| 257 | extern void _XtDestroyAppContexts( |
| 258 | void |
| 259 | ); |
| 260 | |
| 261 | extern void _XtCloseDisplays( |
| 262 | XtAppContext |
| 263 | ); |
| 264 | |
| 265 | extern int _XtAppDestroyCount; |
| 266 | |
| 267 | extern int _XtWaitForSomething( |
| 268 | XtAppContext , |
| 269 | _XtBoolean , |
| 270 | _XtBoolean , |
| 271 | _XtBoolean , |
| 272 | _XtBoolean , |
| 273 | _XtBoolean , |
| 274 | #ifdef XTHREADS |
| 275 | _XtBoolean , |
| 276 | #endif |
| 277 | unsigned long* |
| 278 | ); |
| 279 | |
| 280 | typedef struct _CaseConverterRec *CaseConverterPtr; |
| 281 | typedef struct _CaseConverterRec { |
| 282 | KeySym start; |
| 283 | KeySym stop; |
| 284 | XtCaseProc proc; |
| 285 | CaseConverterPtr next; |
| 286 | } CaseConverterRec; |
| 287 | |
| 288 | typedef struct _ExtensionSelectorRec { |
| 289 | XtExtensionSelectProc proc; |
| 290 | int min, max; |
| 291 | XtPointer client_data; |
| 292 | } ExtSelectRec; |
| 293 | |
| 294 | typedef struct _XtPerDisplayStruct { |
| 295 | InternalCallbackList destroy_callbacks; |
| 296 | Region region; |
| 297 | CaseConverterPtr case_cvt; |
| 298 | XtKeyProc defaultKeycodeTranslator; |
| 299 | XtAppContext appContext; |
| 300 | unsigned long keysyms_serial; |
| 301 | KeySym *keysyms; |
| 302 | int keysyms_per_keycode; |
| 303 | int min_keycode, max_keycode; |
| 304 | KeySym *modKeysyms; |
| 305 | ModToKeysymTable *modsToKeysyms; |
| 306 | unsigned char isModifier[32]; |
| 307 | KeySym lock_meaning; |
| 308 | Modifiers mode_switch; |
| 309 | Modifiers num_lock; |
| 310 | Boolean being_destroyed; |
| 311 | Boolean rv; |
| 312 | XrmName name; |
| 313 | XrmClass class; |
| 314 | Heap heap; |
| 315 | struct _GCrec *GClist; |
| 316 | Drawable **pixmap_tab; |
| 317 | String language; |
| 318 | XEvent last_event; |
| 319 | Time last_timestamp; |
| 320 | int multi_click_time; |
| 321 | struct _TMKeyContextRec* tm_context; |
| 322 | InternalCallbackList mapping_callbacks; |
| 323 | XtPerDisplayInputRec pdi; |
| 324 | struct _WWTable *WWtable; |
| 325 | XrmDatabase *per_screen_db; |
| 326 | XrmDatabase cmd_db; |
| 327 | XrmDatabase server_db; |
| 328 | XtEventDispatchProc* dispatcher_list; |
| 329 | ExtSelectRec* ext_select_list; |
| 330 | int ext_select_count; |
| 331 | Widget hook_object; |
| 332 | #ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT |
| 333 | Atom rcm_init; |
| 334 | Atom rcm_data; |
| 335 | #endif |
| 336 | } XtPerDisplayStruct, *XtPerDisplay; |
| 337 | |
| 338 | typedef struct _PerDisplayTable { |
| 339 | Display *dpy; |
| 340 | XtPerDisplayStruct perDpy; |
| 341 | struct _PerDisplayTable *next; |
| 342 | } PerDisplayTable, *PerDisplayTablePtr; |
| 343 | |
| 344 | extern PerDisplayTablePtr _XtperDisplayList; |
| 345 | |
| 346 | extern XtPerDisplay _XtSortPerDisplayList( |
| 347 | Display* |
| 348 | ); |
| 349 | |
| 350 | extern XtPerDisplay _XtGetPerDisplay( |
| 351 | Display* |
| 352 | ); |
| 353 | |
| 354 | extern XtPerDisplayInputRec* _XtGetPerDisplayInput( |
| 355 | Display* |
| 356 | ); |
| 357 | |
| 358 | #if 0 |
| 359 | #ifdef DEBUG |
| 360 | #define _XtGetPerDisplay(display) \ |
| 361 | ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \ |
| 362 | ? &_XtperDisplayList->perDpy \ |
| 363 | : _XtSortPerDisplayList(display)) |
| 364 | #define _XtGetPerDisplayInput(display) \ |
| 365 | ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \ |
| 366 | ? &_XtperDisplayList->perDpy.pdi \ |
| 367 | : &_XtSortPerDisplayList(display)->pdi) |
| 368 | #else |
| 369 | #define _XtGetPerDisplay(display) \ |
| 370 | ((_XtperDisplayList->dpy == (display)) \ |
| 371 | ? &_XtperDisplayList->perDpy \ |
| 372 | : _XtSortPerDisplayList(display)) |
| 373 | #define _XtGetPerDisplayInput(display) \ |
| 374 | ((_XtperDisplayList->dpy == (display)) \ |
| 375 | ? &_XtperDisplayList->perDpy.pdi \ |
| 376 | : &_XtSortPerDisplayList(display)->pdi) |
| 377 | #endif |
| 378 | #endif |
| 379 | |
| 380 | extern void _XtDisplayInitialize( |
| 381 | Display* , |
| 382 | XtPerDisplay , |
| 383 | _Xconst char* , |
| 384 | XrmOptionDescRec* , |
| 385 | Cardinal , |
| 386 | int* , |
| 387 | _XtString* |
| 388 | ); |
| 389 | |
| 390 | extern void _XtCacheFlushTag( |
| 391 | XtAppContext , |
| 392 | XtPointer |
| 393 | ); |
| 394 | |
| 395 | extern void _XtFreeActions( |
| 396 | struct _ActionListRec* |
| 397 | ); |
| 398 | |
| 399 | extern void _XtDoPhase2Destroy( |
| 400 | XtAppContext , |
| 401 | int |
| 402 | ); |
| 403 | |
| 404 | extern void _XtDoFreeBindings( |
| 405 | XtAppContext |
| 406 | ); |
| 407 | |
| 408 | extern void _XtExtensionSelect( |
| 409 | Widget |
| 410 | ); |
| 411 | |
| 412 | #define _XtSafeToDestroy(app) ((app)->dispatch_level == 0) |
| 413 | |
| 414 | extern void _XtAllocWWTable( |
| 415 | XtPerDisplay pd |
| 416 | ); |
| 417 | |
| 418 | extern void _XtFreeWWTable( |
| 419 | XtPerDisplay pd |
| 420 | ); |
| 421 | |
| 422 | extern String _XtGetUserName(_XtString dest, int len); |
| 423 | extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist, |
| 424 | Cardinal num_urs, int argc, _XtString *argv, |
| 425 | String *applName, String *displayName, |
| 426 | String *language); |
| 427 | |
| 428 | _XFUNCPROTOEND |
| 429 | |
| 430 | #endif |