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