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