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