Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:28

0001 /***********************************************************
0002 
0003 Copyright 1987, 1988, 1994, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 
0026 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
0027 
0028                         All Rights Reserved
0029 
0030 Permission to use, copy, modify, and distribute this software and its
0031 documentation for any purpose and without fee is hereby granted,
0032 provided that the above copyright notice appear in all copies and that
0033 both that copyright notice and this permission notice appear in
0034 supporting documentation, and that the name of Digital not be
0035 used in advertising or publicity pertaining to distribution of the
0036 software without specific, written prior permission.
0037 
0038 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
0039 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
0040 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
0041 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
0042 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
0043 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
0044 SOFTWARE.
0045 
0046 ******************************************************************/
0047 
0048 #ifndef _XtinitialI_h
0049 #define _XtinitialI_h
0050 
0051 /****************************************************************
0052  *
0053  * Displays
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;      /* link to next app in process context */
0153     ProcessContext process; /* back pointer to our process context */
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;            /* num of assigned entries in list */
0169     short max;              /* allocate size of list */
0170     short last;
0171     short input_count;
0172     short input_max;            /* elts input_list init'd with */
0173     Boolean sync, being_destroyed, error_inited;
0174 #ifndef NO_IDENTIFY_WINDOWS
0175     Boolean identify_windows;       /* debugging hack */
0176 #endif
0177     Heap heap;
0178     String * fallback_resources;    /* Set by XtAppSetFallbackResources. */
0179     struct _ActionHookRec* action_hook_list;
0180     struct _BlockHookRec* block_hook_list;
0181     int destroy_list_size;      /* state data for 2-phase destroy */
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*   /* heap */,
0211     Cardinal    /* size */,
0212     const char */* file */,
0213     int     /* line */
0214 );
0215 
0216 #define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
0217 
0218 #else /* XTTRACEMEMORY */
0219 
0220 extern char* _XtHeapAlloc(
0221     Heap*   /* heap */,
0222     Cardinal    /* size */
0223 );
0224 
0225 #endif /* XTTRACEMEMORY */
0226 
0227 extern void _XtSetDefaultErrorHandlers(
0228     XtErrorMsgHandler*  /* errMsg */,
0229     XtErrorMsgHandler*  /* warnMsg */,
0230     XtErrorHandler* /* err */,
0231     XtErrorHandler* /* warn */
0232 );
0233 
0234 extern void _XtSetDefaultSelectionTimeout(
0235     unsigned long* /* timeout */
0236 );
0237 
0238 extern XtAppContext _XtDefaultAppContext(
0239     void
0240 );
0241 
0242 extern ProcessContext _XtGetProcessContext(
0243     void
0244 );
0245 
0246 Display *
0247 _XtAppInit(
0248     XtAppContext*   /* app_context_return */,
0249     String      /* application_class */,
0250     XrmOptionDescRec*   /* options */,
0251     Cardinal        /* num_options */,
0252     int*        /* argc_in_out */,
0253     _XtString**     /* argv_in_out */,
0254     String*     /* fallback_resources */
0255 );
0256 
0257 extern void _XtDestroyAppContexts(
0258     void
0259 );
0260 
0261 extern void _XtCloseDisplays(
0262     XtAppContext    /* app */
0263 );
0264 
0265 extern int _XtAppDestroyCount;
0266 
0267 extern int _XtWaitForSomething(
0268     XtAppContext    /* app */,
0269     _XtBoolean      /* ignoreEvents */,
0270     _XtBoolean      /* ignoreTimers */,
0271     _XtBoolean      /* ignoreInputs */,
0272     _XtBoolean      /* ignoreSignals */,
0273     _XtBoolean      /* block */,
0274 #ifdef XTHREADS
0275     _XtBoolean      /* drop_lock */,
0276 #endif
0277     unsigned long*  /* howlong */
0278 );
0279 
0280 typedef struct _CaseConverterRec *CaseConverterPtr;
0281 typedef struct _CaseConverterRec {
0282     KeySym      start;      /* first KeySym valid in converter */
0283     KeySym      stop;       /* last KeySym valid in converter */
0284     XtCaseProc      proc;       /* case converter function */
0285     CaseConverterPtr    next;       /* next converter record */
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;      /* user-registered case converters */
0298     XtKeyProc defaultKeycodeTranslator;
0299     XtAppContext appContext;
0300     unsigned long keysyms_serial;      /* for tracking MappingNotify events */
0301     KeySym *keysyms;                   /* keycode to keysym table */
0302     int keysyms_per_keycode;           /* number of keysyms for each keycode*/
0303     int min_keycode, max_keycode;      /* range of keycodes */
0304     KeySym *modKeysyms;                /* keysym values for modToKeysysm */
0305     ModToKeysymTable *modsToKeysyms;   /* modifiers to Keysysms index table*/
0306     unsigned char isModifier[32];      /* key-is-modifier-p bit table */
0307     KeySym lock_meaning;           /* Lock modifier meaning */
0308     Modifiers mode_switch;         /* keyboard group modifiers */
0309     Modifiers num_lock;            /* keyboard numlock modifiers */
0310     Boolean being_destroyed;
0311     Boolean rv;                /* reverse_video resource */
0312     XrmName name;              /* resolved app name */
0313     XrmClass class;            /* application class */
0314     Heap heap;
0315     struct _GCrec *GClist;         /* support for XtGetGC */
0316     Drawable **pixmap_tab;             /* ditto for XtGetGC */
0317     String language;               /* XPG language string */
0318     XEvent last_event;             /* last event dispatched */
0319     Time last_timestamp;           /* from last event dispatched */
0320     int multi_click_time;          /* for XtSetMultiClickTime */
0321     struct _TMKeyContextRec* tm_context;     /* for XtGetActionKeysym */
0322     InternalCallbackList mapping_callbacks;  /* special case for TM */
0323     XtPerDisplayInputRec pdi;          /* state for modal grabs & kbd focus */
0324     struct _WWTable *WWtable;          /* window to widget table */
0325     XrmDatabase *per_screen_db;        /* per screen resource databases */
0326     XrmDatabase cmd_db;            /* db from command line, if needed */
0327     XrmDatabase server_db;         /* resource property else .Xdefaults */
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;          /* ResConfig - initialize */
0334     Atom rcm_data;          /* ResConfig - data atom */
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* /* dpy */
0348 );
0349 
0350 extern XtPerDisplay _XtGetPerDisplay(
0351     Display*        /* dpy */
0352 );
0353 
0354 extern XtPerDisplayInputRec* _XtGetPerDisplayInput(
0355     Display*        /* dpy */
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 /*DEBUG*/
0378 #endif
0379 
0380 extern void _XtDisplayInitialize(
0381     Display*        /* dpy */,
0382     XtPerDisplay    /* pd */,
0383     _Xconst char*   /* name */,
0384     XrmOptionDescRec*   /* urlist */,
0385     Cardinal        /* num_urs */,
0386     int*        /* argc */,
0387     _XtString*      /* argv */
0388 );
0389 
0390 extern void _XtCacheFlushTag(
0391     XtAppContext /* app */,
0392     XtPointer    /* tag */
0393 );
0394 
0395 extern void _XtFreeActions(
0396     struct _ActionListRec* /* action_table */
0397 );
0398 
0399 extern void _XtDoPhase2Destroy(
0400     XtAppContext /* app */,
0401     int      /* dispatch_level */
0402 );
0403 
0404 extern void _XtDoFreeBindings(
0405     XtAppContext /* app */
0406 );
0407 
0408 extern void _XtExtensionSelect(
0409     Widget /* 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 /* _XtinitialI_h */