home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / generic / tkInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  35.7 KB  |  993 lines  |  [TEXT/CWIE]

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