home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / Tk / pTk / tkInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-10  |  31.2 KB  |  856 lines

  1. /*
  2.  * tkInt.h --
  3.  *
  4.  *    Declarations for things used internally by the Tk
  5.  *    procedures but not exported outside the module.
  6.  *
  7.  * Copyright (c) 1990-1994 The Regents of the University of California.
  8.  * Copyright (c) 1994-1996 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkInt.h 1.172 96/10/12 17:29:48
  14.  */
  15.  
  16. #ifndef _TKINT
  17. #define _TKINT
  18.  
  19. #ifndef _TK
  20. #include "tk.h"
  21. #endif
  22.  
  23. #ifndef _LANG
  24. #include "Lang.h"
  25. #endif
  26. #ifndef _TKPORT
  27. #include "tkPort.h"
  28. #endif
  29.  
  30. /*
  31.  * Opaque type declarations:
  32.  */
  33.  
  34. typedef struct TkColormap TkColormap;
  35. typedef struct TkGrabEvent TkGrabEvent;
  36. typedef struct Tk_PostscriptInfo Tk_PostscriptInfo;
  37. typedef struct TkRegion_ *TkRegion;
  38. typedef struct TkStressedCmap TkStressedCmap;
  39.  
  40. /*
  41.  * One of the following structures is maintained for each cursor in
  42.  * use in the system.  This structure is used by tkCursor.c and the
  43.  * various system specific cursor files.
  44.  */
  45.  
  46. typedef struct TkCursor {
  47.     Tk_Cursor cursor;        /* System specific identifier for cursor. */
  48.     int refCount;        /* Number of active uses of cursor. */
  49.     Tcl_HashTable *otherTable;    /* Second table (other than idTable) used
  50.                  * to index this entry. */
  51.     Tcl_HashEntry *hashPtr;    /* Entry in otherTable for this structure
  52.                  * (needed when deleting). */
  53. } TkCursor;
  54.  
  55. /*
  56.  * One of the following structures is maintained for each display
  57.  * containing a window managed by Tk:
  58.  */
  59.  
  60. typedef struct TkDisplay {
  61.     Display *display;        /* Xlib's info about display. */
  62.     struct TkDisplay *nextPtr;    /* Next in list of all displays. */
  63.     char *name;            /* Name of display (with any screen
  64.                  * identifier removed).  Malloc-ed. */
  65.     Time lastEventTime;        /* Time of last event received for this
  66.                  * display. */
  67.  
  68.     /*
  69.      * Information used primarily by tkBind.c:
  70.      */
  71.  
  72.     int bindInfoStale;        /* Non-zero means the variables in this
  73.                  * part of the structure are potentially
  74.                  * incorrect and should be recomputed. */
  75.     unsigned int modeModMask;    /* Has one bit set to indicate the modifier
  76.                  * corresponding to "mode shift".  If no
  77.                  * such modifier, than this is zero. */
  78.     unsigned int metaModMask;    /* Has one bit set to indicate the modifier
  79.                  * corresponding to the "Meta" key.  If no
  80.                  * such modifier, then this is zero. */
  81.     unsigned int altModMask;    /* Has one bit set to indicate the modifier
  82.                  * corresponding to the "Meta" key.  If no
  83.                  * such modifier, then this is zero. */
  84.     enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
  85.                 /* Indicates how to interpret lock modifier. */
  86.     int numModKeyCodes;        /* Number of entries in modKeyCodes array
  87.                  * below. */
  88.     KeyCode *modKeyCodes;    /* Pointer to an array giving keycodes for
  89.                  * all of the keys that have modifiers
  90.                  * associated with them.  Malloc'ed, but
  91.                  * may be NULL. */
  92.  
  93.     /*
  94.      * Information used by tkError.c only:
  95.      */
  96.  
  97.     struct TkErrorHandler *errorPtr;
  98.                 /* First in list of error handlers
  99.                  * for this display.  NULL means
  100.                  * no handlers exist at present. */
  101.     int deleteCount;        /* Counts # of handlers deleted since
  102.                  * last time inactive handlers were
  103.                  * garbage-collected.  When this number
  104.                  * gets big, handlers get cleaned up. */
  105.  
  106.     /*
  107.      * Information used by tkSend.c only:
  108.      */
  109.  
  110.     Tk_Window commTkwin;    /* Window used for communication
  111.                  * between interpreters during "send"
  112.                  * commands.  NULL means send info hasn't
  113.                  * been initialized yet. */
  114.     Atom commProperty;        /* X's name for comm property. */
  115.     Atom registryProperty;    /* X's name for property containing
  116.                  * registry of interpreter names. */
  117.     Atom appNameProperty;    /* X's name for property used to hold the
  118.                  * application name on each comm window. */
  119.  
  120.     /*
  121.      * Information used by tkSelect.c and tkClipboard.c only:
  122.      */
  123.  
  124.     struct TkSelectionInfo *selectionInfoPtr;
  125.                 /* First in list of selection information
  126.                  * records.  Each entry contains information
  127.                  * about the current owner of a particular
  128.                  * selection on this display. */
  129.     Atom multipleAtom;        /* Atom for MULTIPLE.  None means
  130.                  * selection stuff isn't initialized. */
  131.     Atom incrAtom;        /* Atom for INCR. */
  132.     Atom targetsAtom;        /* Atom for TARGETS. */
  133.     Atom timestampAtom;        /* Atom for TIMESTAMP. */
  134.     Atom textAtom;        /* Atom for TEXT. */
  135.     Atom compoundTextAtom;    /* Atom for COMPOUND_TEXT. */
  136.     Atom applicationAtom;    /* Atom for TK_APPLICATION. */
  137.     Atom windowAtom;        /* Atom for TK_WINDOW. */
  138.     Atom clipboardAtom;        /* Atom for CLIPBOARD. */
  139.  
  140.     Tk_Window clipWindow;    /* Window used for clipboard ownership and to
  141.                  * retrieve selections between processes. NULL
  142.                  * means clipboard info hasn't been
  143.                  * initialized. */
  144.     int clipboardActive;    /* 1 means we currently own the clipboard
  145.                  * selection, 0 means we don't. */
  146.     struct TkMainInfo *clipboardAppPtr;
  147.                 /* Last application that owned clipboard. */
  148.     struct TkClipboardTarget *clipTargetPtr;
  149.                 /* First in list of clipboard type information
  150.                  * records.  Each entry contains information
  151.                  * about the buffers for a given selection
  152.                  * target. */
  153.  
  154.     /*
  155.      * Information used by tkAtom.c only:
  156.      */
  157.  
  158.     int atomInit;        /* 0 means stuff below hasn't been
  159.                  * initialized yet. */
  160.     Tcl_HashTable nameTable;    /* Maps from names to Atom's. */
  161.     Tcl_HashTable atomTable;    /* Maps from Atom's back to names. */
  162.  
  163.     /*
  164.      * Information used by tkCursor.c only:
  165.      */
  166.  
  167.     Font cursorFont;        /* Font to use for standard cursors.
  168.                  * None means font not loaded yet. */
  169.  
  170.     /*
  171.      * Information used by tkGrab.c only:
  172.      */
  173.  
  174.     struct TkWindow *grabWinPtr;
  175.                 /* Window in which the pointer is currently
  176.                  * grabbed, or NULL if none. */
  177.     struct TkWindow *eventualGrabWinPtr;
  178.                 /* Value that grabWinPtr will have once the
  179.                  * grab event queue (below) has been
  180.                  * completely emptied. */
  181.     struct TkWindow *buttonWinPtr;
  182.                 /* Window in which first mouse button was
  183.                  * pressed while grab was in effect, or NULL
  184.                  * if no such press in effect. */
  185.     struct TkWindow *serverWinPtr;
  186.                 /* If no application contains the pointer then
  187.                  * this is NULL.  Otherwise it contains the
  188.                  * last window for which we've gotten an
  189.                  * Enter or Leave event from the server (i.e.
  190.                  * the last window known to have contained
  191.                  * the pointer).  Doesn't reflect events
  192.                  * that were synthesized in tkGrab.c. */
  193.     TkGrabEvent *firstGrabEventPtr;
  194.                 /* First in list of enter/leave events
  195.                  * synthesized by grab code.  These events
  196.                  * must be processed in order before any other
  197.                  * events are processed.  NULL means no such
  198.                  * events. */
  199.     TkGrabEvent *lastGrabEventPtr;
  200.                 /* Last in list of synthesized events, or NULL
  201.                  * if list is empty. */
  202.     int grabFlags;        /* Miscellaneous flag values.  See definitions
  203.                  * in tkGrab.c. */
  204.  
  205.     /*
  206.      * Information used by tkXId.c only:
  207.      */
  208.  
  209.     struct TkIdStack *idStackPtr;
  210.                 /* First in list of chunks of free resource
  211.                  * identifiers, or NULL if there are no free
  212.                  * resources. */
  213.     XID (*defaultAllocProc) _ANSI_ARGS_((Display *display));
  214.                 /* Default resource allocator for display. */
  215.     struct TkIdStack *windowStackPtr;
  216.                 /* First in list of chunks of window
  217.                  * identifers that can't be reused right
  218.                  * now. */
  219.     int idCleanupScheduled;    /* 1 means a call to WindowIdCleanup has
  220.                  * already been scheduled, 0 means it
  221.                  * hasn't. */
  222.  
  223.     /*
  224.      * Information maintained by tkWindow.c for use later on by tkXId.c:
  225.      */
  226.  
  227.  
  228.     int destroyCount;        /* Number of Tk_DestroyWindow operations
  229.                  * in progress. */
  230.     unsigned long lastDestroyRequest;
  231.                 /* Id of most recent XDestroyWindow request;
  232.                  * can re-use ids in windowStackPtr when
  233.                  * server has seen this request and event
  234.                  * queue is empty. */
  235.  
  236.     /*
  237.      * Information used by tkVisual.c only:
  238.      */
  239.  
  240.     TkColormap *cmapPtr;    /* First in list of all non-default colormaps
  241.                  * allocated for this display. */
  242.  
  243.     /*
  244.      * Information used by tkFocus.c only:
  245.      */
  246.  
  247.     struct TkWindow *focusWinPtr;
  248.                 /* Window that currently has the focus for
  249.                  * this display, or NULL if none. */
  250.     struct TkWindow *implicitWinPtr;
  251.                 /* If the focus arrived at a toplevel window
  252.                  * implicitly via an Enter event (rather
  253.                  * than via a FocusIn event), this points
  254.                  * to the toplevel window.  Otherwise it is
  255.                  * NULL. */
  256.     struct TkWindow *focusOnMapPtr;
  257.                 /* This points to a toplevel window that is
  258.                  * supposed to receive the X input focus as
  259.                  * soon as it is mapped (needed to handle the
  260.                  * fact that X won't allow the focus on an
  261.                  * unmapped window).  NULL means no delayed
  262.                  * focus op in progress. */
  263.     int forceFocus;        /* Associated with focusOnMapPtr:  non-zero
  264.                  * means claim the focus even if some other
  265.                  * application currently has it. */
  266.  
  267.     /*
  268.      * Used by tkColor.c only:
  269.      */
  270.  
  271.     TkStressedCmap *stressPtr;    /* First in list of colormaps that have
  272.                  * filled up, so we have to pick an
  273.                  * approximate color. */
  274.  
  275.     /*
  276.      * Used by tkEvent.c only:
  277.      */
  278.  
  279.     struct TkWindowEvent *delayedMotionPtr;
  280.                 /* Points to a malloc-ed motion event
  281.                  * whose processing has been delayed in
  282.                  * the hopes that another motion event
  283.                  * will come along right away and we can
  284.                  * merge the two of them together.  NULL
  285.                  * means that there is no delayed motion
  286.                  * event. */
  287.  
  288.     /*
  289.      * Miscellaneous information:
  290.      */
  291.  
  292. #ifdef TK_USE_INPUT_METHODS
  293.     XIM inputMethod;        /* Input method for this display */
  294. #endif /* TK_USE_INPUT_METHODS */
  295.     Tcl_HashTable winTable;    /* Maps from X window ids to TkWindow ptrs. */
  296. } TkDisplay;
  297.  
  298. /*
  299.  * One of the following structures exists for each error handler
  300.  * created by a call to Tk_CreateErrorHandler.  The structure
  301.  * is managed by tkError.c.
  302.  */
  303.  
  304. typedef struct TkErrorHandler {
  305.     TkDisplay *dispPtr;        /* Display to which handler applies. */
  306.     unsigned long firstRequest;    /* Only errors with serial numbers
  307.                  * >= to this are considered. */
  308.     unsigned long lastRequest;    /* Only errors with serial numbers
  309.                  * <= to this are considered.  This
  310.                  * field is filled in when XUnhandle
  311.                  * is called.  -1 means XUnhandle
  312.                  * hasn't been called yet. */
  313.     int error;            /* Consider only errors with this
  314.                  * error_code (-1 means consider
  315.                  * all errors). */
  316.     int request;        /* Consider only errors with this
  317.                  * major request code (-1 means
  318.                  * consider all major codes). */
  319.     int minorCode;        /* Consider only errors with this
  320.                  * minor request code (-1 means
  321.                  * consider all minor codes). */
  322.     Tk_ErrorProc *errorProc;    /* Procedure to invoke when a matching
  323.                  * error occurs.  NULL means just ignore
  324.                  * errors. */
  325.     ClientData clientData;    /* Arbitrary value to pass to
  326.                  * errorProc. */
  327.     struct TkErrorHandler *nextPtr;
  328.                 /* Pointer to next older handler for
  329.                  * this display, or NULL for end of
  330.                  * list. */
  331. } TkErrorHandler;
  332.  
  333. /*
  334.  * One of the following structures exists for each event handler
  335.  * created by calling Tk_CreateEventHandler.  This information
  336.  * is used by tkEvent.c only.
  337.  */
  338.  
  339. typedef struct TkEventHandler {
  340.     unsigned long mask;        /* Events for which to invoke
  341.                  * proc. */
  342.     Tk_EventProc *proc;        /* Procedure to invoke when an event
  343.                  * in mask occurs. */
  344.     ClientData clientData;    /* Argument to pass to proc. */
  345.     struct TkEventHandler *nextPtr;
  346.                 /* Next in list of handlers
  347.                  * associated with window (NULL means
  348.                  * end of list). */
  349. } TkEventHandler;
  350.  
  351. /*
  352.  * Tk keeps one of the following data structures for each main
  353.  * window (created by a call to Tk_CreateMainWindow).  It stores
  354.  * information that is shared by all of the windows associated
  355.  * with a particular main window.
  356.  */
  357.  
  358. typedef struct TkMainInfo {
  359.     int refCount;        /* Number of windows whose "mainPtr" fields
  360.                  * point here.  When this becomes zero, can
  361.                  * free up the structure (the reference
  362.                  * count is zero because windows can get
  363.                  * deleted in almost any order;  the main
  364.                  * window isn't necessarily the last one
  365.                  * deleted). */
  366.     struct TkWindow *winPtr;    /* Pointer to main window. */
  367.     Tcl_Interp *interp;        /* Interpreter associated with application. */
  368.     Tcl_HashTable nameTable;    /* Hash table mapping path names to TkWindow
  369.                  * structs for all windows related to this
  370.                  * main window.  Managed by tkWindow.c. */
  371.     Tk_BindingTable bindingTable;
  372.                 /* Used in conjunction with "bind" command
  373.                  * to bind events to Tcl commands. */
  374.     struct TkVirtualEventTable *vetPtr;
  375.                 /* Hold definitions of virtual events. */
  376.     struct TkFocusInfo *focusPtr;
  377.                 /* First in list of records containing focus
  378.                  * information for each top-level in the
  379.                  * application.  Used only by tkFocus.c. */
  380.     unsigned long focusSerial;    /* Serial number of last request we made to
  381.                  * change the focus.  Used to identify
  382.                  * stale focus notifications coming from the
  383.                  * X server. */
  384.     struct TkWindow *lastFocusPtr;
  385.                 /* The most recent window that was given the
  386.                  * focus via "focus" command.  Used to restore
  387.                  * the focus when we get stale FocusIn
  388.                  * events. */
  389.     struct ElArray *optionRootPtr;
  390.                 /* Top level of option hierarchy for this
  391.                  * main window.  NULL means uninitialized.
  392.                  * Managed by tkOption.c. */
  393.     Tcl_HashTable imageTable;    /* Maps from image names to Tk_ImageMaster
  394.                  * structures.  Managed by tkImage.c. */
  395.     int strictMotif;        /* This is linked to the tk_strictMotif
  396.                  * global variable. */
  397.     struct TkMainInfo *nextPtr;    /* Next in list of all main windows managed by
  398.                  * this process. */
  399. } TkMainInfo;
  400.  
  401. /*
  402.  * Tk keeps one of the following structures for each window.
  403.  * Some of the information (like size and location) is a shadow
  404.  * of information managed by the X server, and some is special
  405.  * information used here, such as event and geometry management
  406.  * information.  This information is (mostly) managed by tkWindow.c.
  407.  * WARNING: the declaration below must be kept consistent with the
  408.  * Tk_FakeWin structure in tk.h.  If you change one, be sure to
  409.  * change the other!!
  410.  */
  411.  
  412. typedef struct TkWindow {
  413.  
  414.     /*
  415.      * Structural information:
  416.      */
  417.  
  418.     Display *display;        /* Display containing window. */
  419.     TkDisplay *dispPtr;        /* Tk's information about display
  420.                  * for window. */
  421.     int screenNum;        /* Index of screen for window, among all
  422.                  * those for dispPtr. */
  423.     Visual *visual;        /* Visual to use for window.  If not default,
  424.                  * MUST be set before X window is created. */
  425.     int depth;            /* Number of bits/pixel. */
  426.     Window window;        /* X's id for window.   NULL means window
  427.                  * hasn't actually been created yet, or it's
  428.                  * been deleted. */
  429.     struct TkWindow *childList;    /* First in list of child windows,
  430.                  * or NULL if no children. */
  431.     struct TkWindow *lastChildPtr;
  432.                 /* Last in list of child windows, or NULL
  433.                  * if no children. */
  434.     struct TkWindow *parentPtr;    /* Pointer to parent window (logical
  435.                  * parent, not necessarily X parent).  NULL
  436.                  * means either this is the main window, or
  437.                  * the window's parent has already been
  438.                  * deleted. */
  439.     struct TkWindow *nextPtr;    /* Next in list of children with
  440.                  * same parent (NULL if end of
  441.                  * list). */
  442.     TkMainInfo *mainPtr;    /* Information shared by all windows
  443.                  * associated with a particular main
  444.                  * window.  NULL means this window is
  445.                  * a rogue that isn't associated with
  446.                  * any application (at present, this
  447.                  * only happens for the dummy windows
  448.                  * used for "send" communication).  */
  449.  
  450.     /*
  451.      * Name and type information for the window:
  452.      */
  453.  
  454.     char *pathName;        /* Path name of window (concatenation
  455.                  * of all names between this window and
  456.                  * its top-level ancestor).  This is a
  457.                  * pointer into an entry in
  458.                  * mainPtr->nameTable.  NULL means that
  459.                  * the window hasn't been completely
  460.                  * created yet. */
  461.     Tk_Uid nameUid;        /* Name of the window within its parent
  462.                  * (unique within the parent). */
  463.     Tk_Uid classUid;        /* Class of the window.  NULL means window
  464.                  * hasn't been given a class yet. */
  465.  
  466.     /*
  467.      * Geometry and other attributes of window.  This information
  468.      * may not be updated on the server immediately;  stuff that
  469.      * hasn't been reflected in the server yet is called "dirty".
  470.      * At present, information can be dirty only if the window
  471.      * hasn't yet been created.
  472.      */
  473.  
  474.     XWindowChanges changes;    /* Geometry and other info about
  475.                  * window. */
  476.     unsigned int dirtyChanges;    /* Bits indicate fields of "changes"
  477.                  * that are dirty. */
  478.     XSetWindowAttributes atts;    /* Current attributes of window. */
  479.     unsigned long dirtyAtts;    /* Bits indicate fields of "atts"
  480.                  * that are dirty. */
  481.  
  482.     unsigned int flags;        /* Various flag values:  these are all
  483.                  * defined in tk.h (confusing, but they're
  484.                  * needed there for some query macros). */
  485.  
  486.     /*
  487.      * Information kept by the event manager (tkEvent.c):
  488.      */
  489.  
  490.     TkEventHandler *handlerList;/* First in list of event handlers
  491.                  * declared for this window, or
  492.                  * NULL if none. */
  493. #ifdef TK_USE_INPUT_METHODS
  494.     XIC inputContext;        /* Input context (for input methods). */
  495. #endif /* TK_USE_INPUT_METHODS */
  496.  
  497.     /*
  498.      * Information used for event bindings (see "bind" and "bindtags"
  499.      * commands in tkCmds.c):
  500.      */
  501.  
  502.     ClientData *tagPtr;        /* Points to array of tags used for bindings
  503.                  * on this window.  Each tag is a Tk_Uid.
  504.                  * Malloc'ed.  NULL means no tags. */
  505.     int numTags;        /* Number of tags at *tagPtr. */
  506.  
  507.     /*
  508.      * Information used by tkOption.c to manage options for the
  509.      * window.
  510.      */
  511.  
  512.     int optionLevel;        /* -1 means no option information is
  513.                  * currently cached for this window.
  514.                  * Otherwise this gives the level in
  515.                  * the option stack at which info is
  516.                  * cached. */
  517.     /*
  518.      * Information used by tkSelect.c to manage the selection.
  519.      */
  520.  
  521.     struct TkSelHandler *selHandlerList;
  522.                 /* First in list of handlers for
  523.                  * returning the selection in various
  524.                  * forms. */
  525.  
  526.     /*
  527.      * Information used by tkGeometry.c for geometry management.
  528.      */
  529.  
  530.     Tk_GeomMgr *geomMgrPtr;    /* Information about geometry manager for
  531.                  * this window. */
  532.     ClientData geomData;    /* Argument for geometry manager procedures. */
  533.     int reqWidth, reqHeight;    /* Arguments from last call to
  534.                  * Tk_GeometryRequest, or 0's if
  535.                  * Tk_GeometryRequest hasn't been
  536.                  * called. */
  537.     int internalBorderWidth;    /* Width of internal border of window
  538.                  * (0 means no internal border).  Geometry
  539.                  * managers should not normally place children
  540.                  * on top of the border. */
  541.  
  542.     /*
  543.      * Information maintained by tkWm.c for window manager communication.
  544.      */
  545.  
  546.     struct TkWmInfo *wmInfoPtr;    /* For top-level windows, points to
  547.                  * structure with wm-related info (see
  548.                  * tkWm.c).  For other windows, this
  549.                  * is NULL. */
  550.  
  551.     /*
  552.      * Platform specific information private to each port.
  553.      */
  554.  
  555.     struct TkWindowPrivate *privatePtr;
  556. } TkWindow;
  557.  
  558. /*
  559.  * The following structure is used as a two way map between integers
  560.  * and strings, usually to map between an internal C representation
  561.  * and the strings used in Tcl.
  562.  */
  563.  
  564. typedef struct TkStateMap {
  565.     int numKey;            /* Integer representation of a value. */
  566.     char *strKey;        /* String representation of a value. */
  567. } TkStateMap;
  568.  
  569. /*
  570.  * This structure is used by the Mac and Window porting layers as
  571.  * the internal representation of a clip_mask in a GC.
  572.  */
  573.  
  574. typedef struct TkpClipMask {
  575.     int type;            /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
  576.     union {
  577.     Pixmap pixmap;
  578.     TkRegion region;
  579.     } value;
  580. } TkpClipMask;
  581.  
  582. #define TKP_CLIP_PIXMAP 0
  583. #define TKP_CLIP_REGION 1
  584.  
  585. /*
  586.  * Pointer to first entry in list of all displays currently known.
  587.  */
  588.  
  589. extern TkDisplay *tkDisplayList;
  590.  
  591. /*
  592.  * Flags passed to TkMeasureChars:
  593.  */
  594.  
  595. #define TK_WHOLE_WORDS         1
  596. #define TK_AT_LEAST_ONE         2
  597. #define TK_PARTIAL_OK         4
  598. #define TK_NEWLINES_NOT_SPECIAL     8
  599. #define TK_IGNORE_TABS        16
  600.  
  601. /*
  602.  * Return values from TkGrabState:
  603.  */
  604.  
  605. #define TK_GRAB_NONE        0
  606. #define TK_GRAB_IN_TREE        1
  607. #define TK_GRAB_ANCESTOR    2
  608. #define TK_GRAB_EXCLUDED    3
  609.  
  610. /*
  611.  * The macro below is used to modify a "char" value (e.g. by casting
  612.  * it to an unsigned character) so that it can be used safely with
  613.  * macros such as isspace.
  614.  */
  615.  
  616. #define UCHAR(c) ((unsigned char) (c))
  617.  
  618. /*
  619.  * Miscellaneous variables shared among Tk modules but not exported
  620.  * to the outside world:
  621.  */
  622. typedef void TkDelayedEventProc _ANSI_ARGS_((void));
  623. typedef void tkHandleEventProc_t _ANSI_ARGS_((XEvent* eventPtr));
  624.  
  625. extern Tk_Uid            tkActiveUid;
  626. MOVEXT Tk_ImageType        tkBitmapImageType;
  627. MOVEXT Tk_ImageType        tkPixmapImageType;
  628. extern Tk_Uid            tkDisabledUid;
  629. MOVEXT Tk_PhotoImageFormat    tkImgFmtGIF;
  630. extern tkHandleEventProc_t    *tkHandleEventProc;
  631. MOVEXT Tk_PhotoImageFormat    tkImgFmtPPM;
  632. extern TkMainInfo        *tkMainWindowList;
  633. extern Tk_Uid            tkNormalUid;
  634. MOVEXT Tk_ImageType        tkPhotoImageType;
  635. extern int            tkSendSerial;
  636.  
  637. /*
  638.  * Internal procedures shared among Tk modules but not exported
  639.  * to the outside world:
  640.  */
  641.  
  642. EXTERN char *        TkAlignImageData _ANSI_ARGS_((XImage *image,
  643.                 int alignment, int bitOrder));
  644. MOVEXT int        TkAreaToPolygon _ANSI_ARGS_((double *polyPtr,
  645.                 int numPoints, double *rectPtr));
  646. MOVEXT void        TkBezierPoints _ANSI_ARGS_((double control[],
  647.                 int numSteps, double *coordPtr));
  648. MOVEXT void        TkBezierScreenPoints _ANSI_ARGS_((Tk_Canvas canvas,
  649.                 double control[], int numSteps,
  650.                 XPoint *xPointPtr));
  651. EXTERN void        TkBindEventProc _ANSI_ARGS_((TkWindow *winPtr,
  652.                 XEvent *eventPtr));
  653. EXTERN void        TkBindFree _ANSI_ARGS_((TkMainInfo *mainPtr));
  654. EXTERN void        TkBindInit _ANSI_ARGS_((TkMainInfo *mainPtr));
  655. EXTERN void        TkChangeEventWindow _ANSI_ARGS_((XEvent *eventPtr,
  656.                 TkWindow *winPtr));
  657. #ifndef TkClipBox
  658. EXTERN void        TkClipBox _ANSI_ARGS_((TkRegion rgn,
  659.                 XRectangle* rect_return));
  660. #endif
  661. EXTERN int        TkClipInit _ANSI_ARGS_((Tcl_Interp *interp,
  662.                 TkDisplay *dispPtr));
  663. EXTERN int        TkCmapStressed _ANSI_ARGS_((Tk_Window tkwin,
  664.                 Colormap colormap));
  665. EXTERN void        TkComputeTextGeometry _ANSI_ARGS_((
  666.                 XFontStruct *fontStructPtr, char *string,
  667.                 int numChars, int wrapLength, int *widthPtr,
  668.                 int *heightPtr));
  669. EXTERN void        TkConsoleCreate _ANSI_ARGS_((void));
  670. EXTERN int        TkConsoleInit _ANSI_ARGS_((Tcl_Interp *interp));
  671. EXTERN void        TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
  672.                 int devId, char *buffer, long size));
  673. EXTERN int        TkCopyAndGlobalEval _ANSI_ARGS_((Tcl_Interp *interp,
  674.                 char *script));
  675. EXTERN TkCursor *    TkCreateCursorFromData _ANSI_ARGS_((Tk_Window tkwin,
  676.                 char *source, char *mask, int width, int height,
  677.                 int xHot, int yHot, XColor fg, XColor bg));
  678. EXTERN int        TkCreateFrame _ANSI_ARGS_((ClientData clientData,
  679.                 Tcl_Interp *interp, int argc, Arg *args,
  680.                 int toplevel, char *appName));
  681. EXTERN Tk_Window    TkCreateMainWindow _ANSI_ARGS_((Tcl_Interp *interp,
  682.                 char *screenName, char *baseName));
  683. #ifndef TkCreateRegion
  684. EXTERN TkRegion        TkCreateRegion _ANSI_ARGS_((void));
  685. #endif
  686. EXTERN Time        TkCurrentTime _ANSI_ARGS_((TkDisplay *dispPtr));
  687. EXTERN int        TkDeadAppCmd _ANSI_ARGS_((ClientData clientData,
  688.                 Tcl_Interp *interp, int argc, Arg *args));
  689. EXTERN void        TkDeleteAllImages _ANSI_ARGS_((TkMainInfo *mainPtr));
  690. #ifndef TkDestroyRegion
  691. EXTERN void        TkDestroyRegion _ANSI_ARGS_((TkRegion rgn));
  692. #endif
  693. EXTERN void        TkDisplayChars _ANSI_ARGS_((Display *display,
  694.                 Drawable drawable, GC gc,
  695.                 XFontStruct *fontStructPtr, char *string,
  696.                 int numChars, int x, int y, int tabOrigin,
  697.                 int flags));
  698. EXTERN void        TkDisplayText _ANSI_ARGS_((Display *display,
  699.                 Drawable drawable, XFontStruct *fontStructPtr,
  700.                 char *string, int numChars, int x, int y,
  701.                 int length, Tk_Justify justify, int underline,
  702.                 GC gc));
  703. EXTERN void        TkEventDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  704. EXTERN void        TkFillPolygon _ANSI_ARGS_((Tk_Canvas canvas,
  705.                 double *coordPtr, int numPoints, Display *display,
  706.                 Drawable drawable, GC gc, GC outlineGC));
  707. EXTERN int        TkFindStateNum _ANSI_ARGS_((Tcl_Interp *interp,
  708.                 CONST char *option, CONST TkStateMap *mapPtr,
  709.                 CONST char *strKey));
  710. EXTERN char *        TkFindStateString _ANSI_ARGS_((
  711.                 CONST TkStateMap *mapPtr, int numKey));
  712. EXTERN void        TkFocusDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  713. EXTERN int        TkFocusFilterEvent _ANSI_ARGS_((TkWindow *winPtr,
  714.                 XEvent *eventPtr));
  715. EXTERN void        TkFreeBindingTags _ANSI_ARGS_((TkWindow *winPtr));
  716. EXTERN void        TkFreeWindowId _ANSI_ARGS_((TkDisplay *dispPtr,
  717.                 Window w));
  718. EXTERN void        TkFreeCursor _ANSI_ARGS_((TkCursor *cursorPtr));
  719. MOVEXT char *        TkGetBitmapData _ANSI_ARGS_((Tcl_Interp *interp,
  720.                 char *string, char *fileName, int *widthPtr,
  721.                 int *heightPtr, int *hotXPtr, int *hotYPtr));
  722. MOVEXT void        TkGetButtPoints _ANSI_ARGS_((double p1[], double p2[],
  723.                 double width, int project, double m1[],
  724.                 double m2[]));
  725. EXTERN TkCursor *    TkGetCursorByName _ANSI_ARGS_((Tcl_Interp *interp,
  726.                 Tk_Window tkwin, Arg string));
  727. EXTERN char *        TkGetDefaultScreenName _ANSI_ARGS_((Tcl_Interp *interp,
  728.                 char *screenName));
  729. EXTERN TkDisplay *    TkGetDisplay _ANSI_ARGS_((Display *display));
  730. EXTERN TkWindow *    TkGetFocus _ANSI_ARGS_((TkWindow *winPtr));
  731. EXTERN int        TkGetInterpNames _ANSI_ARGS_((Tcl_Interp *interp,
  732.                 Tk_Window tkwin));
  733. MOVEXT int        TkGetMiterPoints _ANSI_ARGS_((double p1[], double p2[],
  734.                 double p3[], double width, double m1[],
  735.                 double m2[]));
  736. #ifndef TkGetNativeProlog
  737. EXTERN int        TkGetNativeProlog _ANSI_ARGS_((Tcl_Interp *interp));
  738. #endif
  739. EXTERN void        TkGetPointerCoords _ANSI_ARGS_((Tk_Window tkwin,
  740.                 int *xPtr, int *yPtr));
  741. EXTERN int        TkGetProlog _ANSI_ARGS_((Tcl_Interp *interp));
  742. EXTERN void        TkGetServerInfo _ANSI_ARGS_((Tcl_Interp *interp,
  743.                 Tk_Window tkwin));
  744. EXTERN void        TkGrabDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  745. EXTERN int        TkGrabState _ANSI_ARGS_((TkWindow *winPtr));
  746. EXTERN TkWindow *          TkIDToWindow _ANSI_ARGS_((Window window, 
  747.                 TkDisplay *display));
  748. MOVEXT void        TkIncludePoint _ANSI_ARGS_((Tk_Item *itemPtr,
  749.                 double *pointPtr));
  750. EXTERN void        TkInitXId _ANSI_ARGS_((TkDisplay *dispPtr));
  751. EXTERN void        TkInOutEvents _ANSI_ARGS_((XEvent *eventPtr,
  752.                 TkWindow *sourcePtr, TkWindow *destPtr,
  753.                 int leaveType, int enterType,
  754.                 Tcl_QueuePosition position));
  755. #ifndef TkIntersectRegion
  756. EXTERN void        TkIntersectRegion _ANSI_ARGS_((TkRegion sra,
  757.                 TkRegion srcb, TkRegion dr_return));
  758. #endif
  759. EXTERN char *        TkKeysymToString _ANSI_ARGS_((KeySym keysym));
  760. MOVEXT int        TkLineToArea _ANSI_ARGS_((double end1Ptr[2],
  761.                 double end2Ptr[2], double rectPtr[4]));
  762. MOVEXT double        TkLineToPoint _ANSI_ARGS_((double end1Ptr[2],
  763.                 double end2Ptr[2], double pointPtr[2]));
  764. MOVEXT int        TkMakeBezierCurve _ANSI_ARGS_((Tk_Canvas canvas,
  765.                 double *pointPtr, int numPoints, int numSteps,
  766.                 XPoint xPoints[], double dblPoints[]));
  767. MOVEXT void        TkMakeBezierPostscript _ANSI_ARGS_((Tcl_Interp *interp,
  768.                 Tk_Canvas canvas, double *pointPtr,
  769.                 int numPoints));
  770. EXTERN Window        TkMakeWindow _ANSI_ARGS_((TkWindow *winPtr,
  771.                 Window parent));
  772. EXTERN int        TkMeasureChars _ANSI_ARGS_((XFontStruct *fontStructPtr,
  773.                 char *source, int maxChars, int startX, int maxX,
  774.                 int tabOrigin, int flags, int *nextXPtr));
  775. EXTERN void        TkOptionClassChanged _ANSI_ARGS_((TkWindow *winPtr));
  776. EXTERN void        TkOptionDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  777. MOVEXT int        TkOvalToArea _ANSI_ARGS_((double *ovalPtr,
  778.                 double *rectPtr));
  779. MOVEXT double        TkOvalToPoint _ANSI_ARGS_((double ovalPtr[4],
  780.                 double width, int filled, double pointPtr[2]));
  781. EXTERN int        TkPlatformInit _ANSI_ARGS_((Tcl_Interp *interp));
  782. EXTERN int        TkPointerEvent _ANSI_ARGS_((XEvent *eventPtr,
  783.                 TkWindow *winPtr));
  784. MOVEXT int        TkPolygonToArea _ANSI_ARGS_((double *polyPtr,
  785.                 int numPoints, double *rectPtr));
  786. MOVEXT double        TkPolygonToPoint _ANSI_ARGS_((double *polyPtr,
  787.                 int numPoints, double *pointPtr));
  788. EXTERN int        TkPositionInTree _ANSI_ARGS_((TkWindow *winPtr,
  789.                 TkWindow *treePtr));
  790. #ifndef TkPutImage
  791. EXTERN void        TkPutImage _ANSI_ARGS_((unsigned long *colors,
  792.                 int ncolors, Display* display, Drawable d,
  793.                 GC gc, XImage* image, int src_x, int src_y,
  794.                 int dest_x, int dest_y, unsigned int width,
  795.                 unsigned int height));
  796. #endif
  797. #ifndef TkRectInRegion
  798. EXTERN int        TkRectInRegion _ANSI_ARGS_((TkRegion rgn,
  799.                 int x, int y, unsigned int width,
  800.                 unsigned int height));
  801. #endif
  802. EXTERN void        TkQueueEventForAllChildren _ANSI_ARGS_((
  803.                 Tk_Window tkwin, XEvent *eventPtr));
  804. EXTERN int        TkScrollWindow _ANSI_ARGS_((Tk_Window tkwin, GC gc,
  805.                 int x, int y, int width, int height, int dx,
  806.                 int dy, TkRegion damageRgn));
  807. EXTERN void        TkSelDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  808. EXTERN void        TkSelEventProc _ANSI_ARGS_((Tk_Window tkwin,
  809.                 XEvent *eventPtr));
  810. EXTERN void        TkSelInit _ANSI_ARGS_((Tk_Window tkwin));
  811. #ifndef TkSetPixmapColormap
  812. EXTERN void        TkSetPixmapColormap _ANSI_ARGS_((Pixmap pixmap,
  813.                 Colormap colormap));
  814. #endif
  815. #ifndef TkSetRegion
  816. EXTERN void        TkSetRegion _ANSI_ARGS_((Display* display, GC gc,
  817.                 TkRegion rgn));
  818. #endif
  819. EXTERN void        TkSelPropProc _ANSI_ARGS_((XEvent *eventPtr));
  820. MOVEXT int        TkThickPolyLineToArea _ANSI_ARGS_((double *coordPtr,
  821.                 int numPoints, double width, int capStyle,
  822.                 int joinStyle, double *rectPtr));
  823. EXTERN KeySym        TkStringToKeysym _ANSI_ARGS_((char *name));
  824. EXTERN void        TkUnderlineChars _ANSI_ARGS_((Display *display,
  825.                 Drawable drawable, GC gc,
  826.                 XFontStruct *fontStructPtr, char *string,
  827.                 int x, int y, int tabOrigin, int flags,
  828.                 int firstChar, int lastChar));
  829. #ifndef TkUnionRectWithRegion
  830. EXTERN void        TkUnionRectWithRegion _ANSI_ARGS_((XRectangle* rect,
  831.                 TkRegion src, TkRegion dr_return));
  832. #endif
  833. EXTERN void        TkWmAddToColormapWindows _ANSI_ARGS_((
  834.                 TkWindow *winPtr));
  835. EXTERN void        TkWmDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  836. EXTERN void        TkWmMapWindow _ANSI_ARGS_((TkWindow *winPtr));
  837. EXTERN void        TkWmNewWindow _ANSI_ARGS_((TkWindow *winPtr));
  838. EXTERN void        TkWmProtocolEventProc _ANSI_ARGS_((TkWindow *winPtr,
  839.                 XEvent *evenvPtr));
  840. EXTERN void        TkWmRemoveFromColormapWindows _ANSI_ARGS_((
  841.                 TkWindow *winPtr));
  842. EXTERN void        TkWmRestackToplevel _ANSI_ARGS_((TkWindow *winPtr,
  843.                 int aboveBelow, TkWindow *otherPtr));
  844. EXTERN void        TkWmSetClass _ANSI_ARGS_((TkWindow *winPtr));
  845. EXTERN void        TkWmUnmapWindow _ANSI_ARGS_((TkWindow *winPtr));
  846. EXTERN int        TkXFileProc _ANSI_ARGS_((ClientData clientData,
  847.                 int mask, int flags));
  848.  
  849. /* 
  850.  * Unsupported commands.
  851.  */
  852. EXTERN int        TkUnsupported1Cmd _ANSI_ARGS_((ClientData clientData,
  853.                 Tcl_Interp *interp, int argc, Arg *args));
  854.  
  855. #endif  /* _TKINT */
  856.