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