tkInt.h 46 KB

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