comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tkInt.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 /*
2 * tkInt.h --
3 *
4 * Declarations for things used internally by the Tk functions but not
5 * 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 of
12 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 */
14
15 #ifndef _TKINT
16 #define _TKINT
17
18 #ifndef _TKPORT
19 #include "tkPort.h"
20 #endif
21
22 #define TK_OPTION_ENUM_VAR ((int)(sizeof(Tk_OptionType)&(sizeof(int)-1))<<6)
23
24 /*
25 * Ensure WORDS_BIGENDIAN is defined correctly:
26 * Needs to happen here in addition to configure to work with fat compiles on
27 * Darwin (where configure runs only once for multiple architectures).
28 */
29
30 #include <stdio.h>
31 #ifdef HAVE_SYS_TYPES_H
32 # include <sys/types.h>
33 #endif
34 #ifdef HAVE_SYS_PARAM_H
35 # include <sys/param.h>
36 #endif
37 #ifdef BYTE_ORDER
38 # ifdef BIG_ENDIAN
39 # if BYTE_ORDER == BIG_ENDIAN
40 # undef WORDS_BIGENDIAN
41 # define WORDS_BIGENDIAN 1
42 # endif
43 # endif
44 # ifdef LITTLE_ENDIAN
45 # if BYTE_ORDER == LITTLE_ENDIAN
46 # undef WORDS_BIGENDIAN
47 # endif
48 # endif
49 #endif
50
51 /*
52 * Used to tag functions that are only to be visible within the module being
53 * built and not outside it (where this is supported by the linker).
54 */
55
56 #ifndef MODULE_SCOPE
57 # ifdef __cplusplus
58 # define MODULE_SCOPE extern "C"
59 # else
60 # define MODULE_SCOPE extern
61 # endif
62 #endif
63
64 #ifndef JOIN
65 # define JOIN(a,b) JOIN1(a,b)
66 # define JOIN1(a,b) a##b
67 #endif
68
69 #ifndef TCL_UNUSED
70 # if defined(__cplusplus)
71 # define TCL_UNUSED(T) T
72 # elif defined(__GNUC__) && (__GNUC__ > 2)
73 # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused))
74 # else
75 # define TCL_UNUSED(T) T JOIN(dummy, __LINE__)
76 # endif
77 #endif
78
79 #if defined(_WIN32) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
80 # if TCL_UTF_MAX > 3
81 # define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf((TCHAR *)(a),(b)*sizeof(WCHAR),c)
82 # define Tcl_UtfToWCharDString(a,b,c) (WCHAR *)Tcl_WinUtfToTChar(a,b,c)
83 # else
84 # define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString)
85 # define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString)
86 # endif
87 #endif
88
89 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
90 # define TKFLEXARRAY
91 #elif defined(__GNUC__) && (__GNUC__ > 2)
92 # define TKFLEXARRAY 0
93 #else
94 # define TKFLEXARRAY 1
95 #endif
96
97 #ifndef Tcl_GetParent
98 # define Tcl_GetParent Tcl_GetMaster
99 #endif
100
101 /*
102 * Macros used to cast between pointers and integers (e.g. when storing an int
103 * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
104 * to/from pointer from/to integer of different size".
105 */
106
107 #if !defined(INT2PTR) && !defined(PTR2INT)
108 # if defined(HAVE_INTPTR_T) || defined(intptr_t)
109 # define INT2PTR(p) ((void*)(intptr_t)(p))
110 # define PTR2INT(p) ((int)(intptr_t)(p))
111 # else
112 # define INT2PTR(p) ((void*)(p))
113 # define PTR2INT(p) ((int)(p))
114 # endif
115 #endif
116 #if !defined(UINT2PTR) && !defined(PTR2UINT)
117 # if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
118 # define UINT2PTR(p) ((void*)(uintptr_t)(p))
119 # define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
120 # else
121 # define UINT2PTR(p) ((void*)(p))
122 # define PTR2UINT(p) ((unsigned int)(p))
123 # endif
124 #endif
125
126 #ifndef TCL_Z_MODIFIER
127 # if defined(_WIN64)
128 # define TCL_Z_MODIFIER "I"
129 # elif defined(__GNUC__) && !defined(_WIN32)
130 # define TCL_Z_MODIFIER "z"
131 # else
132 # define TCL_Z_MODIFIER ""
133 # endif
134 #endif /* !TCL_Z_MODIFIER */
135
136 /*
137 * Opaque type declarations:
138 */
139
140 typedef struct TkColormap TkColormap;
141 typedef struct TkFontAttributes TkFontAttributes;
142 typedef struct TkGrabEvent TkGrabEvent;
143 typedef struct TkpCursor_ *TkpCursor;
144 typedef struct TkRegion_ *TkRegion;
145 typedef struct TkStressedCmap TkStressedCmap;
146 typedef struct TkBindInfo_ *TkBindInfo;
147 typedef struct Busy *TkBusy;
148
149 /*
150 * One of the following structures is maintained for each cursor in use in the
151 * system. This structure is used by tkCursor.c and the various system-
152 * specific cursor files.
153 */
154
155 typedef struct TkCursor {
156 Tk_Cursor cursor; /* System specific identifier for cursor. */
157 Display *display; /* Display containing cursor. Needed for
158 * disposal and retrieval of cursors. */
159 int resourceRefCount; /* Number of active uses of this cursor (each
160 * active use corresponds to a call to
161 * Tk_AllocPreserveFromObj or Tk_Preserve). If
162 * this count is 0, then this structure is no
163 * longer valid and it isn't present in a hash
164 * table: it is being kept around only because
165 * there are objects referring to it. The
166 * structure is freed when resourceRefCount
167 * and objRefCount are both 0. */
168 int objRefCount; /* Number of Tcl objects that reference this
169 * structure.. */
170 Tcl_HashTable *otherTable; /* Second table (other than idTable) used to
171 * index this entry. */
172 Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure
173 * (needed when deleting). */
174 Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure (needed
175 * when deleting). */
176 struct TkCursor *nextPtr; /* Points to the next TkCursor structure with
177 * the same name. Cursors with the same name
178 * but different displays are chained together
179 * off a single hash table entry. */
180 } TkCursor;
181
182 /*
183 * The following structure is kept one-per-TkDisplay to maintain information
184 * about the caret (cursor location) on this display. This is used to dictate
185 * global focus location (Windows Accessibility guidelines) and to position
186 * the IME or XIM over-the-spot window.
187 */
188
189 typedef struct TkCaret {
190 struct TkWindow *winPtr; /* The window on which we requested caret
191 * placement. */
192 int x; /* Relative x coord of the caret. */
193 int y; /* Relative y coord of the caret. */
194 int height; /* Specified height of the window. */
195 } TkCaret;
196
197 /*
198 * One of the following structures is maintained for each display containing a
199 * window managed by Tk. In part, the structure is used to store thread-
200 * specific data, since each thread will have its own TkDisplay structure.
201 */
202
203 typedef struct TkDisplay {
204 Display *display; /* Xlib's info about display. */
205 struct TkDisplay *nextPtr; /* Next in list of all displays. */
206 char *name; /* Name of display (with any screen identifier
207 * removed). Malloc-ed. */
208 Time lastEventTime; /* Time of last event received for this
209 * display. */
210
211 /*
212 * Information used primarily by tk3d.c:
213 */
214
215 int borderInit; /* 0 means borderTable needs initializing. */
216 Tcl_HashTable borderTable; /* Maps from color name to TkBorder
217 * structure. */
218
219 /*
220 * Information used by tkAtom.c only:
221 */
222
223 int atomInit; /* 0 means stuff below hasn't been initialized
224 * yet. */
225 Tcl_HashTable nameTable; /* Maps from names to Atom's. */
226 Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
227
228 /*
229 * Information used primarily by tkBind.c:
230 */
231
232 int bindInfoStale; /* Non-zero means the variables in this part
233 * of the structure are potentially incorrect
234 * and should be recomputed. */
235 unsigned int modeModMask; /* Has one bit set to indicate the modifier
236 * corresponding to "mode shift". If no such
237 * modifier, than this is zero. */
238 unsigned int metaModMask; /* Has one bit set to indicate the modifier
239 * corresponding to the "Meta" key. If no such
240 * modifier, then this is zero. */
241 unsigned int altModMask; /* Has one bit set to indicate the modifier
242 * corresponding to the "Meta" key. If no such
243 * modifier, then this is zero. */
244 enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
245 /* Indicates how to interpret lock
246 * modifier. */
247 int numModKeyCodes; /* Number of entries in modKeyCodes array
248 * below. */
249 KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for all
250 * of the keys that have modifiers associated
251 * with them. Malloc'ed, but may be NULL. */
252
253 /*
254 * Information used by tkBitmap.c only:
255 */
256
257 int bitmapInit; /* 0 means tables above need initializing. */
258 int bitmapAutoNumber; /* Used to number bitmaps. */
259 Tcl_HashTable bitmapNameTable;
260 /* Maps from name of bitmap to the first
261 * TkBitmap record for that name. */
262 Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
263 * structure for the bitmap. */
264 Tcl_HashTable bitmapDataTable;
265 /* Used by Tk_GetBitmapFromData to map from a
266 * collection of in-core data about a bitmap
267 * to a reference giving an automatically-
268 * generated name for the bitmap. */
269
270 /*
271 * Information used by tkCanvas.c only:
272 */
273
274 int numIdSearches;
275 int numSlowSearches;
276
277 /*
278 * Used by tkColor.c only:
279 */
280
281 int colorInit; /* 0 means color module needs initializing. */
282 TkStressedCmap *stressPtr; /* First in list of colormaps that have filled
283 * up, so we have to pick an approximate
284 * color. */
285 Tcl_HashTable colorNameTable;
286 /* Maps from color name to TkColor structure
287 * for that color. */
288 Tcl_HashTable colorValueTable;
289 /* Maps from integer RGB values to TkColor
290 * structures. */
291
292 /*
293 * Used by tkCursor.c only:
294 */
295
296 int cursorInit; /* 0 means cursor module need initializing. */
297 Tcl_HashTable cursorNameTable;
298 /* Maps from a string name to a cursor to the
299 * TkCursor record for the cursor. */
300 Tcl_HashTable cursorDataTable;
301 /* Maps from a collection of in-core data
302 * about a cursor to a TkCursor structure. */
303 Tcl_HashTable cursorIdTable;
304 /* Maps from a cursor id to the TkCursor
305 * structure for the cursor. */
306 char cursorString[20]; /* Used to store a cursor id string. */
307 Font cursorFont; /* Font to use for standard cursors. None
308 * means font not loaded yet. */
309
310 /*
311 * Information used by tkError.c only:
312 */
313
314 struct TkErrorHandler *errorPtr;
315 /* First in list of error handlers for this
316 * display. NULL means no handlers exist at
317 * present. */
318 int deleteCount; /* Counts # of handlers deleted since last
319 * time inactive handlers were garbage-
320 * collected. When this number gets big,
321 * handlers get cleaned up. */
322
323 /*
324 * Used by tkEvent.c only:
325 */
326
327 struct TkWindowEvent *delayedMotionPtr;
328 /* Points to a malloc-ed motion event whose
329 * processing has been delayed in the hopes
330 * that another motion event will come along
331 * right away and we can merge the two of them
332 * together. NULL means that there is no
333 * delayed motion event. */
334
335 /*
336 * Information used by tkFocus.c only:
337 */
338
339 int focusDebug; /* 1 means collect focus debugging
340 * statistics. */
341 struct TkWindow *implicitWinPtr;
342 /* If the focus arrived at a toplevel window
343 * implicitly via an Enter event (rather than
344 * via a FocusIn event), this points to the
345 * toplevel window. Otherwise it is NULL. */
346 struct TkWindow *focusPtr; /* Points to the window on this display that
347 * should be receiving keyboard events. When
348 * multiple applications on the display have
349 * the focus, this will refer to the innermost
350 * window in the innermost application. This
351 * information isn't used on Windows, but it's
352 * needed on the Mac, and also on X11 when XIM
353 * processing is being done. */
354
355 /*
356 * Information used by tkGC.c only:
357 */
358
359 Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
360 * describing a GC with those values. */
361 Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */
362 int gcInit; /* 0 means the tables below need
363 * initializing. */
364
365 /*
366 * Information used by tkGeometry.c only:
367 */
368
369 Tcl_HashTable maintainHashTable;
370 /* Hash table that maps from a container's
371 * Tk_Window token to a list of windows managed
372 * by that container. */
373 int geomInit;
374
375 /*
376 * Information used by tkGrid.c, tkPack.c, tkPlace.c, tkPointer.c,
377 * and ttkMacOSXTheme.c:
378 */
379
380 #define TkGetContainer(tkwin) (Tk_TopWinHierarchy((TkWindow *)tkwin) ? NULL : \
381 (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
382 ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr))
383
384 /*
385 * Information used by tkGet.c only:
386 */
387
388 Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */
389 int uidInit; /* 0 means uidTable needs initializing. */
390
391 /*
392 * Information used by tkGrab.c only:
393 */
394
395 struct TkWindow *grabWinPtr;/* Window in which the pointer is currently
396 * grabbed, or NULL if none. */
397 struct TkWindow *eventualGrabWinPtr;
398 /* Value that grabWinPtr will have once the
399 * grab event queue (below) has been
400 * completely emptied. */
401 struct TkWindow *buttonWinPtr;
402 /* Window in which first mouse button was
403 * pressed while grab was in effect, or NULL
404 * if no such press in effect. */
405 struct TkWindow *serverWinPtr;
406 /* If no application contains the pointer then
407 * this is NULL. Otherwise it contains the
408 * last window for which we've gotten an Enter
409 * or Leave event from the server (i.e. the
410 * last window known to have contained the
411 * pointer). Doesn't reflect events that were
412 * synthesized in tkGrab.c. */
413 TkGrabEvent *firstGrabEventPtr;
414 /* First in list of enter/leave events
415 * synthesized by grab code. These events must
416 * be processed in order before any other
417 * events are processed. NULL means no such
418 * events. */
419 TkGrabEvent *lastGrabEventPtr;
420 /* Last in list of synthesized events, or NULL
421 * if list is empty. */
422 int grabFlags; /* Miscellaneous flag values. See definitions
423 * in tkGrab.c. */
424
425 /*
426 * Information used by tkGrid.c only:
427 */
428
429 int gridInit; /* 0 means table below needs initializing. */
430 Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to corresponding
431 * Grid structures. */
432
433 /*
434 * Information used by tkImage.c only:
435 */
436
437 int imageId; /* Value used to number image ids. */
438
439 /*
440 * Information used by tkMacWinMenu.c only:
441 */
442
443 int postCommandGeneration;
444
445 /*
446 * Information used by tkPack.c only.
447 */
448
449 int packInit; /* 0 means table below needs initializing. */
450 Tcl_HashTable packerHashTable;
451 /* Maps from Tk_Window tokens to corresponding
452 * Packer structures. */
453
454 /*
455 * Information used by tkPlace.c only.
456 */
457
458 int placeInit; /* 0 means tables below need initializing. */
459 Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
460 * structure for the window, if it exists. */
461 Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
462 * structure for the window, if it exists. */
463
464 /*
465 * Information used by tkSelect.c and tkClipboard.c only:
466 */
467
468 struct TkSelectionInfo *selectionInfoPtr;
469 /* First in list of selection information
470 * records. Each entry contains information
471 * about the current owner of a particular
472 * selection on this display. */
473 Atom multipleAtom; /* Atom for MULTIPLE. None means selection
474 * stuff isn't initialized. */
475 Atom incrAtom; /* Atom for INCR. */
476 Atom targetsAtom; /* Atom for TARGETS. */
477 Atom timestampAtom; /* Atom for TIMESTAMP. */
478 Atom textAtom; /* Atom for TEXT. */
479 Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
480 Atom applicationAtom; /* Atom for TK_APPLICATION. */
481 Atom windowAtom; /* Atom for TK_WINDOW. */
482 Atom clipboardAtom; /* Atom for CLIPBOARD. */
483 Atom utf8Atom; /* Atom for UTF8_STRING. */
484 Atom atomPairAtom; /* Atom for ATOM_PAIR. */
485
486 Tk_Window clipWindow; /* Window used for clipboard ownership and to
487 * retrieve selections between processes. NULL
488 * means clipboard info hasn't been
489 * initialized. */
490 int clipboardActive; /* 1 means we currently own the clipboard
491 * selection, 0 means we don't. */
492 struct TkMainInfo *clipboardAppPtr;
493 /* Last application that owned clipboard. */
494 struct TkClipboardTarget *clipTargetPtr;
495 /* First in list of clipboard type information
496 * records. Each entry contains information
497 * about the buffers for a given selection
498 * target. */
499
500 /*
501 * Information used by tkSend.c only:
502 */
503
504 Tk_Window commTkwin; /* Window used for communication between
505 * interpreters during "send" commands. NULL
506 * means send info hasn't been initialized
507 * yet. */
508 Atom commProperty; /* X's name for comm property. */
509 Atom registryProperty; /* X's name for property containing registry
510 * of interpreter names. */
511 Atom appNameProperty; /* X's name for property used to hold the
512 * application name on each comm window. */
513
514 /*
515 * Information used by tkUnixWm.c and tkWinWm.c only:
516 */
517
518 struct TkWmInfo *firstWmPtr;/* Points to first top-level window. */
519 struct TkWmInfo *foregroundWmPtr;
520 /* Points to the foreground window. */
521
522 /*
523 * Information used by tkVisual.c only:
524 */
525
526 TkColormap *cmapPtr; /* First in list of all non-default colormaps
527 * allocated for this display. */
528
529 /*
530 * Miscellaneous information:
531 */
532
533 #ifdef TK_USE_INPUT_METHODS
534 XIM inputMethod; /* Input method for this display. */
535 XIMStyle inputStyle; /* Input style selected for this display. */
536 XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
537 #endif /* TK_USE_INPUT_METHODS */
538 Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
539
540 int refCount; /* Reference count of how many Tk applications
541 * are using this display. Used to clean up
542 * the display when we no longer have any Tk
543 * applications using it. */
544
545 /*
546 * The following field were all added for Tk8.3
547 */
548
549 int mouseButtonState; /* Current mouse button state for this
550 * display. NOT USED as of 8.6.10 */
551 Window mouseButtonWindow; /* Window the button state was set in, added
552 * in Tk 8.4. */
553 Tk_Window warpWindow;
554 Tk_Window warpMainwin; /* For finding the root window for warping
555 * purposes. */
556 int warpX;
557 int warpY;
558
559 /*
560 * The following field(s) were all added for Tk8.4
561 */
562
563 unsigned int flags; /* Various flag values: these are all defined
564 * in below. */
565 TkCaret caret; /* Information about the caret for this
566 * display. This is not a pointer. */
567
568 int iconDataSize; /* Size of default iconphoto image data. */
569 unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
570 #ifdef TK_USE_INPUT_METHODS
571 int ximGeneration; /* Used to invalidate XIC */
572 #endif /* TK_USE_INPUT_METHODS */
573 } TkDisplay;
574
575 /*
576 * Flag values for TkDisplay flags.
577 * TK_DISPLAY_COLLAPSE_MOTION_EVENTS: (default on)
578 * Indicates that we should collapse motion events on this display
579 * TK_DISPLAY_USE_IM: (default on, set via tk.tcl)
580 * Whether to use input methods for this display
581 * TK_DISPLAY_WM_TRACING: (default off)
582 * Whether we should do wm tracing on this display.
583 * TK_DISPLAY_IN_WARP: (default off)
584 * Indicates that we are in a pointer warp
585 */
586
587 #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0)
588 #define TK_DISPLAY_USE_IM (1 << 1)
589 #define TK_DISPLAY_WM_TRACING (1 << 3)
590 #define TK_DISPLAY_IN_WARP (1 << 4)
591 #define TK_DISPLAY_USE_XKB (1 << 5)
592
593 /*
594 * One of the following structures exists for each error handler created by a
595 * call to Tk_CreateErrorHandler. The structure is managed by tkError.c.
596 */
597
598 typedef struct TkErrorHandler {
599 TkDisplay *dispPtr; /* Display to which handler applies. */
600 unsigned long firstRequest; /* Only errors with serial numbers >= to this
601 * are considered. */
602 unsigned long lastRequest; /* Only errors with serial numbers <= to this
603 * are considered. This field is filled in
604 * when XUnhandle is called. -1 means
605 * XUnhandle hasn't been called yet. */
606 int error; /* Consider only errors with this error_code
607 * (-1 means consider all errors). */
608 int request; /* Consider only errors with this major
609 * request code (-1 means consider all major
610 * codes). */
611 int minorCode; /* Consider only errors with this minor
612 * request code (-1 means consider all minor
613 * codes). */
614 Tk_ErrorProc *errorProc; /* Function to invoke when a matching error
615 * occurs. NULL means just ignore errors. */
616 ClientData clientData; /* Arbitrary value to pass to errorProc. */
617 struct TkErrorHandler *nextPtr;
618 /* Pointer to next older handler for this
619 * display, or NULL for end of list. */
620 } TkErrorHandler;
621
622 /*
623 * One of the following structures exists for each event handler created by
624 * calling Tk_CreateEventHandler. This information is used by tkEvent.c only.
625 */
626
627 typedef struct TkEventHandler {
628 unsigned long mask; /* Events for which to invoke proc. */
629 Tk_EventProc *proc; /* Function to invoke when an event in mask
630 * occurs. */
631 ClientData clientData; /* Argument to pass to proc. */
632 struct TkEventHandler *nextPtr;
633 /* Next in list of handlers associated with
634 * window (NULL means end of list). */
635 } TkEventHandler;
636
637 /*
638 * Tk keeps one of the following data structures for each main window (created
639 * by a call to TkCreateMainWindow). It stores information that is shared by
640 * all of the windows associated with a particular main window.
641 */
642
643 typedef struct TkMainInfo {
644 int refCount; /* Number of windows whose "mainPtr" fields
645 * point here. When this becomes zero, can
646 * free up the structure (the reference count
647 * is zero because windows can get deleted in
648 * almost any order; the main window isn't
649 * necessarily the last one deleted). */
650 struct TkWindow *winPtr; /* Pointer to main window. */
651 Tcl_Interp *interp; /* Interpreter associated with application. */
652 Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow
653 * structs for all windows related to this
654 * main window. Managed by tkWindow.c. */
655 long deletionEpoch; /* Incremented by window deletions. */
656 Tk_BindingTable bindingTable;
657 /* Used in conjunction with "bind" command to
658 * bind events to Tcl commands. */
659 TkBindInfo bindInfo; /* Information used by tkBind.c on a per
660 * application basis. */
661 struct TkFontInfo *fontInfoPtr;
662 /* Information used by tkFont.c on a per
663 * application basis. */
664
665 /*
666 * Information used only by tkFocus.c and tk*Embed.c:
667 */
668
669 struct TkToplevelFocusInfo *tlFocusPtr;
670 /* First in list of records containing focus
671 * information for each top-level in the
672 * application. Used only by tkFocus.c. */
673 struct TkDisplayFocusInfo *displayFocusPtr;
674 /* First in list of records containing focus
675 * information for each display that this
676 * application has ever used. Used only by
677 * tkFocus.c. */
678
679 struct ElArray *optionRootPtr;
680 /* Top level of option hierarchy for this main
681 * window. NULL means uninitialized. Managed
682 * by tkOption.c. */
683 Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel
684 * structures. Managed by tkImage.c. */
685 int strictMotif; /* This is linked to the tk_strictMotif global
686 * variable. */
687 int alwaysShowSelection; /* This is linked to the
688 * ::tk::AlwaysShowSelection variable. */
689 struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
690 * this process. */
691 Tcl_HashTable busyTable; /* Information used by [tk busy] command. */
692 Tcl_ObjCmdProc *tclUpdateObjProc;
693 /* Saved Tcl [update] command, used to restore
694 * Tcl's version of [update] after Tk is shut
695 * down */
696 } TkMainInfo;
697
698 /*
699 * Tk keeps the following data structure for each of it's builtin bitmaps.
700 * This structure is only used by tkBitmap.c and other platform specific
701 * bitmap files.
702 */
703
704 typedef struct {
705 const void *source; /* Bits for bitmap. */
706 int width, height; /* Dimensions of bitmap. */
707 int native; /* 0 means generic (X style) bitmap, 1 means
708 * native style bitmap. */
709 } TkPredefBitmap;
710
711 /*
712 * Tk keeps one of the following structures for each window. Some of the
713 * information (like size and location) is a shadow of information managed by
714 * the X server, and some is special information used here, such as event and
715 * geometry management information. This information is (mostly) managed by
716 * tkWindow.c. WARNING: the declaration below must be kept consistent with the
717 * Tk_FakeWin structure in tk.h. If you change one, be sure to change the
718 * other!
719 */
720
721 typedef struct TkWindow {
722 /*
723 * Structural information:
724 */
725
726 Display *display; /* Display containing window. */
727 TkDisplay *dispPtr; /* Tk's information about display for
728 * window. */
729 int screenNum; /* Index of screen for window, among all those
730 * for dispPtr. */
731 Visual *visual; /* Visual to use for window. If not default,
732 * MUST be set before X window is created. */
733 int depth; /* Number of bits/pixel. */
734 Window window; /* X's id for window. None means window hasn't
735 * actually been created yet, or it's been
736 * deleted. */
737 struct TkWindow *childList; /* First in list of child windows, or NULL if
738 * no children. List is in stacking order,
739 * lowest window first.*/
740 struct TkWindow *lastChildPtr;
741 /* Last in list of child windows (highest in
742 * stacking order), or NULL if no children. */
743 struct TkWindow *parentPtr; /* Pointer to parent window (logical parent,
744 * not necessarily X parent). NULL means
745 * either this is the main window, or the
746 * window's parent has already been deleted. */
747 struct TkWindow *nextPtr; /* Next higher sibling (in stacking order) in
748 * list of children with same parent. NULL
749 * means end of list. */
750 TkMainInfo *mainPtr; /* Information shared by all windows
751 * associated with a particular main window.
752 * NULL means this window is a rogue that is
753 * not associated with any application (at
754 * present, this only happens for the dummy
755 * windows used for "send" communication). */
756
757 /*
758 * Name and type information for the window:
759 */
760
761 char *pathName; /* Path name of window (concatenation of all
762 * names between this window and its top-level
763 * ancestor). This is a pointer into an entry
764 * in mainPtr->nameTable. NULL means that the
765 * window hasn't been completely created
766 * yet. */
767 Tk_Uid nameUid; /* Name of the window within its parent
768 * (unique within the parent). */
769 Tk_Uid classUid; /* Class of the window. NULL means window
770 * hasn't been given a class yet. */
771
772 /*
773 * Geometry and other attributes of window. This information may not be
774 * updated on the server immediately; stuff that hasn't been reflected in
775 * the server yet is called "dirty". At present, information can be dirty
776 * only if the window hasn't yet been created.
777 */
778
779 XWindowChanges changes; /* Geometry and other info about window. */
780 unsigned int dirtyChanges; /* Bits indicate fields of "changes" that are
781 * dirty. */
782 XSetWindowAttributes atts; /* Current attributes of window. */
783 unsigned long dirtyAtts; /* Bits indicate fields of "atts" that are
784 * dirty. */
785
786 unsigned int flags; /* Various flag values: these are all defined
787 * in tk.h (confusing, but they're needed
788 * there for some query macros). */
789
790 /*
791 * Information kept by the event manager (tkEvent.c):
792 */
793
794 TkEventHandler *handlerList;/* First in list of event handlers declared
795 * for this window, or NULL if none. */
796 #ifdef TK_USE_INPUT_METHODS
797 XIC inputContext; /* XIM input context. */
798 #endif /* TK_USE_INPUT_METHODS */
799
800 /*
801 * Information used for event bindings (see "bind" and "bindtags" commands
802 * in tkCmds.c):
803 */
804
805 ClientData *tagPtr; /* Points to array of tags used for bindings
806 * on this window. Each tag is a Tk_Uid.
807 * Malloc'ed. NULL means no tags. */
808 int numTags; /* Number of tags at *tagPtr. */
809
810 /*
811 * Information used by tkOption.c to manage options for the window.
812 */
813
814 int optionLevel; /* -1 means no option information is currently
815 * cached for this window. Otherwise this
816 * gives the level in the option stack at
817 * which info is cached. */
818 /*
819 * Information used by tkSelect.c to manage the selection.
820 */
821
822 struct TkSelHandler *selHandlerList;
823 /* First in list of handlers for returning the
824 * selection in various forms. */
825
826 /*
827 * Information used by tkGeometry.c for geometry management.
828 */
829
830 const Tk_GeomMgr *geomMgrPtr;
831 /* Information about geometry manager for this
832 * window. */
833 ClientData geomData; /* Argument for geometry manager functions. */
834 int reqWidth, reqHeight; /* Arguments from last call to
835 * Tk_GeometryRequest, or 0's if
836 * Tk_GeometryRequest hasn't been called. */
837 int internalBorderLeft; /* Width of internal border of window (0 means
838 * no internal border). Geometry managers
839 * should not normally place children on top
840 * of the border. Fields for the other three
841 * sides are found below. */
842
843 /*
844 * Information maintained by tkWm.c for window manager communication.
845 */
846
847 struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also for special
848 * Unix menubar and wrapper windows), points
849 * to structure with wm-related info (see
850 * tkWm.c). For other windows, this is
851 * NULL. */
852
853 /*
854 * Information used by widget classes.
855 */
856
857 const Tk_ClassProcs *classProcsPtr;
858 ClientData instanceData;
859
860 /*
861 * Platform specific information private to each port.
862 */
863
864 struct TkWindowPrivate *privatePtr;
865
866 /*
867 * More information used by tkGeometry.c for geometry management.
868 */
869
870 /* The remaining fields of internal border. */
871 int internalBorderRight;
872 int internalBorderTop;
873 int internalBorderBottom;
874
875 int minReqWidth; /* Minimum requested width. */
876 int minReqHeight; /* Minimum requested height. */
877 #ifdef TK_USE_INPUT_METHODS
878 int ximGeneration; /* Used to invalidate XIC */
879 #endif /* TK_USE_INPUT_METHODS */
880 char *geomMgrName; /* Records the name of the geometry manager. */
881 struct TkWindow *maintainerPtr;
882 /* The geometry container for this window. The
883 * value is NULL if the window has no container or
884 * if its container is its parent. */
885 } TkWindow;
886
887 /*
888 * String tables:
889 */
890
891 MODULE_SCOPE const char *const tkStateStrings[];
892 MODULE_SCOPE const char *const tkCompoundStrings[];
893
894 /*
895 * Real definition of some events. Note that these events come from outside
896 * but have internally generated pieces added to them.
897 */
898
899 typedef struct {
900 XKeyEvent keyEvent; /* The real event from X11. */
901 #ifdef _WIN32
902 char trans_chars[XMaxTransChars];
903 /* translated characters */
904 unsigned char nbytes;
905 #elif !defined(MAC_OSX_TK)
906 char *charValuePtr; /* A pointer to a string that holds the key's
907 * %A substitution text (before backslash
908 * adding), or NULL if that has not been
909 * computed yet. If non-NULL, this string was
910 * allocated with ckalloc(). */
911 int charValueLen; /* Length of string in charValuePtr when that
912 * is non-NULL. */
913 KeySym keysym; /* Key symbol computed after input methods
914 * have been invoked */
915 #endif
916 } TkKeyEvent;
917
918 /*
919 * Flags passed to TkpMakeMenuWindow's 'transient' argument.
920 */
921
922 #define TK_MAKE_MENU_TEAROFF 0 /* Only non-transient case. */
923 #define TK_MAKE_MENU_POPUP 1
924 #define TK_MAKE_MENU_DROPDOWN 2
925
926 /*
927 * The following structure is used with TkMakeEnsemble to create ensemble
928 * commands and optionally to create sub-ensembles.
929 */
930
931 typedef struct TkEnsemble {
932 const char *name;
933 Tcl_ObjCmdProc *proc;
934 const struct TkEnsemble *subensemble;
935 } TkEnsemble;
936
937 /*
938 * The following structure is used as a two way map between integers and
939 * strings, usually to map between an internal C representation and the
940 * strings used in Tcl.
941 */
942
943 typedef struct TkStateMap {
944 int numKey; /* Integer representation of a value. */
945 const char *strKey; /* String representation of a value. */
946 } TkStateMap;
947
948 /*
949 * This structure is used by the Mac and Window porting layers as the internal
950 * representation of a clip_mask in a GC.
951 */
952
953 typedef struct TkpClipMask {
954 int type; /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */
955 union {
956 Pixmap pixmap;
957 TkRegion region;
958 } value;
959 } TkpClipMask;
960
961 #define TKP_CLIP_PIXMAP 0
962 #define TKP_CLIP_REGION 1
963
964 /*
965 * Return values from TkGrabState:
966 */
967
968 #define TK_GRAB_NONE 0
969 #define TK_GRAB_IN_TREE 1
970 #define TK_GRAB_ANCESTOR 2
971 #define TK_GRAB_EXCLUDED 3
972
973 /*
974 * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags
975 * for this routine, but don't make public until TkpMeasureCharsInContext is
976 * made public, too.
977 */
978
979 #define TK_ISOLATE_END 32
980
981 /*
982 * The macro below is used to modify a "char" value (e.g. by casting it to an
983 * unsigned character) so that it can be used safely with macros such as
984 * isspace().
985 */
986
987 #define UCHAR(c) ((unsigned char) (c))
988
989 /*
990 * The following symbol is used in the mode field of FocusIn events generated
991 * by an embedded application to request the input focus from its container.
992 */
993
994 #define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
995
996 /*
997 * The following special modifier mask bits are defined, to indicate logical
998 * modifiers such as Meta and Alt that may float among the actual modifier
999 * bits.
1000 */
1001
1002 #define META_MASK (AnyModifier<<1)
1003 #define ALT_MASK (AnyModifier<<2)
1004 #define EXTENDED_MASK (AnyModifier<<3)
1005
1006 /*
1007 * Mask that selects any of the state bits corresponding to buttons, plus
1008 * masks that select individual buttons' bits:
1009 */
1010
1011 #define ALL_BUTTONS \
1012 (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
1013
1014
1015 MODULE_SCOPE unsigned TkGetButtonMask(unsigned);
1016
1017 /*
1018 * Object types not declared in tkObj.c need to be mentioned here so they can
1019 * be properly registered with Tcl:
1020 */
1021
1022 MODULE_SCOPE const Tcl_ObjType tkBorderObjType;
1023 MODULE_SCOPE const Tcl_ObjType tkBitmapObjType;
1024 MODULE_SCOPE const Tcl_ObjType tkColorObjType;
1025 MODULE_SCOPE const Tcl_ObjType tkCursorObjType;
1026 MODULE_SCOPE const Tcl_ObjType tkFontObjType;
1027 MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType;
1028 MODULE_SCOPE const Tcl_ObjType tkTextIndexType;
1029
1030 /*
1031 * Miscellaneous variables shared among Tk modules but not exported to the
1032 * outside world:
1033 */
1034
1035 MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod;
1036 MODULE_SCOPE Tk_ImageType tkBitmapImageType;
1037 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF;
1038 MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr);
1039 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG;
1040 MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM;
1041 MODULE_SCOPE TkMainInfo *tkMainWindowList;
1042 MODULE_SCOPE Tk_ImageType tkPhotoImageType;
1043 MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable;
1044
1045 MODULE_SCOPE const char *const tkWebColors[20];
1046
1047 /*
1048 * The definition of pi, at least from the perspective of double-precision
1049 * floats.
1050 */
1051
1052 #ifndef PI
1053 #ifdef M_PI
1054 #define PI M_PI
1055 #else
1056 #define PI 3.14159265358979323846
1057 #endif
1058 #endif
1059
1060 /*
1061 * Support for Clang Static Analyzer <https://clang-analyzer.llvm.org/>
1062 */
1063
1064 #if defined(PURIFY) && defined(__clang__)
1065 #if __has_feature(attribute_analyzer_noreturn) && \
1066 !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED)
1067 void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
1068 #endif
1069 #if !defined(CLANG_ASSERT)
1070 #define CLANG_ASSERT(x) assert(x)
1071 #endif
1072 #elif !defined(CLANG_ASSERT)
1073 #define CLANG_ASSERT(x)
1074 #endif /* PURIFY && __clang__ */
1075
1076 /*
1077 * The following magic value is stored in the "send_event" field of FocusIn
1078 * and FocusOut events. This allows us to separate "real" events coming from
1079 * the server from those that we generated.
1080 */
1081
1082 #define GENERATED_FOCUS_EVENT_MAGIC ((Bool) 0x547321ac)
1083
1084 /*
1085 * Exported internals.
1086 */
1087
1088 #include "tkIntDecls.h"
1089
1090 #ifdef __cplusplus
1091 extern "C" {
1092 #endif
1093
1094 /*
1095 * Themed widget set init function:
1096 */
1097
1098 MODULE_SCOPE int Ttk_Init(Tcl_Interp *interp);
1099
1100 /*
1101 * Internal functions shared among Tk modules but not exported to the outside
1102 * world:
1103 */
1104
1105 MODULE_SCOPE int Tk_BellObjCmd(ClientData clientData,
1106 Tcl_Interp *interp, int objc,
1107 Tcl_Obj *const objv[]);
1108 MODULE_SCOPE int Tk_BindObjCmd(ClientData clientData,
1109 Tcl_Interp *interp, int objc,
1110 Tcl_Obj *const objv[]);
1111 MODULE_SCOPE int Tk_BindtagsObjCmd(ClientData clientData,
1112 Tcl_Interp *interp, int objc,
1113 Tcl_Obj *const objv[]);
1114 MODULE_SCOPE int Tk_BusyObjCmd(ClientData clientData,
1115 Tcl_Interp *interp, int objc,
1116 Tcl_Obj *const objv[]);
1117 MODULE_SCOPE int Tk_ButtonObjCmd(ClientData clientData,
1118 Tcl_Interp *interp, int objc,
1119 Tcl_Obj *const objv[]);
1120 MODULE_SCOPE int Tk_CanvasObjCmd(ClientData clientData,
1121 Tcl_Interp *interp, int argc,
1122 Tcl_Obj *const objv[]);
1123 MODULE_SCOPE int Tk_CheckbuttonObjCmd(ClientData clientData,
1124 Tcl_Interp *interp, int objc,
1125 Tcl_Obj *const objv[]);
1126 MODULE_SCOPE int Tk_ClipboardObjCmd(ClientData clientData,
1127 Tcl_Interp *interp, int objc,
1128 Tcl_Obj *const objv[]);
1129 MODULE_SCOPE int Tk_ChooseColorObjCmd(ClientData clientData,
1130 Tcl_Interp *interp, int objc,
1131 Tcl_Obj *const objv[]);
1132 MODULE_SCOPE int Tk_ChooseDirectoryObjCmd(ClientData clientData,
1133 Tcl_Interp *interp, int objc,
1134 Tcl_Obj *const objv[]);
1135 MODULE_SCOPE int Tk_DestroyObjCmd(ClientData clientData,
1136 Tcl_Interp *interp, int objc,
1137 Tcl_Obj *const objv[]);
1138 MODULE_SCOPE int Tk_EntryObjCmd(ClientData clientData,
1139 Tcl_Interp *interp, int objc,
1140 Tcl_Obj *const objv[]);
1141 MODULE_SCOPE int Tk_EventObjCmd(ClientData clientData,
1142 Tcl_Interp *interp, int objc,
1143 Tcl_Obj *const objv[]);
1144 MODULE_SCOPE int Tk_FrameObjCmd(ClientData clientData,
1145 Tcl_Interp *interp, int objc,
1146 Tcl_Obj *const objv[]);
1147 MODULE_SCOPE int Tk_FocusObjCmd(ClientData clientData,
1148 Tcl_Interp *interp, int objc,
1149 Tcl_Obj *const objv[]);
1150 MODULE_SCOPE int Tk_FontObjCmd(ClientData clientData,
1151 Tcl_Interp *interp, int objc,
1152 Tcl_Obj *const objv[]);
1153 MODULE_SCOPE int Tk_GetOpenFileObjCmd(ClientData clientData,
1154 Tcl_Interp *interp, int objc,
1155 Tcl_Obj *const objv[]);
1156 MODULE_SCOPE int Tk_GetSaveFileObjCmd(ClientData clientData,
1157 Tcl_Interp *interp, int objc,
1158 Tcl_Obj *const objv[]);
1159 MODULE_SCOPE int Tk_GrabObjCmd(ClientData clientData,
1160 Tcl_Interp *interp, int objc,
1161 Tcl_Obj *const objv[]);
1162 MODULE_SCOPE int Tk_GridObjCmd(ClientData clientData,
1163 Tcl_Interp *interp, int objc,
1164 Tcl_Obj *const objv[]);
1165 MODULE_SCOPE int Tk_ImageObjCmd(ClientData clientData,
1166 Tcl_Interp *interp, int objc,
1167 Tcl_Obj *const objv[]);
1168 MODULE_SCOPE int Tk_LabelObjCmd(ClientData clientData,
1169 Tcl_Interp *interp, int objc,
1170 Tcl_Obj *const objv[]);
1171 MODULE_SCOPE int Tk_LabelframeObjCmd(ClientData clientData,
1172 Tcl_Interp *interp, int objc,
1173 Tcl_Obj *const objv[]);
1174 MODULE_SCOPE int Tk_ListboxObjCmd(ClientData clientData,
1175 Tcl_Interp *interp, int objc,
1176 Tcl_Obj *const objv[]);
1177 MODULE_SCOPE int Tk_LowerObjCmd(ClientData clientData,
1178 Tcl_Interp *interp, int objc,
1179 Tcl_Obj *const objv[]);
1180 MODULE_SCOPE int Tk_MenuObjCmd(ClientData clientData,
1181 Tcl_Interp *interp, int objc,
1182 Tcl_Obj *const objv[]);
1183 MODULE_SCOPE int Tk_MenubuttonObjCmd(ClientData clientData,
1184 Tcl_Interp *interp, int objc,
1185 Tcl_Obj *const objv[]);
1186 MODULE_SCOPE int Tk_MessageBoxObjCmd(ClientData clientData,
1187 Tcl_Interp *interp, int objc,
1188 Tcl_Obj *const objv[]);
1189 MODULE_SCOPE int Tk_MessageObjCmd(ClientData clientData,
1190 Tcl_Interp *interp, int objc,
1191 Tcl_Obj *const objv[]);
1192 MODULE_SCOPE int Tk_PanedWindowObjCmd(ClientData clientData,
1193 Tcl_Interp *interp, int objc,
1194 Tcl_Obj *const objv[]);
1195 MODULE_SCOPE int Tk_OptionObjCmd(ClientData clientData,
1196 Tcl_Interp *interp, int objc,
1197 Tcl_Obj *const objv[]);
1198 MODULE_SCOPE int Tk_PackObjCmd(ClientData clientData,
1199 Tcl_Interp *interp, int objc,
1200 Tcl_Obj *const objv[]);
1201 MODULE_SCOPE int Tk_PlaceObjCmd(ClientData clientData,
1202 Tcl_Interp *interp, int objc,
1203 Tcl_Obj *const objv[]);
1204 MODULE_SCOPE int Tk_RadiobuttonObjCmd(ClientData clientData,
1205 Tcl_Interp *interp, int objc,
1206 Tcl_Obj *const objv[]);
1207 MODULE_SCOPE int Tk_RaiseObjCmd(ClientData clientData,
1208 Tcl_Interp *interp, int objc,
1209 Tcl_Obj *const objv[]);
1210 MODULE_SCOPE int Tk_ScaleObjCmd(ClientData clientData,
1211 Tcl_Interp *interp, int objc,
1212 Tcl_Obj *const objv[]);
1213 MODULE_SCOPE int Tk_ScrollbarObjCmd(ClientData clientData,
1214 Tcl_Interp *interp, int objc,
1215 Tcl_Obj *const objv[]);
1216 MODULE_SCOPE int Tk_SelectionObjCmd(ClientData clientData,
1217 Tcl_Interp *interp, int objc,
1218 Tcl_Obj *const objv[]);
1219 MODULE_SCOPE int Tk_SendObjCmd(ClientData clientData,
1220 Tcl_Interp *interp,int objc,
1221 Tcl_Obj *const objv[]);
1222 MODULE_SCOPE int Tk_SpinboxObjCmd(ClientData clientData,
1223 Tcl_Interp *interp, int objc,
1224 Tcl_Obj *const objv[]);
1225 MODULE_SCOPE int Tk_TextObjCmd(ClientData clientData,
1226 Tcl_Interp *interp, int objc,
1227 Tcl_Obj *const objv[]);
1228 MODULE_SCOPE int Tk_TkwaitObjCmd(ClientData clientData,
1229 Tcl_Interp *interp, int objc,
1230 Tcl_Obj *const objv[]);
1231 MODULE_SCOPE int Tk_ToplevelObjCmd(ClientData clientData,
1232 Tcl_Interp *interp, int objc,
1233 Tcl_Obj *const objv[]);
1234 MODULE_SCOPE int Tk_UpdateObjCmd(ClientData clientData,
1235 Tcl_Interp *interp, int objc,
1236 Tcl_Obj *const objv[]);
1237 MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData,
1238 Tcl_Interp *interp, int objc,
1239 Tcl_Obj *const objv[]);
1240 MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
1241 int objc, Tcl_Obj *const objv[]);
1242
1243 MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
1244 Tk_Window tkwin, Tcl_Obj *objPtr,
1245 double *doublePtr);
1246 #define TkSetGeometryContainer TkSetGeometryMaster
1247 MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp,
1248 Tk_Window tkwin, const char *name);
1249 #define TkFreeGeometryContainer TkFreeGeometryMaster
1250 MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin,
1251 const char *name);
1252
1253 MODULE_SCOPE void TkEventInit(void);
1254 MODULE_SCOPE void TkRegisterObjTypes(void);
1255 MODULE_SCOPE int TkDeadAppObjCmd(ClientData clientData,
1256 Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
1257 MODULE_SCOPE int TkCanvasGetCoordObj(Tcl_Interp *interp,
1258 Tk_Canvas canvas, Tcl_Obj *obj,
1259 double *doublePtr);
1260 MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
1261 const char *string, double *doublePtr);
1262 MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
1263 Tk_PostscriptInfo psInfo, XImage *ximage,
1264 int x, int y, int width, int height);
1265 MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin);
1266 MODULE_SCOPE XEvent * TkpGetBindingXEvent(Tcl_Interp *interp);
1267 MODULE_SCOPE void TkCreateExitHandler(Tcl_ExitProc *proc,
1268 void *clientData);
1269 MODULE_SCOPE void TkDeleteExitHandler(Tcl_ExitProc *proc,
1270 ClientData clientData);
1271 MODULE_SCOPE Tcl_ExitProc TkFinalize;
1272 MODULE_SCOPE Tcl_ExitProc TkFinalizeThread;
1273 MODULE_SCOPE void TkpBuildRegionFromAlphaData(TkRegion region,
1274 unsigned x, unsigned y, unsigned width,
1275 unsigned height, unsigned char *dataPtr,
1276 unsigned pixelStride, unsigned lineStride);
1277 MODULE_SCOPE void TkAppendPadAmount(Tcl_Obj *bufferObj,
1278 const char *buffer, int pad1, int pad2);
1279 MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp,
1280 Tk_Window tkwin, Tcl_Obj *objPtr,
1281 int *pad1Ptr, int *pad2Ptr);
1282 MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr);
1283 MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr);
1284 MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin);
1285 MODULE_SCOPE void TkpDrawCharsInContext(Display * display,
1286 Drawable drawable, GC gc, Tk_Font tkfont,
1287 const char *source, int numBytes, int rangeStart,
1288 int rangeLength, int x, int y);
1289 MODULE_SCOPE void TkpDrawAngledCharsInContext(Display * display,
1290 Drawable drawable, GC gc, Tk_Font tkfont,
1291 const char *source, int numBytes, int rangeStart,
1292 int rangeLength, double x, double y, double angle);
1293 MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont,
1294 const char *source, int numBytes, int rangeStart,
1295 int rangeLength, int maxLength, int flags,
1296 int *lengthPtr);
1297 MODULE_SCOPE void TkUnderlineCharsInContext(Display *display,
1298 Drawable drawable, GC gc, Tk_Font tkfont,
1299 const char *string, int numBytes, int x, int y,
1300 int firstByte, int lastByte);
1301 MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
1302 int c, struct TkFontAttributes *faPtr);
1303 MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin);
1304 MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy);
1305 MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy);
1306 MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin,
1307 Window parent);
1308 MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
1309 Window *parentPtr, Tk_Window tkParent,
1310 TkBusy busy);
1311 MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp,
1312 int objc, Tcl_Obj *const *objv, int flags);
1313 MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin,
1314 const char *eventName, Tcl_Obj *detail);
1315 MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
1316 const char *nsname, const char *name,
1317 ClientData clientData, const TkEnsemble *map);
1318 MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp,
1319 ClientData clientData);
1320 MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp,
1321 ClientData clientData);
1322 MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr);
1323 MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr);
1324 MODULE_SCOPE int TkListCreateFrame(ClientData clientData,
1325 Tcl_Interp *interp, Tcl_Obj *listObj,
1326 int toplevel, Tcl_Obj *nameObj);
1327
1328 #ifdef _WIN32
1329 #define TkParseColor XParseColor
1330 #else
1331 MODULE_SCOPE Status TkParseColor (Display * display,
1332 Colormap map, const char* spec,
1333 XColor * colorPtr);
1334 #endif
1335 #ifdef HAVE_XFT
1336 MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
1337 #endif
1338
1339 #if !defined(__cplusplus) && !defined(c_plusplus)
1340 # define c_class class
1341 #endif
1342
1343 /* Tcl 8.6 has a different definition of Tcl_UniChar than other Tcl versions for TCL_UTF_MAX > 3 */
1344 #if TCL_UTF_MAX > (3 + (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 6))
1345 # define TkUtfToUniChar Tcl_UtfToUniChar
1346 # define TkUniCharToUtf Tcl_UniCharToUtf
1347 # define TkUtfPrev Tcl_UtfPrev
1348 # define TkUtfAtIndex Tcl_UtfAtIndex
1349 #else
1350 MODULE_SCOPE int TkUtfToUniChar(const char *, int *);
1351 MODULE_SCOPE int TkUniCharToUtf(int, char *);
1352 MODULE_SCOPE const char *TkUtfPrev(const char *, const char *);
1353 MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index);
1354 #endif
1355
1356 /*
1357 * Unsupported commands.
1358 */
1359
1360 MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData,
1361 Tcl_Interp *interp, int objc,
1362 Tcl_Obj *const objv[]);
1363
1364 /*
1365 * For Tktest.
1366 */
1367 MODULE_SCOPE int SquareObjCmd(ClientData clientData,
1368 Tcl_Interp *interp, int objc,
1369 Tcl_Obj * const objv[]);
1370 MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
1371 #if !(defined(_WIN32) || defined(MAC_OSX_TK))
1372 #define TkplatformtestInit(x) TCL_OK
1373 #else
1374 MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
1375 #endif
1376
1377 #ifdef __cplusplus
1378 }
1379 #endif
1380
1381 #endif /* _TKINT */
1382
1383 /*
1384 * Local Variables:
1385 * mode: c
1386 * c-basic-offset: 4
1387 * fill-column: 78
1388 * End:
1389 */