diff options
Diffstat (limited to 'generic')
87 files changed, 2739 insertions, 4938 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index 3c94054..d1b5ffb 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -146,7 +146,7 @@ declare 28 { declare 29 { int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - Tcl_Size argc, const char **argv, void *widgRec, + Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags) } declare 30 { @@ -326,9 +326,6 @@ declare 75 { declare 76 { void Tk_FreeTextLayout(Tk_TextLayout textLayout) } -declare 77 {deprecated {function does nothing, call can be removed}} { - void Tk_FreeXId(Display *display, XID xid) -} declare 78 { GC Tk_GCForColor(XColor *colorPtr, Drawable drawable) } @@ -475,9 +472,6 @@ declare 117 { void Tk_ImageChanged(Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight) } -declare 118 { - int Tk_Init(Tcl_Interp *interp) -} declare 119 { Atom Tk_InternAtom(Tk_Window tkwin, const char *name) } @@ -564,32 +558,15 @@ declare 143 { Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags) } -declare 144 {deprecated {function signature changed}} { - void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height) -} -declare 145 {deprecated {function signature changed}} { - void Tk_PhotoPutZoomedBlock_NoComposite(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int zoomX, int zoomY, - int subsampleX, int subsampleY) -} declare 146 { int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr) } declare 147 { void Tk_PhotoBlank(Tk_PhotoHandle handle) } -declare 148 {deprecated {function signature changed}} { - void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, int width, int height ) -} declare 149 { void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr) } -declare 150 {deprecated {function signature changed}} { - void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, int width, int height) -} declare 151 { int Tk_PointToChar(Tk_TextLayout layout, int x, int y) } @@ -617,9 +594,6 @@ declare 158 { Tk_RestrictProc *Tk_RestrictEvents(Tk_RestrictProc *proc, void *arg, void **prevArgPtr) } -declare 159 { - int Tk_SafeInit(Tcl_Interp *interp) -} declare 160 { const char *Tk_SetAppName(Tk_Window tkwin, const char *name) } @@ -805,10 +779,6 @@ declare 211 { int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin) } -declare 212 {nostub {Don't use this function in a stub-enabled extension}} { - TCL_NORETURN1 void Tk_MainEx(Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, - Tcl_Interp *interp) -} declare 213 { void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr) } @@ -821,9 +791,6 @@ declare 214 { declare 215 { void Tk_InitConsoleChannels(Tcl_Interp *interp) } -declare 216 { - int Tk_CreateConsoleWindow(Tcl_Interp *interp) -} declare 217 { void Tk_CreateSmoothMethod(Tcl_Interp *interp, const Tk_SmoothMethod *method) } @@ -943,17 +910,6 @@ declare 244 { declare 245 { void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) } -declare 246 {deprecated {function signature changed}} { - void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int compRule) -} -declare 247 {deprecated {function signature changed}} { - void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int zoomX, int zoomY, - int subsampleX, int subsampleY, int compRule) -} declare 248 { int Tk_CollapseMotionEvents(Display *display, int collapse) } @@ -989,12 +945,6 @@ declare 256 { declare 257 { Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr) } -declare 258 { - Tk_Style Tk_GetStyleFromObj(Tcl_Obj *objPtr) -} -declare 259 { - void Tk_FreeStyleFromObj(Tcl_Obj *objPtr) -} declare 260 { Tk_StyledElement Tk_GetStyledElement(Tk_Style style, Tcl_Size elementId, Tk_OptionTable optionTable) @@ -1052,23 +1002,6 @@ declare 271 { Tcl_Interp *Tk_Interp(Tk_Window tkwin) } -# Now that the Tk 8.2 -> 8.3 transition is long past, use more conventional -# means to continue support for extensions using the USE_OLD_IMAGE to -# continue use of their string-based Tcl_ImageTypes and Tcl_PhotoImageFormats. -# -# Note that this restores the usual rules for stub compatibility. Stub-enabled -# extensions compiled against 8.5 headers and linked to the 8.5 stub library -# will produce a file [load]able into an interp with Tk 8.X, for X >= 5. -# It will *not* be [load]able into interps with Tk 8.4 (or Tk 8.2!). -# Developers who need to produce a file [load]able into legacy interps must -# build against legacy sources. -declare 272 { - void Tk_CreateOldImageType(const Tk_ImageType *typePtr) -} -declare 273 { - void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr) -} - # TIP#580 declare 274 { int Tk_AlwaysShowSelection(Tk_Window tkwin) @@ -1155,27 +1088,12 @@ declare 2 win { declare 3 win { Tk_Window Tk_HWNDToWindow(HWND hwnd) } -declare 4 win { - void Tk_PointerEvent(HWND hwnd, int x, int y) -} -declare 5 win { - int Tk_TranslateWinEvent(HWND hwnd, - UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result) -} ################################ # Aqua specific functions -# Stub removed because the function no longer exists. -#declare 3 aqua { -# void TkMacOSXInitMenus(Tcl_Interp *interp) -#} declare 4 aqua { void TkMacOSXInitAppleEvents(Tcl_Interp *interp) } -declare 5 aqua { - void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width, - int height, int flags) -} declare 6 aqua { void TkMacOSXInvalClipRgns(Tk_Window tkwin) } @@ -1216,11 +1134,11 @@ export { int exact) } export { - TCL_NORETURN1 void Tk_MainEx(Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, + void Tk_MainEx(Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp) } export { - TCL_NORETURN1 void Tk_MainExW(Tcl_Size argc, wchar_t **argv, + void Tk_MainExW(Tcl_Size argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); } diff --git a/generic/tk.h b/generic/tk.h index 8401d14..016ea26 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -17,8 +17,8 @@ #define _TK #include <tcl.h> -#if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) -# error Tk 8.7 must be compiled with tcl.h from Tcl 8.6 or better +#if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) +# error Tk 9.0 must be compiled with tcl.h from Tcl 8.7 or better #endif #ifndef EXTERN @@ -66,17 +66,16 @@ extern "C" { */ #ifndef TK_MAJOR_VERSION -# define TK_MAJOR_VERSION 8 +# define TK_MAJOR_VERSION 9 #endif -#if TK_MAJOR_VERSION != 8 -# error "This header-file is for Tk 8 only" -#endif -#define TK_MINOR_VERSION 7 -#define TK_RELEASE_LEVEL TCL_BETA_RELEASE -#define TK_RELEASE_SERIAL 1 - -#define TK_VERSION "8.7" -#define TK_PATCH_LEVEL "8.7b1" +#if TK_MAJOR_VERSION == 9 +# define TK_MINOR_VERSION 0 +# define TK_RELEASE_LEVEL TCL_BETA_RELEASE +# define TK_RELEASE_SERIAL 3 + +# define TK_VERSION "9.0" +# define TK_PATCH_LEVEL "9.0b3" +#endif /* TK_MAJOR_VERSION */ /* * A special definition used to allow this header file to be included from @@ -146,15 +145,6 @@ typedef struct Tk_StyledElement_ *Tk_StyledElement; */ typedef const char *Tk_Uid; - -#if (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) -# ifndef Tcl_Size -# define Tcl_Size int -# endif -# define TCL_SIZE_MAX INT_MAX -# define TCL_SIZE_MODIFIER "" -# define TCL_ENCODING_PROFILE_TCL8 0x01000000 -#endif /* *---------------------------------------------------------------------- @@ -282,15 +272,6 @@ typedef struct Tk_ObjCustomOption { } Tk_ObjCustomOption; /* - * Macro to use to fill in "offset" fields of the Tk_OptionSpec structure. - * Computes number of bytes from beginning of structure to a given field. - */ - -#if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9) && !defined(BUILD_tk) -# define Tk_Offset(type, field) ((int) offsetof(type, field)) -#endif - -/* * The following two structures are used for error handling. When config * options are being modified, the old values are saved in a Tk_SavedOptions * structure. If an error occurs, then the contents of the structure can be @@ -305,8 +286,8 @@ typedef struct Tk_SavedOption { Tcl_Obj *valuePtr; /* The old value of the option, in the form of * a Tcl object; may be NULL if the value was * not saved as an object. */ -#if TCL_MAJOR_VERSION < 9 - double internalForm; /* The old value of the option, in some +#if TCL_MAJOR_VERSION > 8 + long double internalForm; /* The old value of the option, in some * internal representation such as an int or * (XColor *). Valid only if the field * optionPtr->specPtr->objOffset is -1. The @@ -317,7 +298,7 @@ typedef struct Tk_SavedOption { * guarantees that the field is properly aligned * for storing large values. */ #else - long double internalForm; + double internalForm; #endif } Tk_SavedOption; @@ -435,9 +416,6 @@ typedef enum { #define TK_CONFIG_COLOR_ONLY (1 << 1) #define TK_CONFIG_MONO_ONLY (1 << 2) #define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) -#ifndef TK_NO_DEPRECATED -# define TK_CONFIG_OPTION_SPECIFIED (1 << 4) -#endif /* !TK_NO_DEPRECATED */ #if TCL_MAJOR_VERSION > 8 # define TK_CONFIG_NULL_OK TCL_NULL_OK #else @@ -779,10 +757,6 @@ typedef XActivateDeactivateEvent XDeactivateEvent; (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE) #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) -#ifndef TK_NO_DEPRECATED -#define Tk_InternalBorderWidth(tkwin) \ - (((Tk_FakeWin *) (tkwin))->internalBorderLeft) -#endif /* !TK_NO_DEPRECATED */ #define Tk_InternalBorderLeft(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderLeft) #define Tk_InternalBorderRight(tkwin) \ @@ -1035,18 +1009,6 @@ typedef struct Tk_Item { * lines, circles, etc.) that can form part of a canvas widget. */ -#if defined(USE_OLD_CANVAS) && TCL_MAJOR_VERSION < 9 -typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, Tcl_Size argc, char **argv); -typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, Tcl_Size argc, char **argv, int flags); -typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, Tcl_Size argc, char **argv); -typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, - int beforeThis, char *string); -typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, char *indexString, int *indexPtr); -#else typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas, @@ -1058,7 +1020,6 @@ typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size beforeThis, Tcl_Obj *string); typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *indexString, Tcl_Size *indexPtr); -#endif /* USE_OLD_CANVAS */ typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); typedef void (Tk_ItemDisplayProc)(Tk_Canvas canvas, Tk_Item *itemPtr, @@ -1107,9 +1068,7 @@ typedef struct Tk_ItemType { * type. */ Tk_ItemDisplayProc *displayProc; /* Procedure to display items of this type. */ - int alwaysRedraw; /* Non-zero means displayProc should be called - * even when the item has been moved - * off-screen. */ + int flags; /* Combination of TK_ALWAYS_REDRAW/TK_MOVABLE_POINTS */ Tk_ItemPointProc *pointProc;/* Computes distance from item to a given * point. */ Tk_ItemAreaProc *areaProc; /* Computes whether item is inside, outside, @@ -1146,8 +1105,7 @@ typedef struct Tk_ItemType { } Tk_ItemType; /* - * Flag (used in the alwaysRedraw field) to say whether an item supports - * point-level manipulation like the line and polygon items. + * Possible flags for 'flags' field. */ #define TK_ALWAYS_REDRAW 1 /* item should be redrawn always*/ @@ -1262,15 +1220,9 @@ typedef struct Tk_Outline { */ typedef struct Tk_ImageType Tk_ImageType; -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && defined(USE_OLD_IMAGE) -typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, Tcl_Size argc, - char **argv, Tk_ImageType *typePtr, Tk_ImageModel model, - void **clientDataPtr); -#else typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); -#endif /* USE_OLD_IMAGE */ typedef void *(Tk_ImageGetProc) (Tk_Window tkwin, void *clientData); typedef void (Tk_ImageDisplayProc) (void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, @@ -1365,22 +1317,6 @@ typedef struct Tk_PhotoImageBlock { */ typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat; -#ifdef USE_OLD_IMAGE -typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, char *fileName, - char *formatString, int *widthPtr, int *heightPtr); -typedef int (Tk_ImageStringMatchProc) (char *string, char *formatString, - int *widthPtr, int *heightPtr); -typedef int (Tk_ImageFileReadProc) (Tcl_Interp *interp, Tcl_Channel chan, - char *fileName, char *formatString, Tk_PhotoHandle imageHandle, - int destX, int destY, int width, int height, int srcX, int srcY); -typedef int (Tk_ImageStringReadProc) (Tcl_Interp *interp, char *string, - char *formatString, Tk_PhotoHandle imageHandle, int destX, int destY, - int width, int height, int srcX, int srcY); -typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, char *fileName, - char *formatString, Tk_PhotoImageBlock *blockPtr); -typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, - Tcl_DString *dataPtr, char *formatString, Tk_PhotoImageBlock *blockPtr); -#else typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); typedef int (Tk_ImageStringMatchProc) (Tcl_Obj *dataObj, Tcl_Obj *format, @@ -1395,7 +1331,6 @@ typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); -#endif /* USE_OLD_IMAGE */ /* * The following alternate definitions are used with the Tk8.7 file format @@ -1569,46 +1504,6 @@ typedef struct Tk_ElementSpec { *---------------------------------------------------------------------- */ -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -#define TK_READABLE TCL_READABLE -#define TK_WRITABLE TCL_WRITABLE -#define TK_EXCEPTION TCL_EXCEPTION - -#define TK_DONT_WAIT TCL_DONT_WAIT -#define TK_X_EVENTS TCL_WINDOW_EVENTS -#define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS -#define TK_FILE_EVENTS TCL_FILE_EVENTS -#define TK_TIMER_EVENTS TCL_TIMER_EVENTS -#define TK_IDLE_EVENTS TCL_IDLE_EVENTS -#define TK_ALL_EVENTS TCL_ALL_EVENTS - -#define Tk_IdleProc Tcl_IdleProc -#define Tk_FileProc Tcl_FileProc -#define Tk_TimerProc Tcl_TimerProc -#define Tk_TimerToken Tcl_TimerToken - -#define Tk_BackgroundError Tcl_BackgroundError -#define Tk_CancelIdleCall Tcl_CancelIdleCall -#define Tk_CreateFileHandler Tcl_CreateFileHandler -#define Tk_CreateTimerHandler Tcl_CreateTimerHandler -#define Tk_DeleteFileHandler Tcl_DeleteFileHandler -#define Tk_DeleteTimerHandler Tcl_DeleteTimerHandler -#define Tk_DoOneEvent Tcl_DoOneEvent -#define Tk_DoWhenIdle Tcl_DoWhenIdle -#define Tk_Sleep Tcl_Sleep - -/* Additional stuff that has moved to Tcl: */ - -#define Tk_EventuallyFree Tcl_EventuallyFree -#define Tk_FreeProc Tcl_FreeProc -#define Tk_Preserve Tcl_Preserve -#define Tk_Release Tcl_Release - -/* Related to USE_OLD_IMAGE: */ - -#define Tk_InitImageArgs(interp, argc, argv) /**/ -#endif - /* Removed Tk_Main, use macro instead */ #if defined(_WIN32) || defined(__CYGWIN__) #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ @@ -1657,58 +1552,6 @@ typedef Tcl_Size (Tk_SelectionProc) (void *clientData, Tcl_Size offset, #include "tkDecls.h" -#ifdef USE_OLD_IMAGE -#undef Tk_CreateImageType -#define Tk_CreateImageType Tk_CreateOldImageType -#undef Tk_CreatePhotoImageFormat -#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat -#endif /* USE_OLD_IMAGE */ - -/* - *---------------------------------------------------------------------- - * - * Allow users to say that they don't want to alter their source to add extra - * arguments to Tk_PhotoPutBlock() et al. - * - * This goes after the inclusion of the stubbed-decls so that the declarations - * of what is actually there can be correct. - */ - -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK -# ifdef Tk_PhotoPutBlock -# undef Tk_PhotoPutBlock -# endif -# define Tk_PhotoPutBlock Tk_PhotoPutBlock_NoComposite -# ifdef Tk_PhotoPutZoomedBlock -# undef Tk_PhotoPutZoomedBlock -# endif -# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_NoComposite -# define USE_PANIC_ON_PHOTO_ALLOC_FAILURE -#else /* !USE_COMPOSITELESS_PHOTO_PUT_BLOCK */ -# ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE -# ifdef Tk_PhotoPutBlock -# undef Tk_PhotoPutBlock -# endif -# define Tk_PhotoPutBlock Tk_PhotoPutBlock_Panic -# ifdef Tk_PhotoPutZoomedBlock -# undef Tk_PhotoPutZoomedBlock -# endif -# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_Panic -# endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ -#endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK */ -#ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE -# ifdef Tk_PhotoExpand -# undef Tk_PhotoExpand -# endif -# define Tk_PhotoExpand Tk_PhotoExpand_Panic -# ifdef Tk_PhotoSetSize -# undef Tk_PhotoSetSize -# endif -# define Tk_PhotoSetSize Tk_PhotoSetSize_Panic -#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ -#endif /* !TK_NO_DEPRECATED */ - #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT diff --git a/generic/tkBind.c b/generic/tkBind.c index cc97fde..555437b 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3938,7 +3938,7 @@ HandleEventGenerate( mainPtr = (TkWindow *) mainWin; if (!tkwin || mainPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window id \"%s\" doesn't exist in this application", + "window id \"%s\" does not exist in this application", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "WINDOW", Tcl_GetString(objv[0]), (char *)NULL); return TCL_ERROR; @@ -5287,7 +5287,7 @@ TkStringToKeysym( #endif /* REDO_KEYSYM_LOOKUP */ int keysym; - size_t len = TkUtfToUniChar(name, &keysym); + size_t len = Tcl_UtfToUniChar(name, &keysym); if (name[len] == '\0') { if (!Tcl_UniCharIsPrint(keysym)) { /* This form not supported */ @@ -5371,7 +5371,7 @@ TkKeysymToString( && ((unsigned)(keysym - 0x100007F) > 0x20)) { char buf[10]; if (Tcl_UniCharIsPrint(keysym-0x1000000)) { - buf[TkUniCharToUtf(keysym - 0x1000000, buf)] = '\0'; + buf[Tcl_UniCharToUtf(keysym - 0x1000000, buf)] = '\0'; } else if (keysym >= 0x1010000) { snprintf(buf, sizeof(buf), "U%08X", (int)(keysym - 0x1000000)); } else { diff --git a/generic/tkButton.c b/generic/tkButton.c index 6576dfe..5520bc7 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -79,7 +79,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = { DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthObj), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, TCL_INDEX_NONE, offsetof(TkButton, compound), @@ -98,7 +98,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_LABEL_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, @@ -108,7 +108,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = { 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefLabelHighlightWidth, - offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidthObj), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, @@ -116,10 +116,10 @@ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefLabelPadx, offsetof(TkButton, padXPtr), + tkDefLabelPadx, offsetof(TkButton, padXObj), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefLabelPady, offsetof(TkButton, padYPtr), + tkDefLabelPady, offsetof(TkButton, padYObj), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, @@ -137,9 +137,9 @@ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthObj), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -164,7 +164,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthObj), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, @@ -189,7 +189,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_BUTTON_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, @@ -199,7 +199,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, - offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidthObj), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, @@ -210,10 +210,10 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefButtonPadx, offsetof(TkButton, padXPtr), + tkDefButtonPadx, offsetof(TkButton, padXObj), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefButtonPady, offsetof(TkButton, padYPtr), + tkDefButtonPady, offsetof(TkButton, padYObj), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), @@ -238,9 +238,9 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkButton, underline), 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthObj), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; @@ -265,7 +265,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthObj), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, @@ -287,7 +287,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_CHKRAD_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, @@ -297,7 +297,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, - offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidthObj), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, @@ -316,10 +316,10 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefLabelPadx, offsetof(TkButton, padXPtr), + tkDefLabelPadx, offsetof(TkButton, padXObj), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefLabelPady, offsetof(TkButton, padYPtr), + tkDefLabelPady, offsetof(TkButton, padYObj), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, @@ -351,9 +351,9 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthObj), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; @@ -378,7 +378,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { DEF_BUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthObj), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), TCL_INDEX_NONE, @@ -400,7 +400,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_CHKRAD_FG, TCL_INDEX_NONE, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, highlightBorder), 0, @@ -410,7 +410,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, - offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidthObj), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, @@ -426,10 +426,10 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { DEF_BUTTON_OVER_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefLabelPadx, offsetof(TkButton, padXPtr), + tkDefLabelPadx, offsetof(TkButton, padXObj), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefLabelPady, offsetof(TkButton, padYPtr), + tkDefLabelPady, offsetof(TkButton, padYObj), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, @@ -463,9 +463,9 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { DEF_RADIOBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthObj), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; @@ -687,10 +687,10 @@ ButtonCreate( butPtr->state = STATE_NORMAL; butPtr->normalBorder = NULL; butPtr->activeBorder = NULL; - butPtr->borderWidthPtr = NULL; + butPtr->borderWidthObj = NULL; butPtr->borderWidth = 0; butPtr->relief = TK_RELIEF_FLAT; - butPtr->highlightWidthPtr = NULL; + butPtr->highlightWidthObj = NULL; butPtr->highlightWidth = 0; butPtr->highlightBorder = NULL; butPtr->highlightColorPtr = NULL; @@ -705,15 +705,15 @@ ButtonCreate( butPtr->stippleGC = NULL; butPtr->gray = None; butPtr->copyGC = NULL; - butPtr->widthPtr = NULL; + butPtr->widthObj = NULL; butPtr->width = 0; - butPtr->heightPtr = NULL; + butPtr->heightObj = NULL; butPtr->height = 0; - butPtr->wrapLengthPtr = NULL; + butPtr->wrapLengthObj = NULL; butPtr->wrapLength = 0; - butPtr->padXPtr = NULL; + butPtr->padXObj = NULL; butPtr->padX = 0; - butPtr->padYPtr = NULL; + butPtr->padYObj = NULL; butPtr->padY = 0; butPtr->anchor = TK_ANCHOR_CENTER; butPtr->justify = TK_JUSTIFY_CENTER; @@ -1099,33 +1099,33 @@ ConfigureButton( } if (butPtr->wrapLength < 0) { butPtr->wrapLength = 0; - Tcl_DecrRefCount(butPtr->wrapLengthPtr); - butPtr->wrapLengthPtr = Tcl_NewIntObj(0); - Tcl_IncrRefCount(butPtr->wrapLengthPtr); + Tcl_DecrRefCount(butPtr->wrapLengthObj); + butPtr->wrapLengthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(butPtr->wrapLengthObj); } if (butPtr->borderWidth < 0) { butPtr->borderWidth = 0; - Tcl_DecrRefCount(butPtr->borderWidthPtr); - butPtr->borderWidthPtr = Tcl_NewIntObj(0); - Tcl_IncrRefCount(butPtr->borderWidthPtr); + Tcl_DecrRefCount(butPtr->borderWidthObj); + butPtr->borderWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(butPtr->borderWidthObj); } if (butPtr->highlightWidth < 0) { butPtr->highlightWidth = 0; - Tcl_DecrRefCount(butPtr->highlightWidthPtr); - butPtr->highlightWidthPtr = Tcl_NewIntObj(0); - Tcl_IncrRefCount(butPtr->highlightWidthPtr); + Tcl_DecrRefCount(butPtr->highlightWidthObj); + butPtr->highlightWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(butPtr->highlightWidthObj); } if (butPtr->padX < 0) { butPtr->padX = 0; - Tcl_DecrRefCount(butPtr->padXPtr); - butPtr->padXPtr = Tcl_NewIntObj(0); - Tcl_IncrRefCount(butPtr->padXPtr); + Tcl_DecrRefCount(butPtr->padXObj); + butPtr->padXObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(butPtr->padXObj); } if (butPtr->padY < 0) { butPtr->padY = 0; - Tcl_DecrRefCount(butPtr->padYPtr); - butPtr->padYPtr = Tcl_NewIntObj(0); - Tcl_IncrRefCount(butPtr->padYPtr); + Tcl_DecrRefCount(butPtr->padYObj); + butPtr->padYObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(butPtr->padYObj); } if (butPtr->type >= TYPE_CHECK_BUTTON) { @@ -1273,13 +1273,13 @@ ConfigureButton( * The button must display the contents of an image or bitmap. */ - if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->widthPtr, + if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->widthObj, &butPtr->width) != TCL_OK) { widthError: Tcl_AddErrorInfo(interp, "\n (processing \"-width\" option)"); continue; } - if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->heightPtr, + if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->heightObj, &butPtr->height) != TCL_OK) { heightError: Tcl_AddErrorInfo(interp, "\n (processing \"-height\" option)"); @@ -1290,11 +1290,11 @@ ConfigureButton( * The button displays an ordinary text string. */ - if (Tcl_GetIntFromObj(interp, butPtr->widthPtr, &butPtr->width) + if (Tcl_GetIntFromObj(interp, butPtr->widthObj, &butPtr->width) != TCL_OK) { goto widthError; } - if (Tcl_GetIntFromObj(interp, butPtr->heightPtr, &butPtr->height) + if (Tcl_GetIntFromObj(interp, butPtr->heightObj, &butPtr->height) != TCL_OK) { goto heightError; } @@ -1481,7 +1481,7 @@ ButtonEventProc( } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { butPtr->flags |= GOT_FOCUS; - Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth); + Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthObj, &butPtr->highlightWidth); if (butPtr->highlightWidth > 0) { goto redraw; } @@ -1489,7 +1489,7 @@ ButtonEventProc( } else if (eventPtr->type == FocusOut) { if (eventPtr->xfocus.detail != NotifyInferior) { butPtr->flags &= ~GOT_FOCUS; - Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth); + Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthObj, &butPtr->highlightWidth); if (butPtr->highlightWidth > 0) { goto redraw; } diff --git a/generic/tkButton.h b/generic/tkButton.h index 52e861a..592e2dc 100644 --- a/generic/tkButton.h +++ b/generic/tkButton.h @@ -110,10 +110,8 @@ typedef struct { Tk_3DBorder activeBorder; /* Value of -activebackground option: this is * the color used to draw 3-D border and * background when widget is active. */ - Tcl_Obj *borderWidthPtr; /* Value of -borderWidth option: specifies + Tcl_Obj *borderWidthObj; /* Value of -borderWidth option: specifies * width of border in pixels. */ - int borderWidth; /* Integer value corresponding to - * borderWidthPtr. Always >= 0. */ int relief; /* Value of -relief option: specifies 3-d * effect for border, such as * TK_RELIEF_RAISED. */ @@ -126,12 +124,10 @@ typedef struct { * TK_RELIEF_RAISED, to be used when a * checkbutton or radiobutton without * indicator is off. */ - Tcl_Obj *highlightWidthPtr; /* Value of -highlightthickness option: + Tcl_Obj *highlightWidthObj; /* Value of -highlightthickness option: * specifies width in pixels of highlight to * draw around widget when it has the focus. * <= 0 means don't draw a highlight. */ - int highlightWidth; /* Integer value corresponding to - * highlightWidthPtr. Always >= 0. */ Tk_3DBorder highlightBorder;/* Value of -highlightbackground option: * specifies background with which to draw 3-D * default ring and focus highlight area when @@ -166,26 +162,20 @@ typedef struct { * disabledFg is NULL. */ GC copyGC; /* Used for copying information from an * off-screen pixmap to the screen. */ - Tcl_Obj *widthPtr; /* Value of -width option. */ - int width; /* Integer value corresponding to widthPtr. */ - Tcl_Obj *heightPtr; /* Value of -height option. */ - int height; /* Integer value corresponding to heightPtr. */ - Tcl_Obj *wrapLengthPtr; /* Value of -wraplength option: specifies line + Tcl_Obj *widthObj; /* Value of -width option. */ + Tcl_Obj *heightObj; /* Value of -height option. */ + Tcl_Obj *wrapLengthObj; /* Value of -wraplength option: specifies line * length (in pixels) at which to wrap onto * next line. <= 0 means don't wrap except at * newlines. */ - int wrapLength; /* Integer value corresponding to - * wrapLengthPtr. */ - Tcl_Obj *padXPtr; /* Value of -padx option: specifies how many + Tcl_Obj *padXObj; /* Value of -padx option: specifies how many * pixels of extra space to leave on left and * right of text. Ignored for bitmaps and * images. */ - int padX; /* Integer value corresponding to padXPtr. */ - Tcl_Obj *padYPtr; /* Value of -padx option: specifies how many + Tcl_Obj *padYObj; /* Value of -padx option: specifies how many * pixels of extra space to leave above and * below text. Ignored for bitmaps and * images. */ - int padY; /* Integer value corresponding to padYPtr. */ Tk_Anchor anchor; /* Value of -anchor option: specifies where * text/bitmap should be displayed inside * button region. */ @@ -255,6 +245,12 @@ typedef struct { * invocataions of the button command. */ int flags; /* Various flags; see below for * definitions. */ +#ifdef BUILD_tk + int padX, padY; + int borderWidth; + int highlightWidth; + int width, height, wrapLength; +#endif } TkButton; /* diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index da40b99..36e4730 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -234,7 +234,7 @@ Tk_ItemType tkArcType = { ArcCoords, /* coordProc */ DeleteArc, /* deleteProc */ DisplayArc, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ ArcToPoint, /* pointProc */ ArcToArea, /* areaProc */ ArcToPostscript, /* postscriptProc */ @@ -452,7 +452,7 @@ ConfigureArc( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS)) { + objv, arcPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 1bbf566..6915282 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -128,7 +128,7 @@ Tk_ItemType tkBitmapType = { BitmapCoords, /* coordProc */ DeleteBitmap, /* deleteProc */ DisplayBitmap, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ BitmapToPoint, /* pointProc */ BitmapToArea, /* areaProc */ BitmapToPostscript, /* postscriptProc */ @@ -324,7 +324,7 @@ ConfigureBitmap( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS)) { + objv, bmapPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 5f67ec6..0be6ef1 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -116,7 +116,7 @@ Tk_ItemType tkImageType = { ImageCoords, /* coordProc */ DeleteImage, /* deleteProc */ DisplayImage, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ ImageToPoint, /* pointProc */ ImageToArea, /* areaProc */ ImageToPostscript, /* postscriptProc */ @@ -302,7 +302,7 @@ ConfigureImage( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) { + objv, imgPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index a0e6b54..3119385 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -234,7 +234,7 @@ Tk_ItemType tkLineType = { LineCoords, /* coordProc */ DeleteLine, /* deleteProc */ DisplayLine, /* displayProc */ - TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ + TK_MOVABLE_POINTS, /* flags */ LineToPoint, /* pointProc */ LineToArea, /* areaProc */ LineToPostscript, /* postscriptProc */ @@ -485,7 +485,7 @@ ConfigureLine( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **)objv, (char *)linePtr, flags|TK_CONFIG_OBJS)) { + objv, linePtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 400e4c5..f40a922 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -199,7 +199,7 @@ Tk_ItemType tkPolygonType = { PolygonCoords, /* coordProc */ DeletePolygon, /* deleteProc */ DisplayPolygon, /* displayProc */ - TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ + TK_MOVABLE_POINTS, /* flags */ PolygonToPoint, /* pointProc */ PolygonToArea, /* areaProc */ PolygonToPostscript, /* postscriptProc */ @@ -446,7 +446,7 @@ ConfigurePolygon( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) { + objv, polyPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index d0e5e13..50ff084 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -236,8 +236,8 @@ TkCanvPostscriptObjCmd( psInfo.prolog = 1; psInfo.tkwin = tkwin; Tcl_InitHashTable(&psInfo.fontTable, TCL_STRING_KEYS); - result = Tk_ConfigureWidget(interp, tkwin, configSpecs, objc-2, (const char **)objv+2, - (char *) &psInfo, TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS); + result = Tk_ConfigureWidget(interp, tkwin, configSpecs, objc-2, objv+2, + &psInfo, TK_CONFIG_ARGV_ONLY); if (result != TCL_OK) { goto cleanup; } diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 6ab7911..285adcd 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -150,11 +150,7 @@ UnderlinePrintProc( char *p; if (underline == INT_MIN) { -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - p = (char *)"-1"; -#else p = (char *)""; -#endif *freeProcPtr = TCL_STATIC; return p; } else if (underline == INT_MAX) { @@ -276,7 +272,7 @@ Tk_ItemType tkTextType = { TextCoords, /* coordProc */ DeleteText, /* deleteProc */ DisplayCanvText, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ TextToPoint, /* pointProc */ TextToArea, /* areaProc */ TextToPostscript, /* postscriptProc */ @@ -498,7 +494,7 @@ ConfigureText( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS)) { + objv, textPtr, flags)) { return TCL_ERROR; } @@ -594,7 +590,7 @@ ConfigureText( */ textPtr->numBytes = strlen(textPtr->text); - textPtr->numChars = TkNumUtfChars(textPtr->text, textPtr->numBytes); + textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes); if (textInfoPtr->selItemPtr == itemPtr) { if (textInfoPtr->selectFirst >= textPtr->numChars) { @@ -1119,7 +1115,7 @@ TextInsert( ckfree(text); textPtr->text = newStr; - charsAdded = TkNumUtfChars(string, byteCount); + charsAdded = Tcl_NumUtfChars(string, byteCount); textPtr->numChars += charsAdded; textPtr->numBytes += byteCount; @@ -1189,8 +1185,8 @@ TextDeleteChars( } charsRemoved = last + 1 - first; - byteIndex = TkUtfAtIndex(text, first) - text; - byteCount = TkUtfAtIndex(text + byteIndex, charsRemoved) + byteIndex = Tcl_UtfAtIndex(text, first) - text; + byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount); @@ -1612,8 +1608,8 @@ GetSelText( return 0; } text = textPtr->text; - selStart = TkUtfAtIndex(text, textInfoPtr->selectFirst); - selEnd = TkUtfAtIndex(selStart, + selStart = Tcl_UtfAtIndex(text, textInfoPtr->selectFirst); + selEnd = Tcl_UtfAtIndex(selStart, textInfoPtr->selectLast + 1 - textInfoPtr->selectFirst); if (selEnd <= selStart + offset) { return 0; diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 358c697..e1cfe10 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -120,7 +120,7 @@ Tk_ItemType tkWindowType = { WinItemCoords, /* coordProc */ DeleteWinItem, /* deleteProc */ DisplayWinItem, /* displayProc */ - TK_ALWAYS_REDRAW|TK_CONFIG_OBJS, /* flags */ + TK_ALWAYS_REDRAW, /* flags */ WinItemToPoint, /* pointProc */ WinItemToArea, /* areaProc */ WinItemToPostscript, /* postscriptProc */ @@ -316,7 +316,7 @@ ConfigureWinItem( oldWindow = winItemPtr->tkwin; canvasTkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, objc, - (const char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS)) { + objv, winItemPtr, flags)) { return TCL_ERROR; } diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 38a297d..1d37518 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -260,9 +260,6 @@ static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr, Tcl_Obj *const *objv, Tk_Uid uid, int enclosed); static double GridAlign(double coord, double spacing); -#if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9) -static const char** TkGetStringsFromObjs(Tcl_Size objc, Tcl_Obj *const *objv); -#endif static void InitCanvas(void); static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr); static Tcl_Obj * ScrollFractions(int screen1, @@ -328,7 +325,7 @@ static inline int AlwaysRedraw( Tk_Item *itemPtr) { - return itemPtr->typePtr->alwaysRedraw & 1; + return itemPtr->typePtr->flags & TK_ALWAYS_REDRAW; } static inline int @@ -339,25 +336,9 @@ ItemConfigure( Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; - int result; - - if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - const char **args = TkGetStringsFromObjs(objc, objv); - result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY); - if (args != NULL) { - ckfree(args); - } -#endif - } - return result; + return itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, + itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY); } static inline int @@ -394,21 +375,9 @@ ItemCoords( if (itemPtr->typePtr->coordProc == NULL) { result = TCL_OK; - } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, objv); } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - const char **args = TkGetStringsFromObjs(objc, objv); - result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc, (Tcl_Obj **) args); - if (args != NULL) { - ckfree(args); - } -#endif + itemPtr, objc, objv); } return result; } @@ -422,25 +391,9 @@ ItemCreate( Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; - int result; - if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, + return itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - const char **args = TkGetStringsFromObjs(objc-3, objv+3); - - result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objc-3, (Tcl_Obj **) args); - if (args != NULL) { - ckfree(args); - } -#endif - } - return result; } static inline void @@ -494,18 +447,9 @@ ItemIndex( if (itemPtr->typePtr->indexProc == NULL) { return TCL_OK; - } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, objPtr, indexPtr); - } else { -#if defined(TK_NO_DEPRECATED) - Tcl_AppendResult(interp, "Flag TK_CONFIG_OBJS is mandatory", (char *)NULL); - return TCL_ERROR; -#else - return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, - itemPtr, (Tcl_Obj *) Tcl_GetString(objPtr), indexPtr); -#endif } + return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, + itemPtr, objPtr, indexPtr); } static inline void @@ -515,17 +459,8 @@ ItemInsert( int beforeThis, Tcl_Obj *toInsert) { - if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) { - itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, - beforeThis, toInsert); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, - beforeThis, (Tcl_Obj *) Tcl_GetString(toInsert)); -#endif - } + itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, + beforeThis, toInsert); } static inline int @@ -871,7 +806,7 @@ CanvasWidgetCmd( "canvasy", "cget", "configure", "coords", "create", "dchars", "delete", "dtag", "find", "focus", "gettags", "icursor", - "image", "imove", "index", "insert", + "image", "imove", "index", "insert", "itemcget", "itemconfigure", "lower", "move", "moveto", "postscript", "raise", "rchars", "rotate", "scale", @@ -883,7 +818,7 @@ CanvasWidgetCmd( CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS, CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG, CANV_FIND, CANV_FOCUS, CANV_GETTAGS, CANV_ICURSOR, - CANV_IMAGE, CANV_IMOVE, CANV_INDEX, CANV_INSERT, + CANV_IMAGE, CANV_IMOVE, CANV_INDEX, CANV_INSERT, CANV_ITEMCGET, CANV_ITEMCONFIGURE, CANV_LOWER, CANV_MOVE, CANV_MOVETO, CANV_POSTSCRIPT, CANV_RAISE, CANV_RCHARS, CANV_ROTATE, CANV_SCALE, @@ -1232,7 +1167,7 @@ CanvasWidgetCmd( */ if (itemPtr == NULL || - !(itemPtr->typePtr->alwaysRedraw & TK_MOVABLE_POINTS)) { + !(itemPtr->typePtr->flags & TK_MOVABLE_POINTS)) { continue; } @@ -1485,19 +1420,19 @@ CanvasWidgetCmd( for (i = itemPtr->numTags-1; i != TCL_INDEX_NONE; i--) { if (itemPtr->tagPtr[i] == tag) { - /* - * Don't shuffle the tags sequence: memmove the tags. - */ + /* + * Don't shuffle the tags sequence: memmove the tags. + */ - memmove((void *)(itemPtr->tagPtr + i), - itemPtr->tagPtr + i + 1, - (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); + memmove((void *)(itemPtr->tagPtr + i), + itemPtr->tagPtr + i + 1, + (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); itemPtr->numTags--; - /* - * There must be no break here: all tags with the same name must - * be deleted. - */ + /* + * There must be no break here: all tags with the same name must + * be deleted. + */ } } @@ -1863,15 +1798,15 @@ CanvasWidgetCmd( x1 = itemPtr->x1; y1 = itemPtr->y1; x2 = itemPtr->x2; y2 = itemPtr->y2; - itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; + itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemDelChars(canvasPtr, itemPtr, first, last); dontRedraw1 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW; - itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; + itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; ItemInsert(canvasPtr, itemPtr, first, objv[5]); dontRedraw2 = itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW; - if (!(dontRedraw1 && dontRedraw2)) { + if (!(dontRedraw1 && dontRedraw2)) { Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, x1, y1, x2, y2); EventuallyRedrawItem(canvasPtr, itemPtr); @@ -2177,44 +2112,44 @@ CanvasWidgetCmd( break; } case CANV_IMAGE: { - Tk_PhotoHandle photohandle; - int subsample = 1, zoom = 1; + Tk_PhotoHandle photohandle; + int subsample = 1, zoom = 1; - if (objc < 3 || objc > 5) { - Tcl_WrongNumArgs(interp, 2, objv, "imagename ?subsample? ?zoom?"); - result = TCL_ERROR; - goto done; - } + if (objc < 3 || objc > 5) { + Tcl_WrongNumArgs(interp, 2, objv, "imagename ?subsample? ?zoom?"); + result = TCL_ERROR; + goto done; + } - if ((photohandle = Tk_FindPhoto(interp, Tcl_GetString(objv[2]) )) == 0) { - result = TCL_ERROR; - goto done; - } + if ((photohandle = Tk_FindPhoto(interp, Tcl_GetString(objv[2]) )) == 0) { + result = TCL_ERROR; + goto done; + } - /* - * If we are given a subsample or a zoom then grab them. - */ + /* + * If we are given a subsample or a zoom then grab them. + */ - if (objc >= 4 && Tcl_GetIntFromObj(interp, objv[3], &subsample) != TCL_OK) { - result = TCL_ERROR; - goto done; - } - if (objc >= 5 && Tcl_GetIntFromObj(interp, objv[4], &zoom) != TCL_OK) { - result = TCL_ERROR; - goto done; - } + if (objc >= 4 && Tcl_GetIntFromObj(interp, objv[3], &subsample) != TCL_OK) { + result = TCL_ERROR; + goto done; + } + if (objc >= 5 && Tcl_GetIntFromObj(interp, objv[4], &zoom) != TCL_OK) { + result = TCL_ERROR; + goto done; + } - /* - * Set the image size to zero, which allows the DrawCanvas() function - * to expand the image automatically when it copies the pixmap into it. - */ + /* + * Set the image size to zero, which allows the DrawCanvas() function + * to expand the image automatically when it copies the pixmap into it. + */ - if (Tk_PhotoSetSize(interp, photohandle, 0, 0) != TCL_OK) { - result = TCL_ERROR; - goto done; - } + if (Tk_PhotoSetSize(interp, photohandle, 0, 0) != TCL_OK) { + result = TCL_ERROR; + goto done; + } - result = DrawCanvas(interp, clientData, photohandle, subsample, zoom); + result = DrawCanvas(interp, clientData, photohandle, subsample, zoom); } } @@ -2326,8 +2261,8 @@ ConfigureCanvas( Tk_State old_canvas_state=canvasPtr->canvas_state; if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs, - objc, (const char **) objv, (char *) canvasPtr, - flags|TK_CONFIG_OBJS) != TCL_OK) { + objc, objv, canvasPtr, + flags) != TCL_OK) { return TCL_ERROR; } @@ -2531,31 +2466,31 @@ DecomposeMaskToShiftAndBits( */ for (i = 0; i < 32; ++i) { - if (mask & 1 << i) - break; + if (mask & 1 << i) + break; } if (i < 32) { - *shift = i; + *shift = i; - /* - * Now find the next '0' bit and the width of the mask. - */ + /* + * Now find the next '0' bit and the width of the mask. + */ - for ( ; i < 32; ++i) { - if ((mask & 1 << i) == 0) - break; - else - ++*bits; - } + for ( ; i < 32; ++i) { + if ((mask & 1 << i) == 0) + break; + else + ++*bits; + } - /* - * Limit to the top 8 bits if the mask was wider than 8. - */ + /* + * Limit to the top 8 bits if the mask was wider than 8. + */ - if (*bits > 8) { - *shift += *bits - 8; - *bits = 8; - } + if (*bits > 8) { + *shift += *bits - 8; + *bits = 8; + } } } @@ -2580,7 +2515,7 @@ DecomposeMaskToShiftAndBits( */ #define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap - * that the canvas objects are drawn into */ + * that the canvas objects are drawn into */ #ifdef WORDS_BIGENDIAN #define IS_BIG_ENDIAN 1 @@ -2611,18 +2546,18 @@ DrawCanvas( GC xgc = 0; XGCValues xgcValues; int canvasX1, canvasY1, canvasX2, canvasY2, cWidth, cHeight, - pixmapX1, pixmapY1, pixmapX2, pixmapY2, pmWidth, pmHeight, - bitsPerPixel, bytesPerPixel, x, y, result = TCL_OK, - rshift, gshift, bshift, rbits, gbits, bbits; + pixmapX1, pixmapY1, pixmapX2, pixmapY2, pmWidth, pmHeight, + bitsPerPixel, bytesPerPixel, x, y, result = TCL_OK, + rshift, gshift, bshift, rbits, gbits, bbits; #ifdef DEBUG_DRAWCANVAS char buffer[128]; #endif if ((tkwin = canvasPtr->tkwin) == NULL) { - Tcl_AppendResult(interp, "canvas tkwin is NULL!", (char *)NULL); - result = TCL_ERROR; - goto done; + Tcl_AppendResult(interp, "canvas tkwin is NULL!", (char *)NULL); + result = TCL_ERROR; + goto done; } /* @@ -2633,21 +2568,21 @@ DrawCanvas( do { - if ((displayPtr = Tk_Display(tkwin)) == NULL) { - Tcl_AppendResult(interp, "canvas (or parent) display is NULL!", (char *)NULL); - result = TCL_ERROR; - goto done; - } + if ((displayPtr = Tk_Display(tkwin)) == NULL) { + Tcl_AppendResult(interp, "canvas (or parent) display is NULL!", (char *)NULL); + result = TCL_ERROR; + goto done; + } - if ((wid = Tk_WindowId(tkwin)) != 0) { - continue; - } + if ((wid = Tk_WindowId(tkwin)) != 0) { + continue; + } - if ((tkwin = Tk_Parent(tkwin)) == NULL) { - Tcl_AppendResult(interp, "canvas has no parent with a valid window id! Is the toplevel window mapped?", (char *)NULL); - result = TCL_ERROR; - goto done; - } + if ((tkwin = Tk_Parent(tkwin)) == NULL) { + Tcl_AppendResult(interp, "canvas has no parent with a valid window id! Is the toplevel window mapped?", (char *)NULL); + result = TCL_ERROR; + goto done; + } } while (wid == 0); @@ -2655,9 +2590,9 @@ DrawCanvas( visualPtr = Tk_Visual(tkwin); if (subsample == 0) { - Tcl_AppendResult(interp, "subsample cannot be zero", (char *)NULL); - result = TCL_ERROR; - goto done; + Tcl_AppendResult(interp, "subsample cannot be zero", (char *)NULL); + result = TCL_ERROR; + goto done; } /* @@ -2667,12 +2602,12 @@ DrawCanvas( */ for (itemPtr = canvasPtr -> firstItemPtr; itemPtr != NULL; - itemPtr = itemPtr -> nextPtr) { - if (itemPtr -> redraw_flags & FORCE_REDRAW) { - itemPtr -> redraw_flags &= ~FORCE_REDRAW; - EventuallyRedrawItem(canvasPtr, itemPtr); - itemPtr -> redraw_flags &= ~FORCE_REDRAW; - } + itemPtr = itemPtr -> nextPtr) { + if (itemPtr -> redraw_flags & FORCE_REDRAW) { + itemPtr -> redraw_flags &= ~FORCE_REDRAW; + EventuallyRedrawItem(canvasPtr, itemPtr); + itemPtr -> redraw_flags &= ~FORCE_REDRAW; + } } /* @@ -2683,23 +2618,23 @@ DrawCanvas( * of 0,0. */ if (canvasPtr->scrollX1 != 0 || canvasPtr->scrollY1 != 0 || - canvasPtr->scrollX2 != 0 || canvasPtr->scrollY2 != 0) { + canvasPtr->scrollX2 != 0 || canvasPtr->scrollY2 != 0) { - canvasX1 = canvasPtr->scrollX1; - canvasY1 = canvasPtr->scrollY1; - canvasX2 = canvasPtr->scrollX2; - canvasY2 = canvasPtr->scrollY2; - cWidth = canvasX2 - canvasX1 + 1; - cHeight = canvasY2 - canvasY1 + 1; + canvasX1 = canvasPtr->scrollX1; + canvasY1 = canvasPtr->scrollY1; + canvasX2 = canvasPtr->scrollX2; + canvasY2 = canvasPtr->scrollY2; + cWidth = canvasX2 - canvasX1 + 1; + cHeight = canvasY2 - canvasY1 + 1; } else { - cWidth = Tk_Width(tkwin); - cHeight = Tk_Height(tkwin); - canvasX1 = 0; - canvasY1 = 0; - canvasX2 = canvasX1 + cWidth - 1; - canvasY2 = canvasY1 + cHeight - 1; + cWidth = Tk_Width(tkwin); + cHeight = Tk_Height(tkwin); + canvasX1 = 0; + canvasY1 = 0; + canvasX2 = canvasX1 + cWidth - 1; + canvasY2 = canvasY1 + cHeight - 1; } /* @@ -2715,10 +2650,10 @@ DrawCanvas( pmWidth = pixmapX2 - pixmapX1 + 1; pmHeight = pixmapY2 - pixmapY1 + 1; if ((pixmap = Tk_GetPixmap(displayPtr, Tk_WindowId(tkwin), pmWidth, pmHeight, - bitsPerPixel)) == 0) { - Tcl_AppendResult(interp, "failed to create drawing Pixmap", (char *)NULL); - result = TCL_ERROR; - goto done; + bitsPerPixel)) == 0) { + Tcl_AppendResult(interp, "failed to create drawing Pixmap", (char *)NULL); + result = TCL_ERROR; + goto done; } /* @@ -2738,20 +2673,20 @@ DrawCanvas( canvasPtr->drawableXOrigin = pixmapX1; canvasPtr->drawableYOrigin = pixmapY1; for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; - itemPtr = itemPtr->nextPtr) { - if ((itemPtr->x1 >= pixmapX2) || (itemPtr->y1 >= pixmapY2) || - (itemPtr->x2 < pixmapX1) || (itemPtr->y2 < pixmapY1)) { - if (!AlwaysRedraw(itemPtr)) { - continue; - } - } - if (itemPtr->state == TK_STATE_HIDDEN || - (itemPtr->state == TK_STATE_NULL && canvasPtr->canvas_state - == TK_STATE_HIDDEN)) { - continue; - } - ItemDisplay(canvasPtr, itemPtr, pixmap, pixmapX1, pixmapY1, pmWidth, - pmHeight); + itemPtr = itemPtr->nextPtr) { + if ((itemPtr->x1 >= pixmapX2) || (itemPtr->y1 >= pixmapY2) || + (itemPtr->x2 < pixmapX1) || (itemPtr->y2 < pixmapY1)) { + if (!AlwaysRedraw(itemPtr)) { + continue; + } + } + if (itemPtr->state == TK_STATE_HIDDEN || + (itemPtr->state == TK_STATE_NULL && canvasPtr->canvas_state + == TK_STATE_HIDDEN)) { + continue; + } + ItemDisplay(canvasPtr, itemPtr, pixmap, pixmapX1, pixmapY1, pmWidth, + pmHeight); } /* @@ -2762,10 +2697,10 @@ DrawCanvas( */ if ((ximagePtr = XGetImage(displayPtr, pixmap, -pixmapX1, -pixmapY1, cWidth, - cHeight, AllPlanes, ZPixmap)) == NULL) { - Tcl_AppendResult(interp, "failed to copy Pixmap to XImage", (char *)NULL); - result = TCL_ERROR; - goto done; + cHeight, AllPlanes, ZPixmap)) == NULL) { + Tcl_AppendResult(interp, "failed to copy Pixmap to XImage", (char *)NULL); + result = TCL_ERROR; + goto done; } #ifdef DEBUG_DRAWCANVAS @@ -2778,18 +2713,18 @@ DrawCanvas( if (ximagePtr->data != NULL) { int ix, iy; - Tcl_AppendResult(interp, " {", (char *)NULL); + Tcl_AppendResult(interp, " {", (char *)NULL); for (iy = 0; iy < ximagePtr->height; ++ iy) { Tcl_AppendResult(interp, " {", (char *)NULL); for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) { - if (ix > 0) { - if (ix % 4 == 0) - Tcl_AppendResult(interp, "-", (char *)NULL); - else - Tcl_AppendResult(interp, " ", (char *)NULL); - } - snprintf(buffer,sizeof(buffer),"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); - Tcl_AppendResult(interp, buffer, (char *)NULL); + if (ix > 0) { + if (ix % 4 == 0) + Tcl_AppendResult(interp, "-", (char *)NULL); + else + Tcl_AppendResult(interp, " ", (char *)NULL); + } + snprintf(buffer,sizeof(buffer),"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); + Tcl_AppendResult(interp, buffer, (char *)NULL); } Tcl_AppendResult(interp, " }", (char *)NULL); } @@ -2871,62 +2806,62 @@ DrawCanvas( for (y = 0; y < blockPtr.height; ++y) { #ifdef DEBUG_DRAWCANVAS - Tcl_AppendResult(interp, " {", (char *)NULL); + Tcl_AppendResult(interp, " {", (char *)NULL); #endif - for(x = 0; x < blockPtr.width; ++x) { - unsigned int pixel = 0; + for(x = 0; x < blockPtr.width; ++x) { + unsigned int pixel = 0; int pixel_offset = blockPtr.pitch * y + blockPtr.pixelSize * x; - switch (ximagePtr->bits_per_pixel) { - - /* - * Get an 8 bit pixel from the XImage. - */ - - case 8 : - pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x - + ximagePtr->bytes_per_line * y)); - break; - - /* - * Get a 16 bit pixel from the XImage, and correct the - * byte order as necessary. - */ - - case 16 : - pixel = *((unsigned short *)(ximagePtr->data + bytesPerPixel * x - + ximagePtr->bytes_per_line * y)); - if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) - || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) - pixel = BYTE_SWAP16(pixel); - break; - - /* - * Grab a 32 bit pixel from the XImage, and correct the - * byte order as necessary. - */ - - case 32 : - pixel = *((unsigned int *)(ximagePtr->data + bytesPerPixel * x - + ximagePtr->bytes_per_line * y)); - if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) - || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) - pixel = BYTE_SWAP32(pixel); - break; - } - - /* - * We have a pixel with the correct byte order, so pull out the - * colours and place them in the photo block. Perhaps we could - * just not bother with the alpha byte because we are using - * TK_PHOTO_COMPOSITE_SET later? - * ***Windows: We have to swap the red and blue values. The - * XImage storage is B - G - R - A which becomes a 32bit ARGB - * quad. However the visual mask is a 32bit ABGR quad. And - * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad. - * If the visual mask was correct there would be no need to - * swap anything here. - */ + switch (ximagePtr->bits_per_pixel) { + + /* + * Get an 8 bit pixel from the XImage. + */ + + case 8 : + pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x + + ximagePtr->bytes_per_line * y)); + break; + + /* + * Get a 16 bit pixel from the XImage, and correct the + * byte order as necessary. + */ + + case 16 : + pixel = *((unsigned short *)(ximagePtr->data + bytesPerPixel * x + + ximagePtr->bytes_per_line * y)); + if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) + || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) + pixel = BYTE_SWAP16(pixel); + break; + + /* + * Grab a 32 bit pixel from the XImage, and correct the + * byte order as necessary. + */ + + case 32 : + pixel = *((unsigned int *)(ximagePtr->data + bytesPerPixel * x + + ximagePtr->bytes_per_line * y)); + if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) + || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) + pixel = BYTE_SWAP32(pixel); + break; + } + + /* + * We have a pixel with the correct byte order, so pull out the + * colours and place them in the photo block. Perhaps we could + * just not bother with the alpha byte because we are using + * TK_PHOTO_COMPOSITE_SET later? + * ***Windows: We have to swap the red and blue values. The + * XImage storage is B - G - R - A which becomes a 32bit ARGB + * quad. However the visual mask is a 32bit ABGR quad. And + * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad. + * If the visual mask was correct there would be no need to + * swap anything here. + */ #ifdef _WIN32 #define R_OFFSET blockPtr.offset[2] @@ -2953,11 +2888,11 @@ DrawCanvas( *((unsigned int *) (blockPtr.pixelPtr + pixel_offset)) = pixel; } else { blockPtr.pixelPtr[pixel_offset + R_OFFSET] = - (unsigned char)((pixel & visualPtr->red_mask) >> rshift); + (unsigned char)((pixel & visualPtr->red_mask) >> rshift); blockPtr.pixelPtr[pixel_offset + G_OFFSET] = - (unsigned char)((pixel & visualPtr->green_mask) >> gshift); + (unsigned char)((pixel & visualPtr->green_mask) >> gshift); blockPtr.pixelPtr[pixel_offset + B_OFFSET] = - (unsigned char)((pixel & visualPtr->blue_mask) >> bshift); + (unsigned char)((pixel & visualPtr->blue_mask) >> bshift); blockPtr.pixelPtr[pixel_offset + A_OFFSET] = 0xFF; } @@ -2968,25 +2903,25 @@ DrawCanvas( blockPtr.pixelPtr[pixel_offset + 1], blockPtr.pixelPtr[pixel_offset + 2], blockPtr.pixelPtr[pixel_offset + 3]); - { + { int ix; - if (x > 0) - Tcl_AppendResult(interp, "-", (char *)NULL); - for (ix = 0; ix < 4; ++ix) { - if (ix > 0) - Tcl_AppendResult(interp, " ", (char *)NULL); + if (x > 0) + Tcl_AppendResult(interp, "-", (char *)NULL); + for (ix = 0; ix < 4; ++ix) { + if (ix > 0) + Tcl_AppendResult(interp, " ", (char *)NULL); snprintf(buffer,sizeof(buffer),"%2.2x", - blockPtr.pixelPtr[blockPtr.pitch * y - + blockPtr.pixelSize * x + ix]&0xFF); - Tcl_AppendResult(interp, buffer, (char *)NULL); - } - } + blockPtr.pixelPtr[blockPtr.pitch * y + + blockPtr.pixelSize * x + ix]&0xFF); + Tcl_AppendResult(interp, buffer, (char *)NULL); + } + } #endif - } + } #ifdef DEBUG_DRAWCANVAS - Tcl_AppendResult(interp, " }", (char *)NULL); + Tcl_AppendResult(interp, " }", (char *)NULL); #endif } @@ -3001,17 +2936,17 @@ DrawCanvas( */ if (subsample != 1 || zoom != 1) { - if ((result = Tk_PhotoPutZoomedBlock(interp, photohandle, &blockPtr, - 0, 0, cWidth * zoom / subsample, cHeight * zoom / subsample, - zoom, zoom, subsample, subsample, TK_PHOTO_COMPOSITE_SET)) - != TCL_OK) { - goto done; - } + if ((result = Tk_PhotoPutZoomedBlock(interp, photohandle, &blockPtr, + 0, 0, cWidth * zoom / subsample, cHeight * zoom / subsample, + zoom, zoom, subsample, subsample, TK_PHOTO_COMPOSITE_SET)) + != TCL_OK) { + goto done; + } } else { - if ((result = Tk_PhotoPutBlock(interp, photohandle, &blockPtr, 0, 0, - cWidth, cHeight, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) { - goto done; - } + if ((result = Tk_PhotoPutBlock(interp, photohandle, &blockPtr, 0, 0, + cWidth, cHeight, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) { + goto done; + } } /* @@ -3020,13 +2955,13 @@ DrawCanvas( done: if (blockPtr.pixelPtr) - ckfree(blockPtr.pixelPtr); + ckfree(blockPtr.pixelPtr); if (pixmap) - Tk_FreePixmap(Tk_Display(tkwin), pixmap); + Tk_FreePixmap(Tk_Display(tkwin), pixmap); if (ximagePtr) - XDestroyImage(ximagePtr); + XDestroyImage(ximagePtr); if (xgc) - XFreeGC(displayPtr,xgc); + XFreeGC(displayPtr,xgc); return result; } @@ -3365,8 +3300,8 @@ CanvasEventProc( /* * Special hack: if the canvas is unmapped, then must notify all items - * with "alwaysRedraw" set, so that they know that they are no longer - * displayed. + * with flag TK_ALWAYS_REDRAW set, so that they know that they are no + * longer displayed. */ for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; @@ -5367,9 +5302,9 @@ PickCurrentItem( for (i = itemPtr->numTags-1; i != TCL_INDEX_NONE; i--) { if (itemPtr->tagPtr[i] == searchUids->currentUid) /* then */ { - memmove((void *)(itemPtr->tagPtr + i), - itemPtr->tagPtr + i + 1, - (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); + memmove((void *)(itemPtr->tagPtr + i), + itemPtr->tagPtr + i + 1, + (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); itemPtr->numTags--; break; } @@ -6103,43 +6038,7 @@ CanvasSetOrigin( canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } - -/* - *---------------------------------------------------------------------- - * - * TkGetStringsFromObjs -- - * - * Results: - * Converts object list into string list. - * - * Side effects: - * Memory is allocated for the objv array, which must be freed using - * ckfree() when no longer needed. - * - *---------------------------------------------------------------------- - */ - -#if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9) -static const char ** -TkGetStringsFromObjs( - Tcl_Size objc, - Tcl_Obj *const objv[]) -{ - Tcl_Size i; - const char **argv; - if (objc <= 0) { - return NULL; - } - argv = (const char **)ckalloc((objc+1) * sizeof(char *)); - for (i = 0; i < objc; i++) { - argv[i] = Tcl_GetString(objv[i]); - } - argv[objc] = 0; - return argv; -} -#endif - /* *-------------------------------------------------------------- * diff --git a/generic/tkCmds.c b/generic/tkCmds.c index f6fb07e..81c459d 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -100,7 +100,7 @@ Tk_BellObjCmd( }; enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE }; Tk_Window tkwin = (Tk_Window)clientData; - int i; + Tcl_Size i; int index, nice = 0; Tk_ErrorHandler handler; @@ -456,7 +456,7 @@ TkFreeBindingTags( * have to be freed. */ - ckfree((char *)p); + ckfree((void *)p); } } ckfree(winPtr->tagPtr); @@ -490,7 +490,7 @@ Tk_DestroyObjCmd( { Tk_Window window; Tk_Window tkwin = (Tk_Window)clientData; - int i; + Tcl_Size i; for (i = 1; i < objc; i++) { window = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), tkwin); @@ -1302,7 +1302,7 @@ Tk_WinfoObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int index, x, y, width, height, useX, useY, c_class; - int skip; + Tcl_Size skip; const char *string; TkWindow *winPtr; Tk_Window tkwin = (Tk_Window)clientData; @@ -1678,7 +1678,7 @@ Tk_WinfoObjCmd( if ((winPtr == NULL) || (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window id \"%s\" doesn't exist in this application", + "window id \"%s\" does not exist in this application", string)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "WINDOW", string, (char *)NULL); return TCL_ERROR; diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 8302b38..ec0da18 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -222,7 +222,7 @@ Tk_InitConsoleChannels( * Ensure that we are getting a compatible version of Tcl. */ - if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { return; } @@ -441,7 +441,7 @@ Tk_CreateConsoleWindow( } Tcl_Preserve(consoleInterp); - result = Tcl_EvalEx(consoleInterp, "source -encoding utf-8 $tk_library/console.tcl", + result = Tcl_EvalEx(consoleInterp, "source $tk_library/console.tcl", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_SetReturnOptions(interp, diff --git a/generic/tkDList.h b/generic/tkDList.h index f6c70d9..1cd5977 100644 --- a/generic/tkDList.h +++ b/generic/tkDList.h @@ -440,7 +440,7 @@ static void \ LT##_Free(struct ElemType *elem) \ { \ LT##_Remove(elem); \ - ckfree((void *) elem); \ + ckfree((void *)elem); \ } \ \ __TK_DLIST_UNUSED \ @@ -508,7 +508,7 @@ LT##_Clear(LT *head) \ assert(head); \ for (p = head->first; p; p = next) { \ next = LT##_Next(p); \ - ckfree((void *) p); \ + ckfree((void *)p); \ } \ LT##_Init(head); \ } \ diff --git a/generic/tkDecls.h b/generic/tkDecls.h index bdad3d1..8695993 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -142,7 +142,7 @@ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - Tcl_Size argc, const char **argv, + Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags); /* 30 */ EXTERN void Tk_ConfigureWindow(Tk_Window tkwin, @@ -288,9 +288,7 @@ EXTERN void Tk_FreeOptions(const Tk_ConfigSpec *specs, EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap); /* 76 */ EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout); -/* 77 */ -TK_DEPRECATED("function does nothing, call can be removed") -void Tk_FreeXId(Display *display, XID xid); +/* Slot 77 is reserved */ /* 78 */ EXTERN GC Tk_GCForColor(XColor *colorPtr, Drawable drawable); /* 79 */ @@ -413,8 +411,7 @@ EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window); EXTERN void Tk_ImageChanged(Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight); -/* 118 */ -EXTERN int Tk_Init(Tcl_Interp *interp); +/* Slot 118 is reserved */ /* 119 */ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name); /* 120 */ @@ -476,34 +473,18 @@ EXTERN void Tk_OwnSelection(Tk_Window tkwin, Atom selection, EXTERN int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); -/* 144 */ -TK_DEPRECATED("function signature changed") -void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height); -/* 145 */ -TK_DEPRECATED("function signature changed") -void Tk_PhotoPutZoomedBlock_NoComposite( - Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int zoomX, int zoomY, - int subsampleX, int subsampleY); +/* Slot 144 is reserved */ +/* Slot 145 is reserved */ /* 146 */ EXTERN int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 147 */ EXTERN void Tk_PhotoBlank(Tk_PhotoHandle handle); -/* 148 */ -TK_DEPRECATED("function signature changed") -void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, - int width, int height); +/* Slot 148 is reserved */ /* 149 */ EXTERN void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); -/* 150 */ -TK_DEPRECATED("function signature changed") -void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, - int width, int height); +/* Slot 150 is reserved */ /* 151 */ EXTERN int Tk_PointToChar(Tk_TextLayout layout, int x, int y); /* 152 */ @@ -529,8 +510,7 @@ EXTERN int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, /* 158 */ EXTERN Tk_RestrictProc * Tk_RestrictEvents(Tk_RestrictProc *proc, void *arg, void **prevArgPtr); -/* 159 */ -EXTERN int Tk_SafeInit(Tcl_Interp *interp); +/* Slot 159 is reserved */ /* 160 */ EXTERN const char * Tk_SetAppName(Tk_Window tkwin, const char *name); /* 161 */ @@ -679,10 +659,7 @@ EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, /* 211 */ EXTERN int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); -/* 212 */ -EXTERN TCL_NORETURN1 void Tk_MainEx(Tcl_Size argc, char **argv, - Tcl_AppInitProc *appInitProc, - Tcl_Interp *interp); +/* Slot 212 is reserved */ /* 213 */ EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr); /* 214 */ @@ -692,8 +669,7 @@ EXTERN int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_SavedOptions *savePtr, int *maskPtr); /* 215 */ EXTERN void Tk_InitConsoleChannels(Tcl_Interp *interp); -/* 216 */ -EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp); +/* Slot 216 is reserved */ /* 217 */ EXTERN void Tk_CreateSmoothMethod(Tcl_Interp *interp, const Tk_SmoothMethod *method); @@ -785,17 +761,8 @@ EXTERN void Tk_SetMinimumRequestSize(Tk_Window tkwin, /* 245 */ EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height); -/* 246 */ -TK_DEPRECATED("function signature changed") -void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int compRule); -/* 247 */ -TK_DEPRECATED("function signature changed") -void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int zoomX, int zoomY, - int subsampleX, int subsampleY, int compRule); +/* Slot 246 is reserved */ +/* Slot 247 is reserved */ /* 248 */ EXTERN int Tk_CollapseMotionEvents(Display *display, int collapse); @@ -821,10 +788,8 @@ EXTERN const char * Tk_NameOfStyle(Tk_Style style); /* 257 */ EXTERN Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); -/* 258 */ -EXTERN Tk_Style Tk_GetStyleFromObj(Tcl_Obj *objPtr); -/* 259 */ -EXTERN void Tk_FreeStyleFromObj(Tcl_Obj *objPtr); +/* Slot 258 is reserved */ +/* Slot 259 is reserved */ /* 260 */ EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, Tcl_Size elementId, @@ -872,11 +837,8 @@ EXTERN long Tk_GetUserInactiveTime(Display *dpy); EXTERN void Tk_ResetUserInactiveTime(Display *dpy); /* 271 */ EXTERN Tcl_Interp * Tk_Interp(Tk_Window tkwin); -/* 272 */ -EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr); -/* 273 */ -EXTERN void Tk_CreateOldPhotoImageFormat( - const Tk_PhotoImageFormat *formatPtr); +/* Slot 272 is reserved */ +/* Slot 273 is reserved */ /* 274 */ EXTERN int Tk_AlwaysShowSelection(Tk_Window tkwin); /* 275 */ @@ -966,7 +928,7 @@ typedef struct TkStubs { int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 27 */ int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 28 */ - int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size argc, const char **argv, void *widgRec, int flags); /* 29 */ + int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags); /* 29 */ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, Tcl_Size numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ @@ -1014,7 +976,7 @@ typedef struct TkStubs { void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, void *widgRec, Display *display, int needFlags); /* 74 */ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */ - TCL_DEPRECATED_API("function does nothing, call can be removed") void (*tk_FreeXId) (Display *display, XID xid); /* 77 */ + void (*reserved77)(void); GC (*tk_GCForColor) (XColor *colorPtr, Drawable drawable); /* 78 */ void (*tk_GeometryRequest) (Tk_Window tkwin, int reqWidth, int reqHeight); /* 79 */ Tk_3DBorder (*tk_Get3DBorder) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 80 */ @@ -1055,7 +1017,7 @@ typedef struct TkStubs { void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */ Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */ void (*tk_ImageChanged) (Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */ - int (*tk_Init) (Tcl_Interp *interp); /* 118 */ + void (*reserved118)(void); Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */ int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */ void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 121 */ @@ -1081,13 +1043,13 @@ typedef struct TkStubs { Tk_Window (*tk_NameToWindow) (Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 141 */ void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, void *clientData); /* 142 */ int (*tk_ParseArgv) (Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); /* 143 */ - TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height); /* 144 */ - TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutZoomedBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY); /* 145 */ + void (*reserved144)(void); + void (*reserved145)(void); int (*tk_PhotoGetImage) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 146 */ void (*tk_PhotoBlank) (Tk_PhotoHandle handle); /* 147 */ - TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoExpand_Panic) (Tk_PhotoHandle handle, int width, int height); /* 148 */ + void (*reserved148)(void); void (*tk_PhotoGetSize) (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* 149 */ - TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoSetSize_Panic) (Tk_PhotoHandle handle, int width, int height); /* 150 */ + void (*reserved150)(void); int (*tk_PointToChar) (Tk_TextLayout layout, int x, int y); /* 151 */ int (*tk_PostscriptFontName) (Tk_Font tkfont, Tcl_DString *dsPtr); /* 152 */ void (*tk_PreserveColormap) (Display *display, Colormap colormap); /* 153 */ @@ -1096,7 +1058,7 @@ typedef struct TkStubs { void (*tk_ResizeWindow) (Tk_Window tkwin, int width, int height); /* 156 */ int (*tk_RestackWindow) (Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 157 */ Tk_RestrictProc * (*tk_RestrictEvents) (Tk_RestrictProc *proc, void *arg, void **prevArgPtr); /* 158 */ - int (*tk_SafeInit) (Tcl_Interp *interp); /* 159 */ + void (*reserved159)(void); const char * (*tk_SetAppName) (Tk_Window tkwin, const char *name); /* 160 */ void (*tk_SetBackgroundFromBorder) (Tk_Window tkwin, Tk_3DBorder border); /* 161 */ void (*tk_SetClass) (Tk_Window tkwin, const char *className); /* 162 */ @@ -1149,11 +1111,11 @@ typedef struct TkStubs { int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */ int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */ int (*tk_InitOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */ - TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") TCL_NORETURN1 void (*tk_MainEx) (Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */ + void (*reserved212)(void); void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */ int (*tk_SetOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */ void (*tk_InitConsoleChannels) (Tcl_Interp *interp); /* 215 */ - int (*tk_CreateConsoleWindow) (Tcl_Interp *interp); /* 216 */ + void (*reserved216)(void); void (*tk_CreateSmoothMethod) (Tcl_Interp *interp, const Tk_SmoothMethod *method); /* 217 */ void (*reserved218)(void); void (*reserved219)(void); @@ -1183,8 +1145,8 @@ typedef struct TkStubs { void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */ void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */ void (*tk_SetCaretPos) (Tk_Window tkwin, int x, int y, int height); /* 245 */ - TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 246 */ - TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutZoomedBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 247 */ + void (*reserved246)(void); + void (*reserved247)(void); int (*tk_CollapseMotionEvents) (Display *display, int collapse); /* 248 */ Tk_StyleEngine (*tk_RegisterStyleEngine) (const char *name, Tk_StyleEngine parent); /* 249 */ Tk_StyleEngine (*tk_GetStyleEngine) (const char *name); /* 250 */ @@ -1195,8 +1157,8 @@ typedef struct TkStubs { void (*tk_FreeStyle) (Tk_Style style); /* 255 */ const char * (*tk_NameOfStyle) (Tk_Style style); /* 256 */ Tk_Style (*tk_AllocStyleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 257 */ - Tk_Style (*tk_GetStyleFromObj) (Tcl_Obj *objPtr); /* 258 */ - void (*tk_FreeStyleFromObj) (Tcl_Obj *objPtr); /* 259 */ + void (*reserved258)(void); + void (*reserved259)(void); Tk_StyledElement (*tk_GetStyledElement) (Tk_Style style, Tcl_Size elementId, Tk_OptionTable optionTable); /* 260 */ void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */ void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */ @@ -1209,8 +1171,8 @@ typedef struct TkStubs { long (*tk_GetUserInactiveTime) (Display *dpy); /* 269 */ void (*tk_ResetUserInactiveTime) (Display *dpy); /* 270 */ Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */ - void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */ - void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */ + void (*reserved272)(void); + void (*reserved273)(void); int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */ unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */ int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */ @@ -1396,8 +1358,7 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_FreePixmap) /* 75 */ #define Tk_FreeTextLayout \ (tkStubsPtr->tk_FreeTextLayout) /* 76 */ -#define Tk_FreeXId \ - (tkStubsPtr->tk_FreeXId) /* 77 */ +/* Slot 77 is reserved */ #define Tk_GCForColor \ (tkStubsPtr->tk_GCForColor) /* 78 */ #define Tk_GeometryRequest \ @@ -1478,8 +1439,7 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_IdToWindow) /* 116 */ #define Tk_ImageChanged \ (tkStubsPtr->tk_ImageChanged) /* 117 */ -#define Tk_Init \ - (tkStubsPtr->tk_Init) /* 118 */ +/* Slot 118 is reserved */ #define Tk_InternAtom \ (tkStubsPtr->tk_InternAtom) /* 119 */ #define Tk_IntersectTextLayout \ @@ -1530,20 +1490,16 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_OwnSelection) /* 142 */ #define Tk_ParseArgv \ (tkStubsPtr->tk_ParseArgv) /* 143 */ -#define Tk_PhotoPutBlock_NoComposite \ - (tkStubsPtr->tk_PhotoPutBlock_NoComposite) /* 144 */ -#define Tk_PhotoPutZoomedBlock_NoComposite \ - (tkStubsPtr->tk_PhotoPutZoomedBlock_NoComposite) /* 145 */ +/* Slot 144 is reserved */ +/* Slot 145 is reserved */ #define Tk_PhotoGetImage \ (tkStubsPtr->tk_PhotoGetImage) /* 146 */ #define Tk_PhotoBlank \ (tkStubsPtr->tk_PhotoBlank) /* 147 */ -#define Tk_PhotoExpand_Panic \ - (tkStubsPtr->tk_PhotoExpand_Panic) /* 148 */ +/* Slot 148 is reserved */ #define Tk_PhotoGetSize \ (tkStubsPtr->tk_PhotoGetSize) /* 149 */ -#define Tk_PhotoSetSize_Panic \ - (tkStubsPtr->tk_PhotoSetSize_Panic) /* 150 */ +/* Slot 150 is reserved */ #define Tk_PointToChar \ (tkStubsPtr->tk_PointToChar) /* 151 */ #define Tk_PostscriptFontName \ @@ -1560,8 +1516,7 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_RestackWindow) /* 157 */ #define Tk_RestrictEvents \ (tkStubsPtr->tk_RestrictEvents) /* 158 */ -#define Tk_SafeInit \ - (tkStubsPtr->tk_SafeInit) /* 159 */ +/* Slot 159 is reserved */ #define Tk_SetAppName \ (tkStubsPtr->tk_SetAppName) /* 160 */ #define Tk_SetBackgroundFromBorder \ @@ -1666,16 +1621,14 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_GetScrollInfoObj) /* 210 */ #define Tk_InitOptions \ (tkStubsPtr->tk_InitOptions) /* 211 */ -#define Tk_MainEx \ - (tkStubsPtr->tk_MainEx) /* 212 */ +/* Slot 212 is reserved */ #define Tk_RestoreSavedOptions \ (tkStubsPtr->tk_RestoreSavedOptions) /* 213 */ #define Tk_SetOptions \ (tkStubsPtr->tk_SetOptions) /* 214 */ #define Tk_InitConsoleChannels \ (tkStubsPtr->tk_InitConsoleChannels) /* 215 */ -#define Tk_CreateConsoleWindow \ - (tkStubsPtr->tk_CreateConsoleWindow) /* 216 */ +/* Slot 216 is reserved */ #define Tk_CreateSmoothMethod \ (tkStubsPtr->tk_CreateSmoothMethod) /* 217 */ /* Slot 218 is reserved */ @@ -1732,10 +1685,8 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_SetMinimumRequestSize) /* 244 */ #define Tk_SetCaretPos \ (tkStubsPtr->tk_SetCaretPos) /* 245 */ -#define Tk_PhotoPutBlock_Panic \ - (tkStubsPtr->tk_PhotoPutBlock_Panic) /* 246 */ -#define Tk_PhotoPutZoomedBlock_Panic \ - (tkStubsPtr->tk_PhotoPutZoomedBlock_Panic) /* 247 */ +/* Slot 246 is reserved */ +/* Slot 247 is reserved */ #define Tk_CollapseMotionEvents \ (tkStubsPtr->tk_CollapseMotionEvents) /* 248 */ #define Tk_RegisterStyleEngine \ @@ -1756,10 +1707,8 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_NameOfStyle) /* 256 */ #define Tk_AllocStyleFromObj \ (tkStubsPtr->tk_AllocStyleFromObj) /* 257 */ -#define Tk_GetStyleFromObj \ - (tkStubsPtr->tk_GetStyleFromObj) /* 258 */ -#define Tk_FreeStyleFromObj \ - (tkStubsPtr->tk_FreeStyleFromObj) /* 259 */ +/* Slot 258 is reserved */ +/* Slot 259 is reserved */ #define Tk_GetStyledElement \ (tkStubsPtr->tk_GetStyledElement) /* 260 */ #define Tk_GetElementSize \ @@ -1784,10 +1733,8 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */ #define Tk_Interp \ (tkStubsPtr->tk_Interp) /* 271 */ -#define Tk_CreateOldImageType \ - (tkStubsPtr->tk_CreateOldImageType) /* 272 */ -#define Tk_CreateOldPhotoImageFormat \ - (tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */ +/* Slot 272 is reserved */ +/* Slot 273 is reserved */ #define Tk_AlwaysShowSelection \ (tkStubsPtr->tk_AlwaysShowSelection) /* 274 */ #define Tk_GetButtonMask \ @@ -1827,44 +1774,34 @@ extern const TkStubs *tkStubsPtr; /* !END!: Do not edit above this line. */ -/* Functions that don't belong in the stub table */ -#undef Tk_MainEx -#undef Tk_Init -#undef Tk_SafeInit -#undef Tk_CreateConsoleWindow - -#undef Tk_FreeXId -#define Tk_FreeXId(display,xid) -#undef Tk_GetStyleFromObj -#undef Tk_FreeStyleFromObj -#define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj) -#define Tk_FreeStyleFromObj(obj) /* no-op */ #define Tk_GetImageMasterData Tk_GetImageModelData #ifndef MAC_OSX_TK # undef Tk_ClipDrawableToRect #endif +EXTERN void Tk_MainEx(Tcl_Size argc, char **argv, + Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(Tcl_Size argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif +EXTERN int Tk_Init(Tcl_Interp *interp); +EXTERN int Tk_SafeInit(Tcl_Interp *interp); +EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp); - -#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 -#undef Tk_PhotoPutBlock_NoComposite -#undef Tk_PhotoPutZoomedBlock_NoComposite -#undef Tk_PhotoExpand_Panic -#undef Tk_PhotoPutBlock_Panic -#undef Tk_PhotoPutZoomedBlock_Panic -#undef Tk_PhotoSetSize_Panic -#undef Tk_CreateOldPhotoImageFormat -#endif /* TK_NO_DEPRECATED */ +#if TK_MAJOR_VERSION < 9 +/* Restore 8.x signature of Tk_ConfigureWidget, but panic if TK_CONFIG_OBJS flag is not set */ +#undef Tk_ConfigureWidget +#define Tk_ConfigureWidget(interp, tkwin, specs, argc, argv, widgRec, flags) \ + ((int (*)(Tcl_Interp *, Tk_Window, const Tk_ConfigSpec *, \ + int, const char **, char *, int))(void *)(tkStubsPtr->tk_ConfigureWidget)) \ + (((flags & TK_CONFIG_OBJS) ? interp : (Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory in Tk_ConfigureWidget"), \ + NULL)), tkwin, specs, argc, argv, widgRec, flags) +#endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#undef TkUnusedStubEntry - #endif /* _TKDECLS */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 2c150df..4a28a45 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2024,8 +2024,8 @@ EntryComputeGeometry( * resulting string. */ - TkUtfToUniChar(entryPtr->showChar, &ch); - size = TkUniCharToUtf(ch, buf); + Tcl_UtfToUniChar(entryPtr->showChar, &ch); + size = Tcl_UniCharToUtf(ch, buf); entryPtr->numDisplayBytes = entryPtr->numChars * size; p = (char *)ckalloc(entryPtr->numDisplayBytes + 1); @@ -2190,7 +2190,7 @@ InsertChars( char *newStr; string = entryPtr->string; - byteIndex = TkUtfAtIndex(string, index) - string; + byteIndex = Tcl_UtfAtIndex(string, index) - string; byteCount = strlen(value); if (byteCount == 0) { return TCL_OK; @@ -2223,7 +2223,7 @@ InsertChars( */ oldChars = entryPtr->numChars; - entryPtr->numChars = TkNumUtfChars(newStr, TCL_INDEX_NONE); + entryPtr->numChars = Tcl_NumUtfChars(newStr, TCL_INDEX_NONE); charsAdded = entryPtr->numChars - oldChars; entryPtr->numBytes += byteCount; @@ -2294,8 +2294,8 @@ DeleteChars( } string = entryPtr->string; - byteIndex = TkUtfAtIndex(string, index) - string; - byteCount = TkUtfAtIndex(string + byteIndex, count) - (string+byteIndex); + byteIndex = Tcl_UtfAtIndex(string, index) - string; + byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->numBytes + 1 - byteCount; newStr = (char *)ckalloc(newByteCount); @@ -2523,7 +2523,7 @@ EntrySetValue( entryPtr->string = tmp; } entryPtr->numBytes = valueLen; - entryPtr->numChars = TkNumUtfChars(value, valueLen); + entryPtr->numChars = Tcl_NumUtfChars(value, valueLen); if (entryPtr->displayString == oldSource) { entryPtr->displayString = entryPtr->string; @@ -2953,8 +2953,8 @@ EntryFetchSelection( return -1; } string = entryPtr->displayString; - selStart = TkUtfAtIndex(string, entryPtr->selectFirst); - selEnd = TkUtfAtIndex(selStart, + selStart = Tcl_UtfAtIndex(string, entryPtr->selectFirst); + selEnd = Tcl_UtfAtIndex(selStart, entryPtr->selectLast - entryPtr->selectFirst); if (selEnd <= selStart + offset) { return 0; @@ -3606,7 +3606,7 @@ ExpandPercents( before++; /* skip over % */ if (*before != '\0') { - before += TkUtfToUniChar(before, &ch); + before += Tcl_UtfToUniChar(before, &ch); } else { ch = '%'; } @@ -3626,7 +3626,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->tkwin); break; default: - length = TkUniCharToUtf(ch, numStorage); + length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; @@ -3686,7 +3686,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->tkwin); break; default: - length = TkUniCharToUtf(ch, numStorage); + length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; diff --git a/generic/tkEntry.h b/generic/tkEntry.h index 2f2ba34..72bffcf 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -81,7 +81,7 @@ typedef struct { Tk_3DBorder readonlyBorder; /* Used for drawing border around whole window * in readonly state, plus used for * background. */ - int borderWidth; /* Width of 3-D border around window. */ + Tcl_Obj *borderWidthObj; /* Width of 3-D border around window. */ Tk_Cursor cursor; /* Current cursor for window, or NULL. */ int exportSelection; /* Non-zero means tie internal entry selection * to X selection. */ @@ -91,23 +91,23 @@ typedef struct { XColor *highlightBgColorPtr;/* Color for drawing traversal highlight area * when highlight is off. */ XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ - int highlightWidth; /* Width in pixels of highlight to draw around + Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw around * widget when it has the focus. <= 0 means * don't draw a highlight. */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. */ - int insertBorderWidth; /* Width of 3-D border around insert cursor. */ + Tcl_Obj *insertBorderWidthObj; /* Width of 3-D border around insert cursor. */ int insertOffTime; /* Number of milliseconds cursor should spend * in "off" state for each blink. */ int insertOnTime; /* Number of milliseconds cursor should spend * in "on" state for each blink. */ - int insertWidth; /* Total width of insert cursor. */ + Tcl_Obj *insertWidthObj; /* Total width of insert cursor. */ Tk_Justify justify; /* Justification to use for text within * window. */ int relief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ Tk_3DBorder selBorder; /* Border and background for selected * characters. */ - int selBorderWidth; /* Width of border around selection. */ + Tcl_Obj *selBorderWidthObj; /* Width of border around selection. */ XColor *selFgColorPtr; /* Foreground color for selected text. */ int state; /* Normal or disabled. Entry is read-only when * disabled. */ @@ -186,11 +186,13 @@ typedef struct { * commands. Malloc'ed. */ char *invalidCmd; /* Command called when a validation returns 0 * (successfully fails), defaults to {}. */ - Tcl_Obj *borderWidthObj; - Tcl_Obj *highlightWidthObj; - Tcl_Obj *insertWidthObj; - Tcl_Obj *insertBorderWidthObj; - Tcl_Obj *selBorderWidthObj; +#ifdef BUILD_tk + int borderWidth; + int highlightWidth; + int insertWidth; + int insertBorderWidth; + int selBorderWidth; +#endif } Entry; /* diff --git a/generic/tkFont.c b/generic/tkFont.c index bb0b34f..35936c5 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -576,7 +576,7 @@ Tk_FontObjCmd( if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); - size_t len = TkUtfToUniChar(string, &uniChar); + size_t len = Tcl_UtfToUniChar(string, &uniChar); if (len != (size_t)charPtr->length) { resultPtr = Tcl_NewStringObj( @@ -633,7 +633,7 @@ Tk_FontObjCmd( } if ((namedHashPtr == NULL) || nfPtr->deletePending) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "named font \"%s\" doesn't exist", string)); + "named font \"%s\" does not exist", string)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", string, NULL); return TCL_ERROR; } @@ -887,17 +887,6 @@ TheWorldHasChanged( { TkFontInfo *fiPtr = (TkFontInfo *)clientData; - /* - * On macOS it is catastrophic to recompute all widgets while the - * [NSView drawRect] method is drawing. The best that we can do in - * that situation is to abort the recomputation and hope for the best. - * This is ignored on other platforms. - */ - - if (TkpWillDrawWidget(NULL)) { - return; - } - fiPtr->updatePending = 0; RecomputeWidgets(fiPtr->mainPtr->winPtr); } @@ -1039,7 +1028,7 @@ TkDeleteNamedFont( if (namedHashPtr == NULL) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "named font \"%s\" doesn't exist", name)); + "named font \"%s\" does not exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", name, NULL); } return TCL_ERROR; @@ -1744,14 +1733,14 @@ Tk_PostscriptFontName( src++; upper = 1; } - src += TkUtfToUniChar(src, &ch); + src += Tcl_UtfToUniChar(src, &ch); if (upper) { ch = Tcl_UniCharToUpper(ch); upper = 0; } else { ch = Tcl_UniCharToLower(ch); } - dest += TkUniCharToUtf(ch, dest); + dest += Tcl_UniCharToUtf(ch, dest); } *dest = '\0'; Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr)); @@ -2012,7 +2001,7 @@ Tk_ComputeTextLayout( height = fmPtr->ascent + fmPtr->descent; if (numChars < 0) { - numChars = TkNumUtfChars(string, TCL_INDEX_NONE); + numChars = Tcl_NumUtfChars(string, TCL_INDEX_NONE); } if (wrapLength == 0) { wrapLength = -1; @@ -2035,7 +2024,7 @@ Tk_ComputeTextLayout( curX = 0; - endp = TkUtfAtIndex(string, numChars); + endp = Tcl_UtfAtIndex(string, numChars); special = string; flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES; @@ -2152,7 +2141,7 @@ Tk_ComputeTextLayout( bytesThisChunk = Tk_MeasureChars(tkfont, end, bytesThisChunk, -1, 0, &chunkPtr->totalWidth); chunkPtr->numBytes += bytesThisChunk; - chunkPtr->numChars += TkNumUtfChars(end, bytesThisChunk); + chunkPtr->numChars += Tcl_NumUtfChars(end, bytesThisChunk); chunkPtr->totalWidth += curX; } } @@ -2344,14 +2333,14 @@ Tk_DrawTextLayout( firstChar = 0; firstByte = chunkPtr->start; } else { - firstByte = TkUtfAtIndex(chunkPtr->start, firstChar); + firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar); Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start, firstByte - chunkPtr->start, -1, 0, &drawX); } if (lastChar < numDisplayChars) { numDisplayChars = lastChar; } - lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars); + lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); #ifdef TK_DRAW_IN_CONTEXT TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes, @@ -2414,14 +2403,14 @@ TkDrawAngledTextLayout( firstChar = 0; firstByte = chunkPtr->start; } else { - firstByte = TkUtfAtIndex(chunkPtr->start, firstChar); + firstByte = Tcl_UtfAtIndex(chunkPtr->start, firstChar); Tk_MeasureChars(layoutPtr->tkfont, chunkPtr->start, firstByte - chunkPtr->start, -1, 0, &drawX); } if (lastChar < numDisplayChars) { numDisplayChars = lastChar; } - lastByte = TkUtfAtIndex(chunkPtr->start, numDisplayChars); + lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); #ifdef TK_DRAW_IN_CONTEXT dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y); dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y); @@ -2674,7 +2663,7 @@ Tk_PointToChar( } n = Tk_MeasureChars((Tk_Font) fontPtr, chunkPtr->start, chunkPtr->numBytes, x - chunkPtr->x, 0, &dummy); - return numChars + TkNumUtfChars(chunkPtr->start, n); + return numChars + Tcl_NumUtfChars(chunkPtr->start, n); } numChars += chunkPtr->numChars; lastPtr = chunkPtr; @@ -2783,7 +2772,7 @@ Tk_CharBbox( goto check; } } else if (index < chunkPtr->numChars) { - end = TkUtfAtIndex(chunkPtr->start, index); + end = Tcl_UtfAtIndex(chunkPtr->start, index); if (xPtr != NULL) { Tk_MeasureChars(tkfont, chunkPtr->start, end - chunkPtr->start, -1, 0, &x); @@ -2791,7 +2780,7 @@ Tk_CharBbox( } if (widthPtr != NULL) { int ch; - Tk_MeasureChars(tkfont, end, TkUtfToUniChar(end, &ch), -1, 0, &w); + Tk_MeasureChars(tkfont, end, Tcl_UtfToUniChar(end, &ch), -1, 0, &w); } goto check; } @@ -3215,8 +3204,8 @@ TkIntersectAngledTextLayout( PointInQuadrilateral(cx, cy, rx[1], ry[1]) && PointInQuadrilateral(cx, cy, rx[2], ry[2]) && PointInQuadrilateral(cx, cy, rx[3], ry[3])) { - return 0; - } + return 0; + } } /* @@ -3337,7 +3326,7 @@ Tk_TextLayoutToPostscript( * international postscript fonts. */ - p += TkUtfToUniChar(p, &ch); + p += Tcl_UtfToUniChar(p, &ch); if ((ch == '(') || (ch == ')') || (ch == '\\') || (ch < 0x20)) { /* * Tricky point: the "03" is necessary in the snprintf below, @@ -3754,7 +3743,7 @@ ParseFontNameObj( || (objc < 1)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "font \"%s\" doesn't exist", string)); + "font \"%s\" does not exist", string)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", string, NULL); } return TCL_ERROR; @@ -3858,7 +3847,7 @@ NewChunk( *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; } - numChars = TkNumUtfChars(start, numBytes); + numChars = Tcl_NumUtfChars(start, numBytes); chunkPtr = &layoutPtr->chunks[layoutPtr->numChunks]; chunkPtr->start = start; chunkPtr->numBytes = numBytes; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 1d93976..5521f38 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -43,7 +43,7 @@ typedef struct { * available for this widget. */ char *className; /* Class name for widget (from configuration * option). Malloc-ed. */ - enum FrameType type; /* Type of widget, such as TYPE_FRAME. */ + int type; /* Type of widget, such as TYPE_FRAME. */ char *screenName; /* Screen on which widget is created. Non-null * only for top-levels. Malloc-ed, may be * NULL. */ @@ -86,14 +86,12 @@ typedef struct { * windows this is NULL. */ int flags; /* Various flags; see below for * definitions. */ - Tcl_Obj *padXPtr; /* Value of -padx option: specifies how many + Tcl_Obj *padXObj; /* Value of -padx option: specifies how many * pixels of extra space to leave on left and * right of child area. */ - int padX; /* Integer value corresponding to padXPtr. */ - Tcl_Obj *padYPtr; /* Value of -padx option: specifies how many + Tcl_Obj *padYObj; /* Value of -padx option: specifies how many * pixels of extra space to leave above and * below child area. */ - int padY; /* Integer value corresponding to padYPtr. */ Tcl_Obj *bgimgPtr; /* Value of -backgroundimage option: specifies * image to display on window's background, or * NULL if none. */ @@ -101,9 +99,16 @@ typedef struct { * Tk_GetImage, or NULL if bgimgPtr is * NULL. */ int tile; /* Whether to tile the bgimg. */ + Tcl_Obj *heightObj; + Tcl_Obj *widthObj; + Tcl_Obj *highlightWidthObj; + Tcl_Obj *borderWidthObj; #ifndef TK_NO_DOUBLE_BUFFERING GC copyGC; /* GC for copying when double-buffering. */ #endif /* TK_NO_DOUBLE_BUFFERING */ +#ifdef BUILD_tk + int padX, padY; +#endif } Frame; /* @@ -201,7 +206,7 @@ static const Tk_OptionSpec commonOptSpec[] = { DEF_FRAME_CURSOR, TCL_INDEX_NONE, offsetof(Frame, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_FRAME_HEIGHT, TCL_INDEX_NONE, offsetof(Frame, height), 0, 0, 0}, + DEF_FRAME_HEIGHT, offsetof(Frame, heightObj), offsetof(Frame, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, TCL_INDEX_NONE, offsetof(Frame, highlightBgColorPtr), 0, 0, 0}, @@ -209,13 +214,13 @@ static const Tk_OptionSpec commonOptSpec[] = { DEF_FRAME_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Frame, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_FRAME_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, + "HighlightThickness", DEF_FRAME_HIGHLIGHT_WIDTH, offsetof(Frame, highlightWidthObj), offsetof(Frame, highlightWidth), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_FRAME_PADX, offsetof(Frame, padXPtr), + DEF_FRAME_PADX, offsetof(Frame, padXObj), offsetof(Frame, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_FRAME_PADY, offsetof(Frame, padYPtr), + DEF_FRAME_PADY, offsetof(Frame, padYObj), offsetof(Frame, padY), 0, 0, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_FRAME_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Frame, takeFocus), @@ -224,7 +229,7 @@ static const Tk_OptionSpec commonOptSpec[] = { DEF_FRAME_VISUAL, TCL_INDEX_NONE, offsetof(Frame, visualName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_FRAME_WIDTH, TCL_INDEX_NONE, offsetof(Frame, width), 0, 0, 0}, + DEF_FRAME_WIDTH, offsetof(Frame, widthObj), offsetof(Frame, width), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -237,7 +242,7 @@ static const Tk_OptionSpec frameOptSpec[] = { {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-backgroundimage", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_FRAME_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Frame, borderWidth), 0, 0, 0}, + DEF_FRAME_BORDER_WIDTH, offsetof(Frame, borderWidthObj), offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", DEF_FRAME_CLASS, TCL_INDEX_NONE, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", @@ -257,7 +262,7 @@ static const Tk_OptionSpec toplevelOptSpec[] = { {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-backgroundimage", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_FRAME_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Frame, borderWidth), 0, 0, 0}, + DEF_FRAME_BORDER_WIDTH, offsetof(Frame, borderWidthObj), offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", DEF_TOPLEVEL_CLASS, TCL_INDEX_NONE, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", @@ -281,7 +286,7 @@ static const Tk_OptionSpec labelframeOptSpec[] = { {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_LABELFRAME_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Frame, borderWidth), + DEF_LABELFRAME_BORDER_WIDTH, offsetof(Frame, borderWidthObj), offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", DEF_LABELFRAME_CLASS, TCL_INDEX_NONE, offsetof(Frame, className), 0, 0, 0}, @@ -329,9 +334,6 @@ static const Tk_OptionSpec *const optionSpecs[] = { static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, Tcl_Size objc, Tcl_Obj *const objv[]); -static int CreateFrame(void *clientData, Tcl_Interp *interp, - Tcl_Size objc, Tcl_Obj *const objv[], - enum FrameType type, const char *appName); static Tcl_FreeProc DestroyFrame; static void DestroyFramePartly(Frame *framePtr); static void DisplayFrame(void *clientData); @@ -403,7 +405,7 @@ Tk_FrameObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL); + return TkCreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL); } int @@ -413,7 +415,7 @@ Tk_ToplevelObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL); + return TkCreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL); } int @@ -423,7 +425,7 @@ Tk_LabelframeObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL); + return TkCreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL); } /* @@ -444,68 +446,13 @@ Tk_LabelframeObjCmd( * *-------------------------------------------------------------- */ - int TkCreateFrame( - void *clientData, /* Either NULL or pointer to option table. */ - Tcl_Interp *interp, /* Current interpreter. */ - Tcl_Size argc, /* Number of arguments. */ - const char *const *argv, /* Argument strings. */ - int toplevel, /* Non-zero means create a toplevel window, - * zero means create a frame. */ - const char *appName) /* Should only be non-NULL if there is no main - * window associated with the interpreter. - * Gives the base name to use for the new - * application. */ -{ - int result; - Tcl_Size i; - Tcl_Obj **objv = (Tcl_Obj **)ckalloc((argc+1) * sizeof(Tcl_Obj **)); - - for (i=0; i<argc; i++) { - objv[i] = Tcl_NewStringObj(argv[i], TCL_INDEX_NONE); - Tcl_IncrRefCount(objv[i]); - } - objv[argc] = NULL; - result = CreateFrame(clientData, interp, argc, objv, - toplevel ? TYPE_TOPLEVEL : TYPE_FRAME, appName); - for (i=0; i<argc; i++) { - Tcl_DecrRefCount(objv[i]); - } - ckfree(objv); - return result; -} - -int -TkListCreateFrame( - void *clientData, /* Either NULL or pointer to option table. */ - Tcl_Interp *interp, /* Current interpreter. */ - Tcl_Obj *listObj, /* List of arguments. */ - int toplevel, /* Non-zero means create a toplevel window, - * zero means create a frame. */ - Tcl_Obj *nameObj) /* Should only be non-NULL if there is no main - * window associated with the interpreter. - * Gives the base name to use for the new - * application. */ -{ - Tcl_Size objc; - Tcl_Obj **objv; - - if (TCL_OK != Tcl_ListObjGetElements(interp, listObj, &objc, &objv)) { - return TCL_ERROR; - } - return CreateFrame(clientData, interp, objc, objv, - toplevel ? TYPE_TOPLEVEL : TYPE_FRAME, - nameObj ? Tcl_GetString(nameObj) : NULL); -} - -static int -CreateFrame( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ - enum FrameType type, /* What widget type to create. */ + int type, /* What widget type to create. */ const char *appName) /* Should only be non-NULL if there are no * Main window associated with the * interpreter. Gives the base name to use for @@ -1053,12 +1000,21 @@ ConfigureFrame( if (framePtr->highlightWidth < 0) { framePtr->highlightWidth = 0; + Tcl_DecrRefCount(framePtr->highlightWidthObj); + framePtr->highlightWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(framePtr->highlightWidthObj); } if (framePtr->padX < 0) { framePtr->padX = 0; + Tcl_DecrRefCount(framePtr->padXObj); + framePtr->padXObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(framePtr->padXObj); } if (framePtr->padY < 0) { framePtr->padY = 0; + Tcl_DecrRefCount(framePtr->padYObj); + framePtr->padYObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(framePtr->padYObj); } /* @@ -1536,6 +1492,8 @@ DisplayFrame( Tk_Depth(tkwin)); #else pixmap = Tk_WindowId(tkwin); + Tk_ClipDrawableToRect(Tk_Display(tkwin), pixmap, 0, 0, + Tk_Width(tkwin), Tk_Height(tkwin)); #endif /* TK_NO_DOUBLE_BUFFERING */ if (framePtr->type != TYPE_LABELFRAME) { diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 5a25dea..5b7cbde 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -781,12 +781,12 @@ TkPointerEvent( if ((eventPtr->type == MotionNotify) && !appGrabbed) { - /* - * Warp the mouse pointer with respect to window dispPtr->warpWindow - * if such a window was set in HandleEventGenerate. - */ + /* + * Warp the mouse pointer with respect to window dispPtr->warpWindow + * if such a window was set in HandleEventGenerate. + */ - TkDoWarpWrtWin(dispPtr); + TkDoWarpWrtWin(dispPtr); } if (!appGrabbed) { @@ -820,12 +820,12 @@ TkPointerEvent( return 0; } - /* - * Warp the mouse pointer with respect to window dispPtr->warpWindow - * if such a window was set in HandleEventGenerate. - */ + /* + * Warp the mouse pointer with respect to window dispPtr->warpWindow + * if such a window was set in HandleEventGenerate. + */ - TkDoWarpWrtWin(dispPtr); + TkDoWarpWrtWin(dispPtr); return 1; } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 50068b5..1f892a9 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -3341,9 +3341,9 @@ ConfigureContent( } if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) { - if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { - Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); - } + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); + } Unlink(contentPtr); contentPtr->containerPtr = NULL; } @@ -3385,7 +3385,7 @@ ConfigureContent( if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", - Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); + Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); Unlink(contentPtr); return TCL_ERROR; diff --git a/generic/tkIcu.c b/generic/tkIcu.c index 503c98d..84c78d5 100644 --- a/generic/tkIcu.c +++ b/generic/tkIcu.c @@ -92,7 +92,7 @@ startEndOfCmd( str = Tcl_GetStringFromObj(objv[1], &len); Tcl_UtfToChar16DString(str, len, &ds); len = Tcl_DStringLength(&ds)/2; - Tcl_Size ulen = TkGetCharLength(objv[1]); + Tcl_Size ulen = Tcl_GetCharLength(objv[1]); if (TkGetIntForIndex(objv[2], ulen-1, 0, &idx) != TCL_OK) { Tcl_DStringFree(&ds); Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", Tcl_GetString(objv[2]))); diff --git a/generic/tkImage.c b/generic/tkImage.c index 701c765..9512cb9 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -131,7 +131,7 @@ ImageTypeThreadExitProc( /* *---------------------------------------------------------------------- * - * Tk_CreateOldImageType, Tk_CreateImageType -- + * Tk_CreateImageType -- * * This function is invoked by an image manager to tell Tk about a new * kind of image and the functions that manage the new type. The function @@ -148,27 +148,6 @@ ImageTypeThreadExitProc( */ void -Tk_CreateOldImageType( - const Tk_ImageType *typePtr) - /* Structure describing the type. All of the - * fields except "nextPtr" must be filled in - * by caller. */ -{ - Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - - if (!tsdPtr->initialized) { - tsdPtr->initialized = 1; - Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); - } - copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); - *copyPtr = *typePtr; - copyPtr->nextPtr = tsdPtr->oldImageTypeList; - tsdPtr->oldImageTypeList = copyPtr; -} - -void Tk_CreateImageType( const Tk_ImageType *typePtr) /* Structure describing the type. All of the @@ -279,7 +258,7 @@ Tk_ImageObjCmd( } if (typePtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "image type \"%s\" doesn't exist", arg)); + "image type \"%s\" does not exist", arg)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "IMAGE_TYPE", arg, (char *)NULL); return TCL_ERROR; } @@ -510,7 +489,7 @@ Tk_ImageObjCmd( return TCL_OK; alreadyDeleted: - Tcl_SetObjResult(interp, Tcl_ObjPrintf("image \"%s\" doesn't exist",arg)); + Tcl_SetObjResult(interp, Tcl_ObjPrintf("image \"%s\" does not exist",arg)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "IMAGE", arg, (char *)NULL); return TCL_ERROR; } @@ -656,7 +635,7 @@ Tk_GetImage( noSuchImage: if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "image \"%s\" doesn't exist", name)); + "image \"%s\" does not exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "IMAGE", name, (char *)NULL); } return NULL; diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index d0ec875..2a40003 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -240,7 +240,7 @@ ImgBmapConfigureModel( int maskWidth, maskHeight, dummy1, dummy2; if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp), - configSpecs, objc, (const char **) objv, (char *) modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + configSpecs, objc, objv, modelPtr, flags) != TCL_OK) { return TCL_ERROR; } @@ -269,7 +269,7 @@ ImgBmapConfigureModel( || (modelPtr->maskDataString != NULL)) { if (modelPtr->data == NULL) { Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( - "cannot have mask without bitmap", TCL_INDEX_NONE)); + "cannot have a mask without a bitmap", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "NO_BITMAP", NULL); return TCL_ERROR; diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 6e169fe..193c54f 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -929,11 +929,11 @@ ReadOneByte( { unsigned char buf[2]; if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) { - /* - * Premature end of image. - */ + /* + * Premature end of image. + */ - Tcl_SetObjResult(interp, Tcl_NewStringObj( + Tcl_SetObjResult(interp, Tcl_NewStringObj( "premature end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "PREMATURE_END", NULL); return -1; @@ -1218,7 +1218,7 @@ DoExtension( break; case 0xfe: /* Comment Extension */ strcpy(extensionStreamName,"comment"); - /* copy the extension data below */ + /* copy the extension data below */ break; } /* Add extension to dict */ @@ -1468,24 +1468,24 @@ ReadImage( } firstCode = append[code]; - /* - * Push the head of the code onto the stack. - */ + /* + * Push the head of the code onto the stack. + */ - *top++ = firstCode; + *top++ = firstCode; - if (maxCode < (1 << MAX_LWZ_BITS)) { + if (maxCode < (1 << MAX_LWZ_BITS)) { /* * If there's still room in our codes table, add a new entry. * Otherwise don't, and keep using the current table. - * See DEFERRED CLEAR CODE IN LZW COMPRESSION in the GIF89a - * specification. + * See DEFERRED CLEAR CODE IN LZW COMPRESSION in the GIF89a + * specification. */ prefix[maxCode] = oldCode; append[maxCode] = firstCode; maxCode++; - } + } /* * maxCode tells us the maximum code value we can accept. If @@ -1867,7 +1867,7 @@ Fread( Tcl_Channel chan) { if (hunk < 0 || count < 0) { - return -1; + return -1; } if (gifConfPtr->fromData == INLINE_DATA_BASE64) { diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index d2a674d..9d2fbea 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -40,7 +40,7 @@ */ #define TK_PHOTO_ALLOC_FAILURE_MESSAGE \ - "not enough free memory for image buffer" + "not enough free memory for image buffer" /* @@ -87,11 +87,11 @@ static const char *const colorFormatNames[] = { struct FormatOptions { int options; /* Individual bits indicate which options were - * specified - see below. */ + * specified - see below. */ Tcl_Obj *formatName; /* Name specified without an option. */ enum ColorFormatType colorFormat; - /* The color format type given with the - * -colorformat option */ + /* The color format type given with the + * -colorformat option */ }; /* @@ -121,34 +121,34 @@ static const char *const formatOptionNames[] = { */ static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions, - Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size *indexPtr, - struct FormatOptions *optPtr); + Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size *indexPtr, + struct FormatOptions *optPtr); static Tcl_Obj *GetBadOptMsg(const char *badValue, int allowedOpts); static int StringMatchDef(Tcl_Obj *data, Tcl_Obj *formatString, - int *widthPtr, int *heightPtr, Tcl_Interp *interp); + int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int StringReadDef(Tcl_Interp *interp, Tcl_Obj *data, - Tcl_Obj *formatString, Tk_PhotoHandle imageHandle, - int destX, int destY, int width, int height, - int srcX, int srcY); + Tcl_Obj *formatString, Tk_PhotoHandle imageHandle, + int destX, int destY, int width, int height, + int srcX, int srcY); static int StringWriteDef(Tcl_Interp *interp, - Tcl_Obj *formatString, - Tk_PhotoImageBlock *blockPtr); + Tcl_Obj *formatString, + Tk_PhotoImageBlock *blockPtr); static int ParseColor(Tcl_Interp *interp, Tcl_Obj *specObj, - Display *display, Colormap colormap, unsigned char *redPtr, - unsigned char *greenPtr, unsigned char *bluePtr, - unsigned char *alphaPtr); + Display *display, Colormap colormap, unsigned char *redPtr, + unsigned char *greenPtr, unsigned char *bluePtr, + unsigned char *alphaPtr); static int ParseColorAsList(const char *colorString, unsigned char *redPtr, - unsigned char *greenPtr, unsigned char *bluePtr, - unsigned char *alphaPtr); + unsigned char *greenPtr, unsigned char *bluePtr, + unsigned char *alphaPtr); static int ParseColorAsHex(Tcl_Interp *interp, const char *colorString, - int colorStrLen, Display *display, Colormap colormap, - unsigned char *redPtr, unsigned char *greenPtr, - unsigned char *bluePtr, unsigned char *alphaPtr); + int colorStrLen, Display *display, Colormap colormap, + unsigned char *redPtr, unsigned char *greenPtr, + unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsStandard(Tcl_Interp *interp, - const char *colorString, int colorStrLen, - Display *display, Colormap colormap, - unsigned char *redPtr, unsigned char *greenPtr, - unsigned char *bluePtr, unsigned char *alphaPtr); + const char *colorString, int colorStrLen, + Display *display, Colormap colormap, + unsigned char *redPtr, unsigned char *greenPtr, + unsigned char *bluePtr, unsigned char *alphaPtr); /* * The format record for the default image handler @@ -189,14 +189,14 @@ static int ParseFormatOptions( Tcl_Interp *interp, /* For error messages */ int allowedOptions, /* Bitfield specifying which options are - * to be considered allowed */ + * to be considered allowed */ Tcl_Size objc, /* Number of elements in argv[] */ Tcl_Obj *const objv[], /* The arguments to parse */ Tcl_Size *indexPtr, /* Index giving the first element to - * parse. The value is updated to the - * index where parsing ended */ + * parse. The value is updated to the + * index where parsing ended */ struct FormatOptions *optPtr) /* Parsed option values are written to - * this struct */ + * this struct */ { Tcl_Size optIndex, index; @@ -212,76 +212,76 @@ ParseFormatOptions( optPtr->formatName = NULL; optPtr->colorFormat = COLORFORMAT_RGB2; for (index = *indexPtr; index < objc; *indexPtr = ++index) { - int optionExists; - - /* - * The first value can be the format handler's name. It goes to - * optPtr->name. - */ - option = Tcl_GetString(objv[index]); - if (option[0] != '-') { - if (first) { - optPtr->formatName = objv[index]; - first = 0; - continue; - } else { - break; - } - } - first = 0; - - /* - * Check if option is known and allowed - */ - - optionExists = 1; - if (Tcl_GetIndexFromObj(NULL, objv[index], formatOptionNames, - "format option", 0, &optIndex) != TCL_OK) { - optionExists = 0; - } - if (!optionExists || !((1 << optIndex) & allowedOptions)) { - Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[index]), - allowedOptions)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); - return TCL_ERROR; - } - - /* - * Option-specific checks - */ - - switch (1 << optIndex) { - case OPT_COLORFORMAT: - *indexPtr = ++index; - if (index >= objc) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " - "requires a value", Tcl_GetString(objv[index - 1]))); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "MISSING_VALUE", NULL); - return TCL_ERROR; - } - if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", - TCL_EXACT, &typeIndex) != TCL_OK - || (typeIndex != COLORFORMAT_LIST - && typeIndex != COLORFORMAT_RGB2 - && typeIndex != COLORFORMAT_RGBA2) ) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format " - "\"%s\": must be rgb, rgba, or list", - Tcl_GetString(objv[index]))); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "BAD_COLOR_FORMAT", NULL); - return TCL_ERROR; - } - optPtr->colorFormat = (enum ColorFormatType)typeIndex; - break; - default: - Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough"); - } - - /* - * Add option to bitfield in optPtr - */ - optPtr->options |= (1 << optIndex); + int optionExists; + + /* + * The first value can be the format handler's name. It goes to + * optPtr->name. + */ + option = Tcl_GetString(objv[index]); + if (option[0] != '-') { + if (first) { + optPtr->formatName = objv[index]; + first = 0; + continue; + } else { + break; + } + } + first = 0; + + /* + * Check if option is known and allowed + */ + + optionExists = 1; + if (Tcl_GetIndexFromObj(NULL, objv[index], formatOptionNames, + "format option", 0, &optIndex) != TCL_OK) { + optionExists = 0; + } + if (!optionExists || !((1 << optIndex) & allowedOptions)) { + Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[index]), + allowedOptions)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); + return TCL_ERROR; + } + + /* + * Option-specific checks + */ + + switch (1 << optIndex) { + case OPT_COLORFORMAT: + *indexPtr = ++index; + if (index >= objc) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " + "requires a value", Tcl_GetString(objv[index - 1]))); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "MISSING_VALUE", NULL); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", + TCL_EXACT, &typeIndex) != TCL_OK + || (typeIndex != COLORFORMAT_LIST + && typeIndex != COLORFORMAT_RGB2 + && typeIndex != COLORFORMAT_RGBA2) ) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format " + "\"%s\": must be rgb, rgba, or list", + Tcl_GetString(objv[index]))); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "BAD_COLOR_FORMAT", NULL); + return TCL_ERROR; + } + optPtr->colorFormat = (enum ColorFormatType)typeIndex; + break; + default: + Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough"); + } + + /* + * Add option to bitfield in optPtr + */ + optPtr->options |= (1 << optIndex); } return TCL_OK; @@ -311,29 +311,29 @@ GetBadOptMsg( Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue); if (allowedOpts == 0) { - Tcl_AppendToObj(resObj, "no options allowed", TCL_INDEX_NONE); + Tcl_AppendToObj(resObj, "no options allowed", TCL_INDEX_NONE); } else { - Tcl_AppendToObj(resObj, "must be ", TCL_INDEX_NONE); - bit = 1; - for (i = 0; formatOptionNames[i] != NULL; i++) { - if (allowedOpts & bit) { - if (allowedOpts & (bit -1)) { - /* - * not the first option - */ - if (allowedOpts & ~((bit << 1) - 1)) { - /* - * not the last option - */ - Tcl_AppendToObj(resObj, ", ", TCL_INDEX_NONE); - } else { - Tcl_AppendToObj(resObj, ", or ", TCL_INDEX_NONE); - } - } - Tcl_AppendToObj(resObj, formatOptionNames[i], TCL_INDEX_NONE); - } - bit <<=1; - } + Tcl_AppendToObj(resObj, "must be ", TCL_INDEX_NONE); + bit = 1; + for (i = 0; formatOptionNames[i] != NULL; i++) { + if (allowedOpts & bit) { + if (allowedOpts & (bit -1)) { + /* + * not the first option + */ + if (allowedOpts & ~((bit << 1) - 1)) { + /* + * not the last option + */ + Tcl_AppendToObj(resObj, ", ", TCL_INDEX_NONE); + } else { + Tcl_AppendToObj(resObj, ", or ", TCL_INDEX_NONE); + } + } + Tcl_AppendToObj(resObj, formatOptionNames[i], TCL_INDEX_NONE); + } + bit <<=1; + } } return resObj; } @@ -377,34 +377,34 @@ StringMatchDef( */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) - != TCL_OK) { - return 0; + != TCL_OK) { + return 0; } if (rowCount == 0) { - /* - * empty list is valid data - */ + /* + * empty list is valid data + */ - *widthPtr = 0; - *heightPtr = 0; - return 1; + *widthPtr = 0; + *heightPtr = 0; + return 1; } colCount = -1; for (y = 0; y < rowCount; y++) { - if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { - return 0; - } - if (colCount < 0) { - colCount = curColCount; - } else if (curColCount != colCount) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %" TCL_SIZE_MODIFIER "d: " - "all rows must have the same number of elements", y)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_DATA", NULL); - } - return 0; - } + if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { + return 0; + } + if (colCount < 0) { + colCount = curColCount; + } else if (curColCount != colCount) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %" TCL_SIZE_MODIFIER "d: " + "all rows must have the same number of elements", y)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_DATA", NULL); + } + return 0; + } } /* @@ -413,16 +413,16 @@ StringMatchDef( * pixel for validity. */ if (Tcl_ListObjIndex(interp, rowListPtr[0], 0, &pixelData) != TCL_OK) { - return 0; + return 0; } (void)Tcl_GetString(pixelData); if (pixelData->length > TK_PHOTO_MAX_COLOR_LENGTH) { - return 0; + return 0; } if (ParseColor(interp, pixelData, Tk_Display(Tk_MainWindow(interp)), - Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy) - != TCL_OK) { - return 0; + Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy) + != TCL_OK) { + return 0; } /* @@ -464,10 +464,10 @@ StringReadDef( Tcl_Obj *formatString, /* value of the -format option */ Tk_PhotoHandle imageHandle, /* write data to this image */ int destX, int destY, /* start writing data at this point - * in destination image*/ + * in destination image*/ int width, int height, /* dimensions of area to write to */ int srcX, int srcY) /* start reading source data at these - * coordinates */ + * coordinates */ { Tcl_Obj **rowListPtr, **colListPtr; Tcl_Obj **objv; @@ -488,21 +488,21 @@ StringReadDef( memset(&opts, 0, sizeof(opts)); if (formatString != NULL) { - if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) - != TCL_OK) { - return TCL_ERROR; - } - optIndex = 0; - if (ParseFormatOptions(interp, 0, objc, objv, &optIndex, &opts) - != TCL_OK) { - return TCL_ERROR; - } - if (optIndex < objc) { - Tcl_SetObjResult(interp, - GetBadOptMsg(Tcl_GetString(objv[optIndex]), 0)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); - return TCL_ERROR; - } + if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) + != TCL_OK) { + return TCL_ERROR; + } + optIndex = 0; + if (ParseFormatOptions(interp, 0, objc, objv, &optIndex, &opts) + != TCL_OK) { + return TCL_ERROR; + } + if (optIndex < objc) { + Tcl_SetObjResult(interp, + GetBadOptMsg(Tcl_GetString(objv[optIndex]), 0)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); + return TCL_ERROR; + } } /* @@ -510,24 +510,24 @@ StringReadDef( */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) - != TCL_OK ) { - return TCL_ERROR; + != TCL_OK ) { + return TCL_ERROR; } if ( rowCount > 0 && Tcl_ListObjLength(interp, rowListPtr[0], &colCount) - != TCL_OK) { - return TCL_ERROR; + != TCL_OK) { + return TCL_ERROR; } if (width <= 0 || height <= 0 || rowCount == 0 || colCount == 0) { - /* - * No changes with zero sized input or zero sized output region - */ + /* + * No changes with zero sized input or zero sized output region + */ - return TCL_OK; + return TCL_OK; } if (srcX < 0 || srcY < 0 || srcX >= rowCount || srcY >= colCount) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("source coordinates out of range")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf("source coordinates out of range")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); + return TCL_ERROR; } /* @@ -536,11 +536,11 @@ StringReadDef( */ if (colCount > (int)(UINT_MAX / 4 / rowCount)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "photo image dimensions exceed Tcl memory limits")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "OVERFLOW", NULL); - return TCL_OK; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "photo image dimensions exceed Tcl memory limits")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "OVERFLOW", NULL); + return TCL_OK; } /* @@ -557,39 +557,39 @@ StringReadDef( srcBlock.offset[3] = 3; srcBlock.pixelPtr = (unsigned char *)attemptckalloc(srcBlock.pitch * srcBlock.height); if (srcBlock.pixelPtr == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE)); + Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + return TCL_ERROR; } curPixelPtr = srcBlock.pixelPtr; display = Tk_Display(Tk_MainWindow(interp)); colormap = Tk_Colormap(Tk_MainWindow(interp)); for (y = srcY; y < rowCount; y++) { - /* - * We don't test the length of row, as that's been done in - * ImgStringMatch() - */ - - if (Tcl_ListObjGetElements(interp, rowListPtr[y], &curColCount, - &colListPtr) != TCL_OK) { - goto errorExit; - } - for (x = srcX; x < colCount; x++) { - if (ParseColor(interp, colListPtr[x], display, colormap, - curPixelPtr, curPixelPtr + 1, curPixelPtr + 2, - curPixelPtr + 3) != TCL_OK) { - goto errorExit; - } - curPixelPtr += 4; - } + /* + * We don't test the length of row, as that's been done in + * ImgStringMatch() + */ + + if (Tcl_ListObjGetElements(interp, rowListPtr[y], &curColCount, + &colListPtr) != TCL_OK) { + goto errorExit; + } + for (x = srcX; x < colCount; x++) { + if (ParseColor(interp, colListPtr[x], display, colormap, + curPixelPtr, curPixelPtr + 1, curPixelPtr + 2, + curPixelPtr + 3) != TCL_OK) { + goto errorExit; + } + curPixelPtr += 4; + } } /* * Write image data to destHandle */ if (Tk_PhotoPutBlock(interp, imageHandle, &srcBlock, destX, destY, - width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { - goto errorExit; + width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { + goto errorExit; } ckfree(srcBlock.pixelPtr); @@ -635,20 +635,20 @@ StringWriteDef( * Parse format suboptions */ if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) - != TCL_OK) { - return TCL_ERROR; + != TCL_OK) { + return TCL_ERROR; } allowedOpts = OPT_COLORFORMAT; optIndex = 0; if (ParseFormatOptions(interp, allowedOpts, objc, objv, &optIndex, &opts) - != TCL_OK) { - return TCL_ERROR; + != TCL_OK) { + return TCL_ERROR; } if (optIndex < objc) { - Tcl_SetObjResult(interp, - GetBadOptMsg(Tcl_GetString(objv[optIndex]), allowedOpts)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, + GetBadOptMsg(Tcl_GetString(objv[optIndex]), allowedOpts)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); + return TCL_ERROR; } greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; @@ -660,84 +660,84 @@ StringWriteDef( */ if (blockPtr->offset[3] < 0) { - hasAlpha = 0; - alphaOffset = 0; + hasAlpha = 0; + alphaOffset = 0; } else { - hasAlpha = 1; - alphaOffset = blockPtr->offset[3] - blockPtr->offset[0]; + hasAlpha = 1; + alphaOffset = blockPtr->offset[3] - blockPtr->offset[0]; } if ((blockPtr->width > 0) && (blockPtr->height > 0)) { - int row, col; - Tcl_DString data, line; - char colorBuf[11]; - unsigned char *pixelPtr; - unsigned char alphaVal = 255; - - Tcl_DStringInit(&data); - for (row=0; row<blockPtr->height; row++) { - pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0] - + row * blockPtr->pitch; - Tcl_DStringInit(&line); - for (col=0; col<blockPtr->width; col++) { - if (hasAlpha) { - alphaVal = pixelPtr[alphaOffset]; - } - - /* - * We don't build lines as a list for #RGBA and #RGB. Since - * these color formats look like comments, the first element - * of the list would get quoted with an additional {} . - * While this is not a problem if the data is used as - * a list, it would cause problems if someone decides to parse - * it as a string (and it looks kinda strange) - */ - - switch (opts.colorFormat) { - case COLORFORMAT_RGB2: - snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x ", pixelPtr[0], - pixelPtr[greenOffset], pixelPtr[blueOffset]); - Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); - break; - case COLORFORMAT_RGBA2: - snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x%02x ", - pixelPtr[0], pixelPtr[greenOffset], - pixelPtr[blueOffset], alphaVal); - Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); - break; - case COLORFORMAT_LIST: - Tcl_DStringStartSublist(&line); - snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[0]); - Tcl_DStringAppendElement(&line, colorBuf); - snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[greenOffset]); - Tcl_DStringAppendElement(&line, colorBuf); - snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[blueOffset]); - Tcl_DStringAppendElement(&line, colorBuf); - snprintf(colorBuf, sizeof(colorBuf), "%d", alphaVal); - Tcl_DStringAppendElement(&line, colorBuf); - Tcl_DStringEndSublist(&line); - break; - default: - Tcl_Panic("unexpected switch fallthrough"); - } - pixelPtr += blockPtr->pixelSize; - } - if (opts.colorFormat != COLORFORMAT_LIST) { - /* - * For the #XXX formats, we need to remove the last - * whitespace. - */ - - *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1) - = '\0'; - } - Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); - Tcl_DStringFree(&line); - } - result = Tcl_NewStringObj(Tcl_DStringValue(&data), TCL_INDEX_NONE); - Tcl_DStringFree(&data); + int row, col; + Tcl_DString data, line; + char colorBuf[11]; + unsigned char *pixelPtr; + unsigned char alphaVal = 255; + + Tcl_DStringInit(&data); + for (row=0; row<blockPtr->height; row++) { + pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0] + + row * blockPtr->pitch; + Tcl_DStringInit(&line); + for (col=0; col<blockPtr->width; col++) { + if (hasAlpha) { + alphaVal = pixelPtr[alphaOffset]; + } + + /* + * We don't build lines as a list for #RGBA and #RGB. Since + * these color formats look like comments, the first element + * of the list would get quoted with an additional {} . + * While this is not a problem if the data is used as + * a list, it would cause problems if someone decides to parse + * it as a string (and it looks kinda strange) + */ + + switch (opts.colorFormat) { + case COLORFORMAT_RGB2: + snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x ", pixelPtr[0], + pixelPtr[greenOffset], pixelPtr[blueOffset]); + Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); + break; + case COLORFORMAT_RGBA2: + snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x%02x ", + pixelPtr[0], pixelPtr[greenOffset], + pixelPtr[blueOffset], alphaVal); + Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); + break; + case COLORFORMAT_LIST: + Tcl_DStringStartSublist(&line); + snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[0]); + Tcl_DStringAppendElement(&line, colorBuf); + snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[greenOffset]); + Tcl_DStringAppendElement(&line, colorBuf); + snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[blueOffset]); + Tcl_DStringAppendElement(&line, colorBuf); + snprintf(colorBuf, sizeof(colorBuf), "%d", alphaVal); + Tcl_DStringAppendElement(&line, colorBuf); + Tcl_DStringEndSublist(&line); + break; + default: + Tcl_Panic("unexpected switch fallthrough"); + } + pixelPtr += blockPtr->pixelSize; + } + if (opts.colorFormat != COLORFORMAT_LIST) { + /* + * For the #XXX formats, we need to remove the last + * whitespace. + */ + + *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1) + = '\0'; + } + Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); + Tcl_DStringFree(&line); + } + result = Tcl_NewStringObj(Tcl_DStringValue(&data), TCL_INDEX_NONE); + Tcl_DStringFree(&data); } else { - result = Tcl_NewObj(); + result = Tcl_NewObj(); } Tcl_SetObjResult(interp, result); @@ -770,7 +770,7 @@ ParseColor( Tcl_Interp *interp, /* error messages go there */ Tcl_Obj *specObj, /* the color data to parse */ Display *display, /* display of main window, needed to parse - * standard Tk colors */ + * standard Tk colors */ Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, @@ -787,23 +787,23 @@ ParseColor( specString = Tcl_GetStringFromObj(specObj, &length); if (length == 0) { - /* Empty string */ - *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0; - return TCL_OK; + /* Empty string */ + *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0; + return TCL_OK; } if (length > TK_PHOTO_MAX_COLOR_LENGTH) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", NULL); + return TCL_ERROR; } if (specString[0] == '#') { - return ParseColorAsHex(interp, specString, length, display, - colormap, redPtr, greenPtr, bluePtr, alphaPtr); + return ParseColorAsHex(interp, specString, length, display, + colormap, redPtr, greenPtr, bluePtr, alphaPtr); } if (ParseColorAsList(specString, - redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { - return TCL_OK; + redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { + return TCL_OK; } /* @@ -813,7 +813,7 @@ ParseColor( Tcl_ResetResult(interp); return ParseColorAsStandard(interp, specString, length, display, - colormap, redPtr, greenPtr, bluePtr, alphaPtr); + colormap, redPtr, greenPtr, bluePtr, alphaPtr); } @@ -863,24 +863,24 @@ ParseColorAsList( */ while(isspace(UCHAR(*curPos))) { - ++curPos; + ++curPos; } while (i < 4 && *curPos != '\0') { - values[i] = strtol(curPos, (char **)&curPos, 0); - if (values[i] < 0 || values[i] > 255) { - return TCL_ERROR; - } - while(isspace(UCHAR(*curPos))) { - ++curPos; - } - ++i; + values[i] = strtol(curPos, (char **)&curPos, 0); + if (values[i] < 0 || values[i] > 255) { + return TCL_ERROR; + } + while(isspace(UCHAR(*curPos))) { + ++curPos; + } + ++i; } if (i < 3 || *curPos != '\0') { - return TCL_ERROR; + return TCL_ERROR; } if (i < 4) { - values[3] = 255; + values[3] = 255; } *redPtr = (unsigned char) values[0]; @@ -927,39 +927,39 @@ ParseColorAsHex( unsigned long int colorValue = 0; if (colorStrLen - 1 != 4 && colorStrLen - 1 != 8) { - return ParseColorAsStandard(interp, colorString, colorStrLen, - display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); + return ParseColorAsStandard(interp, colorString, colorStrLen, + display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } for (i = 1; i < colorStrLen; i++) { - if (!isxdigit(UCHAR(colorString[i]))) { - /* - * There still is a chance that this is a Tk color with - * an alpha suffix - */ - - return ParseColorAsStandard(interp, colorString, colorStrLen, - display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); - } + if (!isxdigit(UCHAR(colorString[i]))) { + /* + * There still is a chance that this is a Tk color with + * an alpha suffix + */ + + return ParseColorAsStandard(interp, colorString, colorStrLen, + display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); + } } colorValue = strtoul(colorString + 1, NULL, 16); switch (colorStrLen - 1) { case 4: - /* #RGBA format */ - *redPtr = (unsigned char) ((colorValue >> 12) * 0x11); - *greenPtr = (unsigned char) (((colorValue >> 8) & 0xf) * 0x11); - *bluePtr = (unsigned char) (((colorValue >> 4) & 0xf) * 0x11); - *alphaPtr = (unsigned char) ((colorValue & 0xf) * 0x11); - return TCL_OK; + /* #RGBA format */ + *redPtr = (unsigned char) ((colorValue >> 12) * 0x11); + *greenPtr = (unsigned char) (((colorValue >> 8) & 0xf) * 0x11); + *bluePtr = (unsigned char) (((colorValue >> 4) & 0xf) * 0x11); + *alphaPtr = (unsigned char) ((colorValue & 0xf) * 0x11); + return TCL_OK; case 8: - /* #RRGGBBAA format */ - *redPtr = (unsigned char) (colorValue >> 24); - *greenPtr = (unsigned char) ((colorValue >> 16) & 0xff); - *bluePtr = (unsigned char) ((colorValue >> 8) & 0xff); - *alphaPtr = (unsigned char) (colorValue & 0xff); - return TCL_OK; + /* #RRGGBBAA format */ + *redPtr = (unsigned char) (colorValue >> 24); + *greenPtr = (unsigned char) ((colorValue >> 16) & 0xff); + *bluePtr = (unsigned char) ((colorValue >> 8) & 0xff); + *alphaPtr = (unsigned char) (colorValue & 0xff); + return TCL_OK; default: - Tcl_Panic("unexpected switch fallthrough"); + Tcl_Panic("unexpected switch fallthrough"); } /* Shouldn't get here */ @@ -1010,14 +1010,14 @@ ParseColorAsStandard( */ if ((suffixString = strrchr(specString, '@')) == NULL - && ((suffixString = strrchr(specString, '#')) == NULL - || suffixString == specString)) { - suffixString = specString + specStrLen; - colorString = specString; + && ((suffixString = strrchr(specString, '#')) == NULL + || suffixString == specString)) { + suffixString = specString + specStrLen; + colorString = specString; } else { - strncpy(colorBuffer, specString, suffixString - specString); - colorBuffer[suffixString - specString] = '\0'; - colorString = (const char*)colorBuffer; + strncpy(colorBuffer, specString, suffixString - specString); + colorBuffer[suffixString - specString] = '\0'; + colorString = (const char*)colorBuffer; } /* @@ -1030,11 +1030,11 @@ ParseColorAsStandard( */ if ( ! TkParseColor(display, colormap, colorString, &parsedColor)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "invalid color name \"%s\"", specString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "invalid color name \"%s\"", specString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", NULL); + return TCL_ERROR; } /* @@ -1043,54 +1043,54 @@ ParseColorAsStandard( switch (suffixString[0]) { case '\0': - suffixAlpha = 255; - break; + suffixAlpha = 255; + break; case '@': - if (Tcl_GetDouble(NULL, suffixString + 1, &fracAlpha) != TCL_OK) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha " - "suffix \"%s\": expected floating-point value", - suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID COLOR", NULL); - return TCL_ERROR; - } - if (fracAlpha < 0 || fracAlpha > 1) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha suffix" - " \"%s\": value must be in the range from 0 to 1", - suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; - } - suffixAlpha = (unsigned int) floor(fracAlpha * 255 + 0.5); - break; + if (Tcl_GetDouble(NULL, suffixString + 1, &fracAlpha) != TCL_OK) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha " + "suffix \"%s\": expected floating-point value", + suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID COLOR", NULL); + return TCL_ERROR; + } + if (fracAlpha < 0 || fracAlpha > 1) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha suffix" + " \"%s\": value must be in the range from 0 to 1", + suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", NULL); + return TCL_ERROR; + } + suffixAlpha = (unsigned int) floor(fracAlpha * 255 + 0.5); + break; case '#': - if (strlen(suffixString + 1) < 1 || strlen(suffixString + 1)> 2) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "invalid alpha suffix \"%s\"", suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; - } - for (i = 1; i <= (int)strlen(suffixString + 1); i++) { - if ( ! isxdigit(UCHAR(suffixString[i]))) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "invalid alpha suffix \"%s\": expected hex digit", - suffixString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "INVALID_COLOR", NULL); - return TCL_ERROR; - } - } - if (strlen(suffixString + 1) == 1) { - sscanf(suffixString, "#%1x", &suffixAlpha); - suffixAlpha *= 0x11; - } else { - sscanf(suffixString, "#%2x", &suffixAlpha); - } - break; + if (strlen(suffixString + 1) < 1 || strlen(suffixString + 1)> 2) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "invalid alpha suffix \"%s\"", suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", NULL); + return TCL_ERROR; + } + for (i = 1; i <= (int)strlen(suffixString + 1); i++) { + if ( ! isxdigit(UCHAR(suffixString[i]))) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "invalid alpha suffix \"%s\": expected hex digit", + suffixString)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", + "INVALID_COLOR", NULL); + return TCL_ERROR; + } + } + if (strlen(suffixString + 1) == 1) { + sscanf(suffixString, "#%1x", &suffixAlpha); + suffixAlpha *= 0x11; + } else { + sscanf(suffixString, "#%2x", &suffixAlpha); + } + break; default: - Tcl_Panic("unexpected switch fallthrough"); + Tcl_Panic("unexpected switch fallthrough"); } *redPtr = (unsigned char) (parsedColor.red >> 8); diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 7d33a34..08abf5e 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -139,11 +139,6 @@ typedef struct { Tk_PhotoImageFormat *formatList; /* Pointer to the first in the list of known * photo image formats.*/ -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - Tk_PhotoImageFormat *oldFormatList; - /* Pointer to the first in the list of known - * photo image formats.*/ -#endif Tk_PhotoImageFormatVersion3 *formatListVersion3; /* Pointer to the first in the list of known * photo image formats in Version3 format.*/ @@ -247,13 +242,6 @@ PhotoFormatThreadExitProc( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - while (tsdPtr->oldFormatList != NULL) { - freePtr = tsdPtr->oldFormatList; - tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr; - ckfree(freePtr); - } -#endif while (tsdPtr->formatList != NULL) { freePtr = tsdPtr->formatList; tsdPtr->formatList = tsdPtr->formatList->nextPtr; @@ -271,7 +259,7 @@ PhotoFormatThreadExitProc( /* *---------------------------------------------------------------------- * - * Tk_CreateOldPhotoImageFormat, Tk_CreatePhotoImageFormat, + * Tk_CreatePhotoImageFormat, * Tk_CreatePhotoImageFormatVersion3 -- * * This function is invoked by an image file handler to register a new @@ -288,29 +276,6 @@ PhotoFormatThreadExitProc( *---------------------------------------------------------------------- */ -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -void -Tk_CreateOldPhotoImageFormat( - const Tk_PhotoImageFormat *formatPtr) - /* Structure describing the format. All of the - * fields except "nextPtr" must be filled in - * by caller. */ -{ - Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - - if (!tsdPtr->initialized) { - tsdPtr->initialized = 1; - Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); - } - copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); - *copyPtr = *formatPtr; - copyPtr->nextPtr = tsdPtr->oldFormatList; - tsdPtr->oldFormatList = copyPtr; -} -#endif - void Tk_CreatePhotoImageFormat( const Tk_PhotoImageFormat *formatPtr) @@ -328,12 +293,6 @@ Tk_CreatePhotoImageFormat( } copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - if (isupper((unsigned char) *formatPtr->name)) { - copyPtr->nextPtr = tsdPtr->oldFormatList; - tsdPtr->oldFormatList = copyPtr; - } else -#endif { /* for compatibility with aMSN: make a copy of formatPtr->name */ char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); @@ -654,7 +613,7 @@ ImgPhotoCmd( srcHandle = Tk_FindPhoto(interp, Tcl_GetString(options.name)); if (srcHandle == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "image \"%s\" doesn't exist or is not a photo image", + "image \"%s\" does not exist or is not a photo image", Tcl_GetString(options.name))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO", Tcl_GetString(options.name), (char *)NULL); @@ -836,23 +795,6 @@ ImgPhotoCmd( } } } -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - if (stringWriteProc == NULL) { - oldformat = 1; - for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL; - imageFormat = imageFormat->nextPtr) { - if ((strncasecmp(Tcl_GetString(options.format), - imageFormat->name, - strlen(imageFormat->name)) == 0)) { - matched = 1; - if (imageFormat->stringWriteProc != NULL) { - stringWriteProc = imageFormat->stringWriteProc; - break; - } - } - } - } -#endif if (stringWriteProc == NULL) { oldformat = 0; for (imageFormatVersion3 = tsdPtr->formatListVersion3; @@ -1508,22 +1450,6 @@ readCleanup: } } } -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - if (imageFormat == NULL) { - oldformat = 1; - for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL; - imageFormat = imageFormat->nextPtr) { - if ((fmtString == NULL) - || (strncasecmp(fmtString, imageFormat->name, - strlen(imageFormat->name)) == 0)) { - matched = 1; - if (imageFormat->fileWriteProc != NULL) { - break; - } - } - } - } -#endif if (imageFormat == NULL) { oldformat = 0; for (imageFormatVersion3 = tsdPtr->formatListVersion3; @@ -2043,7 +1969,7 @@ ImgPhotoConfigureModel( */ if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs, - objc, (const char **)objv, (char *) modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + objc, objv, modelPtr, flags) != TCL_OK) { goto errorExit; } @@ -2770,42 +2696,6 @@ MatchFileFormat( } } } -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -if (formatPtr == NULL) { - useoldformat = 1; - for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL; - formatPtr = formatPtr->nextPtr) { - if (formatString != NULL) { - if (strncasecmp(formatString, - formatPtr->name, strlen(formatPtr->name)) != 0) { - continue; - } - matched = 1; - if (formatPtr->fileMatchProc == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "-file option isn't supported for %s images", - formatString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "NOT_FILE_FORMAT", (char *)NULL); - return TCL_ERROR; - } - } - if (formatPtr->fileMatchProc != NULL) { - (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET); - if (formatPtr->fileMatchProc(chan, fileName, (Tcl_Obj *) - formatString, widthPtr, heightPtr, interp)) { - if (*widthPtr < 1) { - *widthPtr = 1; - } - if (*heightPtr < 1) { - *heightPtr = 1; - } - break; - } - } - } - } -#endif /* * For old and not version 3 format, exit now with success @@ -3003,38 +2893,6 @@ MatchStringFormat( } } -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - if (formatPtr == NULL) { - useoldformat = 1; - for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL; - formatPtr = formatPtr->nextPtr) { - if (formatObj != NULL) { - if (strncasecmp(formatString, - formatPtr->name, strlen(formatPtr->name)) != 0) { - continue; - } - matched = 1; - if (formatPtr->stringMatchProc == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "-data option isn't supported for %s images", - formatString)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "NOT_DATA_FORMAT", (char *)NULL); - return TCL_ERROR; - } - } - if ((formatPtr->stringMatchProc != NULL) - && (formatPtr->stringReadProc != NULL) - && formatPtr->stringMatchProc( - (Tcl_Obj *) Tcl_GetString(data), - (Tcl_Obj *) formatString, - widthPtr, heightPtr, interp)) { - break; - } - } - } -#endif - if (formatPtr == NULL) { useoldformat = 0; for (formatVersion3Ptr = tsdPtr->formatListVersion3; @@ -4523,107 +4381,6 @@ ImgPhotoPostscript( } /* - *---------------------------------------------------------------------- - * - * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- - * - * These backward-compatibility functions just exist to fill slots in stubs - * table. For the behaviour of *_NoComposite, refer to the corresponding - * function without the extra suffix, except that the compositing rule is - * always "overlay" and the function always panics on memory-allocation - * failure. - * - *---------------------------------------------------------------------- - */ -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -void -Tk_PhotoPutBlock_NoComposite( - Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, - int x, int y, int width, int height) -{ - if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height, - TK_PHOTO_COMPOSITE_OVERLAY) != TCL_OK) { - Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); - } -} - -void -Tk_PhotoPutZoomedBlock_NoComposite( - Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, - int x, int y, int width, int height, - int zoomX, int zoomY, int subsampleX, int subsampleY) -{ - if (Tk_PhotoPutZoomedBlock(NULL, handle, blockPtr, x, y, width, height, - zoomX, zoomY, subsampleX, subsampleY, - TK_PHOTO_COMPOSITE_OVERLAY) != TCL_OK) { - Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); - } -} - -/* - *---------------------------------------------------------------------- - * - * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, - * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic - * - * Backward compatibility functions for preserving the old behaviour (i.e. - * panic on memory allocation failure) so that extensions do not need to be - * significantly updated to take account of TIP #116. These call the new - * interface (i.e. the interface without the extra suffix), but panic if an - * error condition is returned. - * - *---------------------------------------------------------------------- - */ - -void -Tk_PhotoExpand_Panic( - Tk_PhotoHandle handle, - int width, int height) -{ - if (Tk_PhotoExpand(NULL, handle, width, height) != TCL_OK) { - Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); - } -} - -void -Tk_PhotoPutBlock_Panic( - Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, - int x, int y, int width, int height, int compRule) -{ - if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height, - compRule) != TCL_OK) { - Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); - } -} - -void -Tk_PhotoPutZoomedBlock_Panic( - Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, - int x, int y, int width, int height, - int zoomX, int zoomY, int subsampleX, int subsampleY, - int compRule) -{ - if (Tk_PhotoPutZoomedBlock(NULL, handle, blockPtr, x, y, width, height, - zoomX, zoomY, subsampleX, subsampleY, compRule) != TCL_OK) { - Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); - } -} - -void -Tk_PhotoSetSize_Panic( - Tk_PhotoHandle handle, - int width, int height) -{ - if (Tk_PhotoSetSize(NULL, handle, width, height) != TCL_OK) { - Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); - } -} -#endif /* TK_NO_DEPRECATED */ - -/* * Local Variables: * mode: c * c-basic-offset: 4 diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index 73bbbf8..de70733 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -194,15 +194,15 @@ FileMatchSVG( nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage != NULL) { - GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); - if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { + GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); + if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { nsvgDelete(nsvgImage); return 0; - } - if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) { + } + if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); - } - return 1; + } + return 1; } return 0; } @@ -243,7 +243,7 @@ FileReadSVG( NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts); if (nsvgImage == NULL) { - Tcl_Obj *dataObj = Tcl_NewObj(); + Tcl_Obj *dataObj = Tcl_NewObj(); if (Tcl_ReadChars(chan, dataObj, TCL_INDEX_NONE, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ @@ -304,15 +304,15 @@ StringMatchSVG( } nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); if (nsvgImage != NULL) { - GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); - if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { + GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); + if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { nsvgDelete(nsvgImage); return 0; - } - if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) { + } + if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); - } - return 1; + } + return 1; } return 0; } @@ -392,7 +392,7 @@ ParseSVGWithOptions( NSVGimage *nsvgImage; int parameterScaleSeen = 0; static const char *const fmtOptions[] = { - "-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL + "-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL }; enum fmtOptionsEnum { OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH @@ -421,7 +421,7 @@ ParseSVGWithOptions( ropts->scaleToWidth = 0; if ((formatObj != NULL) && Tcl_ListObjGetElements(interp, formatObj, &objc, &objv) != TCL_OK) { - goto error; + goto error; } for (; objc > 0 ; objc--, objv++) { int optIndex; @@ -475,7 +475,7 @@ ParseSVGWithOptions( switch ((enum fmtOptionsEnum) optIndex) { case OPT_DPI: if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) { - goto error; + goto error; } if (dpi < 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -488,7 +488,7 @@ ParseSVGWithOptions( case OPT_SCALE: if (Tcl_GetDoubleFromObj(interp, objv[0], &ropts->scale) == TCL_ERROR) { - goto error; + goto error; } if (ropts->scale <= 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -501,7 +501,7 @@ ParseSVGWithOptions( case OPT_SCALE_TO_HEIGHT: if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToHeight) == TCL_ERROR) { - goto error; + goto error; } if (ropts->scaleToHeight <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -514,7 +514,7 @@ ParseSVGWithOptions( case OPT_SCALE_TO_WIDTH: if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToWidth) == TCL_ERROR) { - goto error; + goto error; } if (ropts->scaleToWidth <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -538,7 +538,7 @@ ParseSVGWithOptions( error: if (inputCopy != NULL) { - ckfree(inputCopy); + ckfree(inputCopy); } return NULL; } @@ -669,8 +669,8 @@ GetScaleFromParameters( int width, height; if ((nsvgImage->width == 0.0) || (nsvgImage->height == 0.0)) { - width = height = 0; - scale = 1.0; + width = height = 0; + scale = 1.0; } else if (ropts->scaleToHeight > 0) { /* * Fixed height @@ -759,7 +759,7 @@ CacheSVG( NSVGcache *cachePtr = GetCachePtr(interp); if (cachePtr != NULL) { - cachePtr->dataOrChan = dataOrChan; + cachePtr->dataOrChan = dataOrChan; if (formatObj != NULL) { data = Tcl_GetStringFromObj(formatObj, &length); Tcl_DStringAppend(&cachePtr->formatString, data, length); @@ -801,10 +801,10 @@ GetCachedSVG( if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) && (cachePtr->dataOrChan == dataOrChan)) { - if (formatObj != NULL) { + if (formatObj != NULL) { data = Tcl_GetStringFromObj(formatObj, &length); if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) { - nsvgImage = cachePtr->nsvgImage; + nsvgImage = cachePtr->nsvgImage; *ropts = cachePtr->ropts; cachePtr->nsvgImage = NULL; } @@ -838,8 +838,8 @@ CleanCache(Tcl_Interp *interp) NSVGcache *cachePtr = GetCachePtr(interp); if (cachePtr != NULL) { - cachePtr->dataOrChan = NULL; - Tcl_DStringSetLength(&cachePtr->formatString, 0); + cachePtr->dataOrChan = NULL; + Tcl_DStringSetLength(&cachePtr->formatString, 0); if (cachePtr->nsvgImage != NULL) { nsvgDelete(cachePtr->nsvgImage); cachePtr->nsvgImage = NULL; @@ -869,7 +869,7 @@ FreeCache(void *clientData, TCL_UNUSED(Tcl_Interp *)) Tcl_DStringFree(&cachePtr->formatString); if (cachePtr->nsvgImage != NULL) { - nsvgDelete(cachePtr->nsvgImage); + nsvgDelete(cachePtr->nsvgImage); } ckfree(cachePtr); } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 0fe0c24..7d60aea 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -68,7 +68,7 @@ declare 12 { } declare 13 { int TkCreateFrame(void *clientData, Tcl_Interp *interp, - Tcl_Size argc, const char *const *argv, int toplevel, const char *appName) + Tcl_Size objc, Tcl_Obj *const objv[], int type, const char *appName) } declare 14 { Tk_Window TkCreateMainWindow(Tcl_Interp *interp, @@ -226,9 +226,6 @@ declare 58 { declare 59 { void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name) } -declare 60 {deprecated {renamed to Tk_GetOtherWindow}} { - TkWindow *TkpGetOtherWindow(TkWindow *winPtr) -} declare 61 { TkWindow *TkpGetWrapperWindow(TkWindow *winPtr) } @@ -239,15 +236,9 @@ declare 63 { void TkpInitializeMenuBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable) } -declare 64 {deprecated {renamed to Tk_MakeContainer}} { - void TkpMakeContainer(Tk_Window tkwin) -} declare 65 { void TkpMakeMenuWindow(Tk_Window tkwin, int transient) } -declare 66 {deprecated {renamed to Tk_MakeWindow}} { - Window TkpMakeWindow(TkWindow *winPtr, Window parent) -} declare 67 { void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp, const char *menuName) } @@ -269,15 +260,6 @@ declare 72 { declare 73 { void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr) } -declare 74 {deprecated {renamed to Tk_SetMainMenubar}} { - void TkpSetMainMenubar(Tcl_Interp *interp, Tk_Window tkwin, const char *menuName) -} -declare 75 {deprecated {renamed to Tk_UseWindow}} { - int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, const char *string) -} -# -# Slot 76 unused (WAS: TkpWindowWasRecentlyDeleted) -# declare 77 { void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr) } @@ -302,16 +284,6 @@ declare 82 { declare 83 { void TkSelPropProc(XEvent *eventPtr) } - -# Exported publically as Tk_SetClassProcs in 8.4a2 -#declare 84 { -# void TkSetClassProcs(Tk_Window tkwin, -# TkClassProcs *procs, void *instanceData) -#} -declare 85 {deprecated {renamed to Tk_SetWindowMenubar}} { - void TkSetWindowMenuBar(Tcl_Interp *interp, Tk_Window tkwin, - const char *oldMenuName, const char *menuName) -} declare 86 { KeySym TkStringToKeysym(const char *name) } @@ -394,10 +366,6 @@ declare 109 { declare 110 { void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont) } -declare 111 {deprecated {renamed to Tk_GetSystemDefault}} { - Tcl_Obj *TkpGetSystemDefault(Tk_Window tkwin, - const char *dbName, const char *className) -} declare 112 { void TkpMenuThreadInit(void) } @@ -424,20 +392,16 @@ declare 119 { int XUnionRectWithRegion(XRectangle *rect, Region src, Region dr_return) } -declare 121 aqua { +declare 121 { Pixmap TkpCreateNativeBitmap(Display *display, const void *source) } -declare 122 aqua { +declare 122 { void TkpDefineNativeBitmaps(void) } -declare 124 aqua { +declare 124 { Pixmap TkpGetNativeAppBitmap(Display *display, const char *name, int *width, int *height) } -declare 135 {deprecated {renamed to Tk_DrawHighlightBorder}} { - void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, GC bgGC, - int highlightWidth, Drawable drawable) -} declare 136 { void TkSetFocusWin(TkWindow *winPtr, int force) } @@ -666,58 +630,33 @@ declare 0 x11 { declare 2 x11 { void TkGenerateActivateEvents(TkWindow *winPtr, int active) } -declare 3 x11 { - int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) -} -declare 4 x11 { - void TkpSync(Display *display) -} -declare 5 x11 { - Window TkUnixContainerId(TkWindow *winPtr) -} declare 6 x11 { - int TkUnixDoOneXEvent(Tcl_Time *timePtr) -} -declare 7 x11 { - void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) -} -declare 8 x11 { int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr) } declare 9 x11 { - void TkWmCleanup(TkDisplay *dispPtr) -} -declare 10 x11 { - void TkSendCleanup(TkDisplay *dispPtr) -} -declare 12 x11 { int TkpWmSetState(TkWindow *winPtr, int state) } # only needed by tktest: -declare 13 x11 { - int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, Tcl_Size objc, - Tcl_Obj *const objv[]) -} declare 38 x11 { - int TkpCmapStressed_(Tk_Window tkwin, Colormap colormap) + int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } declare 39 x11 { - void TkpSync_(Display *display) + void TkpSync(Display *display) } declare 40 x11 { - Window TkUnixContainerId_(TkWindow *winPtr) + Window TkUnixContainerId(TkWindow *winPtr) } declare 41 x11 { - int TkUnixDoOneXEvent_(Tcl_Time *timePtr) + int TkUnixDoOneXEvent(Tcl_Time *timePtr) } declare 42 x11 { - void TkUnixSetMenubar_(Tk_Window tkwin, Tk_Window menubar) + void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) } declare 43 x11 { - void TkWmCleanup_(TkDisplay *dispPtr) + void TkWmCleanup(TkDisplay *dispPtr) } declare 44 x11 { - void TkSendCleanup_(TkDisplay *dispPtr) + void TkSendCleanup(TkDisplay *dispPtr) } # only needed by tktest: declare 45 x11 { @@ -729,7 +668,7 @@ declare 45 x11 { # Windows specific functions declare 0 win { - char *TkAlignImageData(XImage *image, int alignment, int bitOrder) + void TkCreateXEventSource(void) } declare 2 win { void TkGenerateActivateEvents(TkWindow *winPtr, int active) @@ -832,7 +771,7 @@ declare 32 win { const char *dbName, const char *className) } declare 33 win { - int TkWinGetPlatformId(void) + char *TkAlignImageData(XImage *image, int alignment, int bitOrder) } # new for 8.4.1 @@ -851,10 +790,6 @@ declare 36 win { UINT message, WPARAM wParam, LPARAM lParam) } -# new for 8.4.20+/8.5.12+, Cygwin only -declare 37 win { - void TkCreateXEventSource(void) -} declare 38 win { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } @@ -888,26 +823,26 @@ declare 47 win { ################################ # Aqua specific functions -declare 0 aqua { - void TkGenerateActivateEvents(TkWindow *winPtr, int active) +declare 1 aqua { + void TkAboutDlg(void) } declare 2 aqua { - void TkGenerateActivateEvents_(TkWindow *winPtr, int active) + void TkGenerateActivateEvents(TkWindow *winPtr, int active) } declare 3 aqua { - void TkPointerDeadWindow(TkWindow *winPtr) + unsigned long TkpGetMS(void) } declare 4 aqua { - void TkpSetCapture(TkWindow *winPtr) + void TkPointerDeadWindow(TkWindow *winPtr) } declare 5 aqua { void TkpSetCursor(TkpCursor cursor) } declare 6 aqua { - void TkpWmSetState(TkWindow *winPtr, int state) + int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr) } declare 7 aqua { - void TkAboutDlg(void) + int TkpWmSetState(TkWindow *winPtr, int state) } declare 8 aqua { unsigned int TkMacOSXButtonKeyState(void) @@ -918,10 +853,9 @@ declare 9 aqua { declare 10 aqua { int TkMacOSXDispatchMenuEvent(int menuID, int index) } -# Now a static function -# declare 11 aqua { -# void TkMacOSXInstallCursor(int resizeOverride) -# } +declare 11 aqua { + void TkpSetCapture(TkWindow *winPtr) +} declare 12 aqua { void TkMacOSXHandleTearoffMenu(void) } @@ -938,22 +872,9 @@ declare 18 aqua { void TkMacOSXHandleMenuSelect(short theMenu, unsigned short theItem, int optionKeyPressed) } - -# removed duplicates from tkPlat table(tk.decls) -#declare 19 aqua { -# void TkMacOSXInitAppleEvents(Tcl_Interp *interp) -#} -# -#declare 20 aqua { -# void TkMacOSXInitMenus(Tcl_Interp *interp) -#} - declare 21 aqua { void TkMacOSXInvalidateWindow(MacDrawable *macWin, int flag) } -declare 22 aqua { - int TkMacOSXIsCharacterMissing(Tk_Font tkfont, unsigned int searchChar) -} declare 23 aqua { void TkMacOSXMakeRealWindowExist(TkWindow *winPtr) } @@ -963,10 +884,6 @@ declare 24 aqua { declare 25 aqua { void TkMacOSXMenuClick(void) } -# The corresponding Unregister was not a stub, and this should be static. -#declare 26 aqua { -# void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr) -#} declare 27 aqua { int TkMacOSXResizable(TkWindow *winPtr) } @@ -976,19 +893,12 @@ declare 28 aqua { declare 29 aqua { void TkMacOSXSetScrollbarGrow(TkWindow *winPtr, int flag) } -declare 30 aqua { - void TkMacOSXSetUpClippingRgn(Drawable drawable) -} declare 31 aqua { void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort) } declare 32 aqua { void TkMacOSXUpdateClipRgn(TkWindow *winPtr) } -# This was not implemented. Perhaps meant to be OffScreen ? -#declare 33 aqua { -# void TkMacOSXUnregisterMacWindow(void *portPtr) -#} declare 34 aqua { int TkMacOSXUseMenuID(short macID) } @@ -1041,16 +951,10 @@ declare 51 aqua { declare 52 aqua { void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag) } -declare 53 aqua { - unsigned long TkpGetMS(void) -} -# For Canvas3d, requested by Sean Woods -declare 54 aqua { - void *TkMacOSXDrawable(Drawable drawable) -} -declare 55 aqua { - int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr) -} +# Made public as Tk_MacOSXGetNSWindowForDrawable +#declare 54 aqua { +# void *TkMacOSXDrawable(Drawable drawable) +#} ############################################################################## @@ -1594,348 +1498,350 @@ declare 6 macosx { Colormap XCreateColormap(Display *d, Window w, Visual *v, int i) } declare 7 macosx { - GContext XGContextFromGC(GC g) + Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2, + XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2) } -# second parameter was of type KeyCode declare 8 macosx { - KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i) + Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, + unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, + XColor _Xconst *x2) } declare 9 macosx { - KeySym XStringToKeysym(_Xconst char *c) + GContext XGContextFromGC(GC g) } declare 10 macosx { - Window XRootWindow(Display *d, int i) + XHostAddress *XListHosts(Display *d, int *i, Bool *b) } +# second parameter was of type KeyCode declare 11 macosx { - XErrorHandler XSetErrorHandler(XErrorHandler x) + KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i) } declare 12 macosx { - Status XAllocColor(Display *d, Colormap c, XColor *xp) + KeySym XStringToKeysym(_Xconst char *c) } declare 13 macosx { - int XBell(Display *d, int i) + Window XRootWindow(Display *d, int i) } declare 14 macosx { - int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, - int i2, _Xconst unsigned char *c, int i3) + XErrorHandler XSetErrorHandler(XErrorHandler x) } declare 15 macosx { - int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, - XSetWindowAttributes *x) + Status XIconifyWindow(Display *d, Window w, int i) } declare 16 macosx { - int XConfigureWindow(Display *d, Window w, unsigned int i, - XWindowChanges *x) + Status XWithdrawWindow(Display *d, Window w, int i) } declare 17 macosx { - int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, - int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) + Status XGetWMColormapWindows(Display *d, Window w, Window **wpp, int *ip) } declare 18 macosx { - int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, - int i2, unsigned int ui1, - unsigned int ui2, int i3, int i4, unsigned long ul) + Status XAllocColor(Display *d, Colormap c, XColor *xp) } declare 19 macosx { - Pixmap XCreateBitmapFromData(Display *display, Drawable d, - _Xconst char *data, unsigned int width, unsigned int height) + int XBell(Display *d, int i) } declare 20 macosx { - int XDefineCursor(Display *d, Window w, Cursor c) + int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, + int i2, _Xconst unsigned char *c, int i3) } declare 21 macosx { - int XDestroyWindow(Display *d, Window w) + int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, + XSetWindowAttributes *x) } declare 22 macosx { - int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, - unsigned int ui1, unsigned int ui2, int i3, int i4) + int XClearWindow(Display *d, Window w) } declare 23 macosx { - int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2) + int XConfigureWindow(Display *d, Window w, unsigned int i, + XWindowChanges *x) } declare 24 macosx { - int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, - unsigned int ui1, unsigned int ui2) + int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, + int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 25 macosx { - int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, - unsigned int ui1, unsigned int ui2, int i3, int i4) + int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, + int i2, unsigned int ui1, unsigned int ui2, + int i3, int i4, unsigned long ul) } declare 26 macosx { - int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, - int i1, int i2, int i3) + Pixmap XCreateBitmapFromData(Display *display, Drawable d, + _Xconst char *data, unsigned int width, unsigned int height) } declare 27 macosx { - int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i) + int XDefineCursor(Display *d, Window w, Cursor c) } declare 28 macosx { - int XFreeColormap(Display *d, Colormap c) + int XDeleteProperty(Display *d, Window w, Atom a) } declare 29 macosx { - int XFreeColors(Display *d, Colormap c, - unsigned long *ulp, int i, unsigned long ul) + int XDestroyWindow(Display *d, Window w) } declare 30 macosx { - int XFreeModifiermap(XModifierKeymap *x) + int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, + unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 31 macosx { - Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1, - int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, - unsigned int *ui4) + int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2) } declare 32 macosx { - int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2, - Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, - unsigned long *ulp2, unsigned char **cpp) + int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, + unsigned int ui1, unsigned int ui2) } declare 33 macosx { - int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t) + int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, + unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 34 macosx { - int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui, - int i1, int i2, Window w2, Cursor c, Time t) + int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, + int i1, int i2, int i3) } declare 35 macosx { - KeyCode XKeysymToKeycode(Display *d, KeySym k) + int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i) } declare 36 macosx { - int XMapWindow(Display *d, Window w) + int XForceScreenSaver(Display *d, int i) } declare 37 macosx { - int XMoveResizeWindow(Display *d, Window w, int i1, int i2, - unsigned int ui1, unsigned int ui2) + int XFreeColormap(Display *d, Colormap c) } declare 38 macosx { - int XMoveWindow(Display *d, Window w, int i1, int i2) + int XFreeColors(Display *d, Colormap c, + unsigned long *ulp, int i, unsigned long ul) } declare 39 macosx { - Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, - int *i1, int *i2, int *i3, int *i4, unsigned int *ui) + int XFreeCursor(Display *d, Cursor c) } declare 40 macosx { - int XRaiseWindow(Display *d, Window w) + int XFreeModifiermap(XModifierKeymap *x) } declare 41 macosx { - int XRefreshKeyboardMapping(XMappingEvent *x) + Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1, + int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, + unsigned int *ui4) } declare 42 macosx { - int XResizeWindow(Display *d, Window w, unsigned int ui1, - unsigned int ui2) + int XGetInputFocus(Display *d, Window *w, int *i) } declare 43 macosx { - int XSelectInput(Display *d, Window w, long l) + int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2, + Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, + unsigned long *ulp2, unsigned char **cpp) } declare 44 macosx { - Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x) + Status XGetWindowAttributes(Display *d, Window w, XWindowAttributes *x) } declare 45 macosx { - int XSetIconName(Display *d, Window w, _Xconst char *c) + int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t) } declare 46 macosx { - int XSetInputFocus(Display *d, Window w, int i, Time t) + int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui, + int i1, int i2, Window w2, Cursor c, Time t) } declare 47 macosx { - int XSetSelectionOwner(Display *d, Atom a, Window w, Time t) + KeyCode XKeysymToKeycode(Display *d, KeySym k) } declare 48 macosx { - int XSetWindowBackground(Display *d, Window w, unsigned long ul) + Status XLookupColor(Display *d, Colormap c1, _Xconst char *c2, + XColor *x1, XColor *x2) } declare 49 macosx { - int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p) + int XMapWindow(Display *d, Window w) } declare 50 macosx { - int XSetWindowBorder(Display *d, Window w, unsigned long ul) + int XMoveResizeWindow(Display *d, Window w, int i1, int i2, + unsigned int ui1, unsigned int ui2) } declare 51 macosx { - int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p) + int XMoveWindow(Display *d, Window w, int i1, int i2) } declare 52 macosx { - int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui) + int XNextEvent(Display *d, XEvent *x) } declare 53 macosx { - int XSetWindowColormap(Display *d, Window w, Colormap c) + int XPutBackEvent(Display *d, XEvent *x) } declare 54 macosx { - int XUngrabKeyboard(Display *d, Time t) + int XQueryColors(Display *d, Colormap c, XColor *x, int i) } declare 55 macosx { - int XUngrabPointer(Display *d, Time t) + Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, + int *i1, int *i2, int *i3, int *i4, unsigned int *ui) } declare 56 macosx { - int XUnmapWindow(Display *d, Window w) + Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3, + Window **w4, unsigned int *ui) } declare 57 macosx { - int TkPutImage(unsigned long *colors, int ncolors, Display *display, - Drawable d, GC gc, XImage *image, int src_x, int src_y, - int dest_x, int dest_y, unsigned int width, unsigned int height) + int XRaiseWindow(Display *d, Window w) } declare 58 macosx { - Status XParseColor(Display *display, Colormap map, - _Xconst char *spec, XColor *colorPtr) + int XRefreshKeyboardMapping(XMappingEvent *x) } declare 59 macosx { - GC XCreateGC(Display *display, Drawable d, - unsigned long valuemask, XGCValues *values) + int XResizeWindow(Display *d, Window w, unsigned int ui1, + unsigned int ui2) } declare 60 macosx { - int XFreeGC(Display *display, GC gc) + int XSelectInput(Display *d, Window w, long l) } declare 61 macosx { - Atom XInternAtom(Display *display, _Xconst char *atom_name, - Bool only_if_exists) + Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x) } declare 62 macosx { - int XSetBackground(Display *display, GC gc, unsigned long foreground) + int XSetCommand(Display *d, Window w, char **c, int i) } declare 63 macosx { - int XSetForeground(Display *display, GC gc, unsigned long foreground) + int XSetIconName(Display *d, Window w, _Xconst char *c) } declare 64 macosx { - int XSetClipMask(Display *display, GC gc, Pixmap pixmap) + int XSetInputFocus(Display *d, Window w, int i, Time t) } declare 65 macosx { - int XSetClipOrigin(Display *display, GC gc, - int clip_x_origin, int clip_y_origin) + int XSetSelectionOwner(Display *d, Atom a, Window w, Time t) } declare 66 macosx { - int XSetTSOrigin(Display *display, GC gc, - int ts_x_origin, int ts_y_origin) + int XSetWindowBackground(Display *d, Window w, unsigned long ul) } declare 67 macosx { - int XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values) + int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p) } declare 68 macosx { - int XSetFont(Display *display, GC gc, Font font) + int XSetWindowBorder(Display *d, Window w, unsigned long ul) } declare 69 macosx { - int XSetArcMode(Display *display, GC gc, int arc_mode) + int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p) } declare 70 macosx { - int XSetStipple(Display *display, GC gc, Pixmap stipple) + int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui) } declare 71 macosx { - int XSetFillRule(Display *display, GC gc, int fill_rule) + int XSetWindowColormap(Display *d, Window w, Colormap c) } declare 72 macosx { - int XSetFillStyle(Display *display, GC gc, int fill_style) + Bool XTranslateCoordinates(Display *d, Window w1, Window w2, int i1, + int i2, int *i3, int *i4, Window *w3) } declare 73 macosx { - int XSetFunction(Display *display, GC gc, int function) + int XUngrabKeyboard(Display *d, Time t) } declare 74 macosx { - int XSetLineAttributes(Display *display, GC gc, unsigned int line_width, - int line_style, int cap_style, int join_style) + int XUngrabPointer(Display *d, Time t) } declare 75 macosx { - int _XInitImageFuncPtrs(XImage *image) + int XUnmapWindow(Display *d, Window w) } declare 76 macosx { - XIC XCreateIC(XIM xim, ...) + int XWindowEvent(Display *d, Window w, long l, XEvent *x) } declare 77 macosx { - XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask, - XVisualInfo *vinfo_template, int *nitems_return) + void XDestroyIC(XIC x) } declare 78 macosx { - void XSetWMClientMachine(Display *display, Window w, - XTextProperty *text_prop) + Bool XFilterEvent(XEvent *x, Window w) } declare 79 macosx { - Status XStringListToTextProperty(char **list, int count, - XTextProperty *text_prop_return) + int XmbLookupString(XIC xi, XKeyPressedEvent *xk, char *c, int i, + KeySym *k, Status *s) } declare 80 macosx { - int XDrawSegments(Display *display, Drawable d, GC gc, - XSegment *segments, int nsegments) + int TkPutImage(unsigned long *colors, int ncolors, Display *display, + Drawable d, GC gc, XImage *image, int src_x, int src_y, + int dest_x, int dest_y, unsigned int width, unsigned int height) } declare 81 macosx { - int XForceScreenSaver(Display *display, int mode) + int XSetClipRectangles(Display *display, GC gc, int clip_x_origin, + int clip_y_origin, XRectangle rectangles[], int n, int ordering) } declare 82 macosx { - int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, - int x2, int y2) + Status XParseColor(Display *display, Colormap map, + _Xconst char *spec, XColor *colorPtr) } declare 83 macosx { - int XFillRectangle(Display *display, Drawable d, GC gc, - int x, int y, unsigned int width, unsigned int height) + GC XCreateGC(Display *display, Drawable d, + unsigned long valuemask, XGCValues *values) } declare 84 macosx { - int XClearWindow(Display *d, Window w) + int XFreeGC(Display *display, GC gc) } declare 85 macosx { - int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y) + Atom XInternAtom(Display *display, _Xconst char *atom_name, + Bool only_if_exists) } declare 86 macosx { - int XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points, - int npoints, int mode) + int XSetBackground(Display *display, GC gc, unsigned long foreground) } declare 87 macosx { - int XWarpPointer(Display *display, Window src_w, Window dest_w, - int src_x, int src_y, unsigned int src_width, - unsigned int src_height, int dest_x, int dest_y) + int XSetForeground(Display *display, GC gc, unsigned long foreground) } declare 88 macosx { - int XQueryColor(Display *display, Colormap colormap, XColor *def_in_out) + int XSetClipMask(Display *display, GC gc, Pixmap pixmap) } declare 89 macosx { - int XQueryColors(Display *display, Colormap colormap, - XColor *defs_in_out, int ncolors) + int XSetClipOrigin(Display *display, GC gc, + int clip_x_origin, int clip_y_origin) } declare 90 macosx { - Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3, - Window **w4, unsigned int *ui) + int XSetTSOrigin(Display *display, GC gc, + int ts_x_origin, int ts_y_origin) } declare 91 macosx { - int XSync(Display *display, Bool discard) + int XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values) } declare 92 macosx { - Bool XTranslateCoordinates(Display *d, Window w1, Window w2, int i1, - int i2, int *i3, int *i4, Window *w3) + int XSetFont(Display *display, GC gc, Font font) } declare 93 macosx { - int XDeleteProperty(Display *d, Window w, Atom a) + int XSetArcMode(Display *display, GC gc, int arc_mode) } declare 94 macosx { - int XFreeCursor(Display *d, Cursor c) + int XSetStipple(Display *display, GC gc, Pixmap stipple) } declare 95 macosx { - int XGetInputFocus(Display *d, Window *w, int *i) + int XSetFillRule(Display *display, GC gc, int fill_rule) } declare 96 macosx { - int XmbLookupString(XIC xi, XKeyPressedEvent *xk, char *c, int i, - KeySym *k, Status *s) + int XSetFillStyle(Display *display, GC gc, int fill_style) } declare 97 macosx { - int XNextEvent(Display *d, XEvent *x) + int XSetFunction(Display *display, GC gc, int function) } declare 98 macosx { - int XPutBackEvent(Display *d, XEvent *x) + int XSetLineAttributes(Display *display, GC gc, unsigned int line_width, + int line_style, int cap_style, int join_style) } declare 99 macosx { - int XSetCommand(Display *d, Window w, char **c, int i) + int _XInitImageFuncPtrs(XImage *image) } declare 100 macosx { - int XWindowEvent(Display *d, Window w, long l, XEvent *x) + XIC XCreateIC(XIM xim, ...) } declare 101 macosx { - Status XGetWindowAttributes(Display *d, Window w, XWindowAttributes *x) + XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask, + XVisualInfo *vinfo_template, int *nitems_return) } declare 102 macosx { - Status XGetWMColormapWindows(Display *d, Window w, Window **wpp, int *ip) + void XSetWMClientMachine(Display *display, Window w, + XTextProperty *text_prop) } declare 103 macosx { - Status XIconifyWindow(Display *d, Window w, int i) + Status XStringListToTextProperty(char **list, int count, + XTextProperty *text_prop_return) } declare 104 macosx { - Status XWithdrawWindow(Display *d, Window w, int i) + int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, + int x2, int y2) } declare 105 macosx { - XHostAddress *XListHosts(Display *d, int *i, Bool *b) + int XWarpPointer(Display *d, Window s, Window dw, int sx, int sy, + unsigned int sw, unsigned int sh, int dx, int dy) } declare 106 macosx { - int XSetClipRectangles(Display *display, GC gc, int clip_x_origin, - int clip_y_origin, XRectangle rectangles[], int n, int ordering) + int XFillRectangle(Display *display, Drawable d, GC gc, + int x, int y, unsigned int width, unsigned int height) } + +# New in Tk 8.6 declare 107 macosx { int XFlush(Display *display) } @@ -1955,18 +1861,21 @@ declare 112 macosx { XAfterFunction XSynchronize(Display *display, Bool onoff) } declare 113 macosx { - Status XLookupColor(Display *d, Colormap c1, _Xconst char *c2, - XColor *x1, XColor *x2) + int XSync(Display *display, Bool discard) } declare 114 macosx { VisualID XVisualIDFromVisual(Visual *visual) } + +# For tktreectrl declare 120 macosx { int XOffsetRegion(Region rgn, int dx, int dy) } declare 121 macosx { int XUnionRegion(Region srca, Region srcb, Region dr_return) } + +# For 3dcanvas declare 122 macosx { Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, @@ -1974,6 +1883,8 @@ declare 122 macosx { Visual *visual, unsigned long value_mask, XSetWindowAttributes *attributes) } + +# Various, e.g. for stub-enabled BLT declare 129 macosx { int XLowerWindow(Display *d, Window w) } @@ -1986,6 +1897,15 @@ declare 131 macosx { declare 132 macosx { int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n) } +declare 133 macosx { + int XDrawSegments(Display *d, Drawable dr, GC gc, XSegment *s, int n) +} +declare 134 macosx { + int XDrawPoint(Display *d, Drawable dr, GC gc, int x, int y) +} +declare 135 macosx { + int XDrawPoints(Display *d, Drawable dr, GC gc, XPoint *p, int n, int m) +} declare 136 macosx { int XReparentWindow(Display *d, Window w, Window p, int x, int y) } @@ -2000,6 +1920,7 @@ declare 138 macosx { declare 139 macosx { int XPointInRegion(Region rgn, int x, int y) } +# For XIM declare 140 macosx { XVaNestedList XVaCreateNestedList(int dummy, ...) } @@ -2012,18 +1933,6 @@ declare 142 macosx { declare 143 macosx { void XSetICFocus(XIC xic) } -declare 144 macosx { - void XDestroyIC(XIC xic) -} -declare 145 macosx { - Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2, - XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2) -} -declare 146 macosx { - Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, - unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, - XColor _Xconst *x2) -} declare 147 macosx { void XFreeFontSet(Display *display, XFontSet fontset) } diff --git a/generic/tkInt.h b/generic/tkInt.h index 29e3f0d..cf42eb6 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -75,41 +75,6 @@ # endif #endif -#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) -# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int, Tcl_DString *))Tcl_UniCharToUtfDString) -# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int, Tcl_DString *))Tcl_UtfToUniCharDString) -# define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString -# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString -# define TCL_COMBINE 0 -#endif - -/* Make available UTF-32 versions of the API, even though we compile with TCL_UTF_MAX=3 */ -#if TCL_MAJOR_VERSION > 8 -# define TkUtfToUniChar (tclStubsPtr->tcl_UtfToUniChar) /* 646 */ -# define TkUniCharToUtf (tclStubsPtr->tcl_UniCharToUtf) /* 324 (without TCL_COMBINE) */ -# define TkNumUtfChars (tclStubsPtr->tcl_NumUtfChars) /* 669 */ -# define TkGetCharLength (tclStubsPtr->tcl_GetCharLength) /* 670 */ -# define TkUtfAtIndex (tclStubsPtr->tcl_UtfAtIndex) /* 671 */ -#else - MODULE_SCOPE Tcl_Size TkUtfToUniChar(const char *, int *); - MODULE_SCOPE Tcl_Size TkUniCharToUtf(int, char *); -# ifdef USE_TCL_STUBS -# define TkNumUtfChars (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ - ((Tcl_Size (*)(const char *, Tcl_Size))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[669])) \ - : (tclStubsPtr->tcl_NumUtfChars) /* 312 */) -# define TkGetCharLength (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ - ((Tcl_Size (*)(Tcl_Obj *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[670])) \ - : (tclStubsPtr->tcl_GetCharLength) /* 380 */) -# define TkUtfAtIndex (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ - ((const char *(*)(const char *, Tcl_Size))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[671])) \ - : (tclStubsPtr->tcl_UtfAtIndex) /* 325 */) -# else -# define TkNumUtfChars TclNumUtfChars -# define TkGetCharLength TclGetCharLength -# define TkUtfAtIndex TclUtfAtIndex -# endif -#endif - #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) # define TKFLEXARRAY #elif defined(__GNUC__) && (__GNUC__ > 2) @@ -118,10 +83,6 @@ # define TKFLEXARRAY 1 #endif -#if !defined(Tcl_GetParent) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) -# define Tcl_GetParent Tcl_GetMaster -#endif - /* * Macros used to cast between pointers and integers (e.g. when storing an int * in ClientData), on 64-bit architectures they avoid gcc warning about "cast @@ -584,21 +545,6 @@ typedef struct TkDisplay { * the display when we no longer have any Tk * applications using it. */ - /* - * The following field were all added for Tk8.3 - */ - -#if TCL_MAJOR_VERSION < 9 -#if !defined(TK_NO_DEPRECATED) - int mouseButtonState; /* Current mouse button state for this - * display. NOT USED as of 8.6.10 */ - Window mouseButtonWindow; /* Window the button state was set in, added - * in Tk 8.4. */ -#else - int notused1; - XID notused2; -#endif /* !TK_NO_DEPRECATED */ -#endif Tk_Window warpWindow; Tk_Window warpMainwin; /* For finding the root window for warping * purposes. */ @@ -994,18 +940,6 @@ typedef struct { #define TK_MAKE_MENU_POPUP 1 #define TK_MAKE_MENU_DROPDOWN 2 -/* See TIP #494 */ -#ifndef TCL_IO_FAILURE -# define TCL_IO_FAILURE (-1) -#endif -/* See TIP #537 */ -#ifndef TCL_INDEX_NONE -# define TCL_INDEX_NONE (-1) -#endif -#ifndef TCL_INDEX_END -# define TCL_INDEX_END ((Tcl_Size)-2) -#endif - /* * The following structure is used with TkMakeEnsemble to create ensemble * commands and optionally to create sub-ensembles. @@ -1135,13 +1069,6 @@ typedef struct { size_t version; } TkObjType; -#ifndef TCL_OBJTYPE_V0 -# define TCL_OBJTYPE_V0 /* just empty */ -#endif -#ifndef TCL_OBJTYPE_V1 -# define TCL_OBJTYPE_V1(lengthProc) /* just empty */ -#endif - MODULE_SCOPE const TkObjType tkBorderObjType; MODULE_SCOPE const TkObjType tkBitmapObjType; MODULE_SCOPE const TkObjType tkColorObjType; @@ -1355,21 +1282,13 @@ MODULE_SCOPE void TkInitEmbeddedConfigurationInformation( Tcl_Interp *interp); MODULE_SCOPE void TkDoWarpWrtWin(TkDisplay *dispPtr); MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); -MODULE_SCOPE int TkListCreateFrame(void *clientData, - Tcl_Interp *interp, Tcl_Obj *listObj, - int toplevel, Tcl_Obj *nameObj); MODULE_SCOPE void TkRotatePoint(double originX, double originY, double sine, double cosine, double *xPtr, double *yPtr); MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, Tcl_Size, int lastOK, Tcl_Size*); -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) -# define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1) -# define TK_OPTION_UNDERLINE_DEF(type, field) "-1", TCL_INDEX_NONE, offsetof(type, field), 0, NULL -#else -# define TkNewIndexObj(value) (((Tcl_Size)(value) == TCL_INDEX_NONE) ? Tcl_NewObj() : Tcl_NewWideIntObj((Tcl_WideInt)(value))) -# define TK_OPTION_UNDERLINE_DEF(type, field) NULL, TCL_INDEX_NONE, offsetof(type, field), TK_OPTION_NULL_OK, NULL -#endif +#define TkNewIndexObj(value) (((Tcl_Size)(value) == TCL_INDEX_NONE) ? Tcl_NewObj() : Tcl_NewWideIntObj((Tcl_WideInt)(value))) +#define TK_OPTION_UNDERLINE_DEF(type, field) NULL, TCL_INDEX_NONE, offsetof(type, field), TK_OPTION_NULL_OK, NULL #ifdef _WIN32 @@ -1427,7 +1346,6 @@ MODULE_SCOPE Tcl_ObjCmdProc TkUnsupported1ObjCmd; * For Tktest. */ MODULE_SCOPE Tcl_ObjCmdProc SquareObjCmd; -MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp); #if !(defined(_WIN32) || defined(MAC_OSX_TK)) #define TkplatformtestInit(x) TCL_OK #else diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index d71885b..c1dc2eb 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -80,8 +80,8 @@ EXTERN TkCursor * TkCreateCursorFromData(Tk_Window tkwin, XColor fg, XColor bg); /* 13 */ EXTERN int TkCreateFrame(void *clientData, Tcl_Interp *interp, - Tcl_Size argc, const char *const *argv, - int toplevel, const char *appName); + Tcl_Size objc, Tcl_Obj *const objv[], + int type, const char *appName); /* 14 */ EXTERN Tk_Window TkCreateMainWindow(Tcl_Interp *interp, const char *screenName, const char *baseName); @@ -202,9 +202,7 @@ EXTERN void TkpClaimFocus(TkWindow *topLevelPtr, int force); EXTERN void TkpDisplayWarning(const char *msg, const char *title); /* 59 */ EXTERN void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name); -/* 60 */ -TK_DEPRECATED("renamed to Tk_GetOtherWindow") -TkWindow * TkpGetOtherWindow(TkWindow *winPtr); +/* Slot 60 is reserved */ /* 61 */ EXTERN TkWindow * TkpGetWrapperWindow(TkWindow *winPtr); /* 62 */ @@ -212,14 +210,10 @@ EXTERN int TkpInit(Tcl_Interp *interp); /* 63 */ EXTERN void TkpInitializeMenuBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable); -/* 64 */ -TK_DEPRECATED("renamed to Tk_MakeContainer") -void TkpMakeContainer(Tk_Window tkwin); +/* Slot 64 is reserved */ /* 65 */ EXTERN void TkpMakeMenuWindow(Tk_Window tkwin, int transient); -/* 66 */ -TK_DEPRECATED("renamed to Tk_MakeWindow") -Window TkpMakeWindow(TkWindow *winPtr, Window parent); +/* Slot 66 is reserved */ /* 67 */ EXTERN void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp, const char *menuName); @@ -238,14 +232,8 @@ EXTERN int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr); /* 73 */ EXTERN void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr); -/* 74 */ -TK_DEPRECATED("renamed to Tk_SetMainMenubar") -void TkpSetMainMenubar(Tcl_Interp *interp, - Tk_Window tkwin, const char *menuName); -/* 75 */ -TK_DEPRECATED("renamed to Tk_UseWindow") -int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, - const char *string); +/* Slot 74 is reserved */ +/* Slot 75 is reserved */ /* Slot 76 is reserved */ /* 77 */ EXTERN void TkQueueEventForAllChildren(TkWindow *winPtr, @@ -270,11 +258,7 @@ EXTERN void TkSelInit(Tk_Window tkwin); /* 83 */ EXTERN void TkSelPropProc(XEvent *eventPtr); /* Slot 84 is reserved */ -/* 85 */ -TK_DEPRECATED("renamed to Tk_SetWindowMenubar") -void TkSetWindowMenuBar(Tcl_Interp *interp, - Tk_Window tkwin, const char *oldMenuName, - const char *menuName); +/* Slot 85 is reserved */ /* 86 */ EXTERN KeySym TkStringToKeysym(const char *name); /* 87 */ @@ -335,10 +319,7 @@ EXTERN const char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 110 */ EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont); -/* 111 */ -TK_DEPRECATED("renamed to Tk_GetSystemDefault") -Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin, - const char *dbName, const char *className); +/* Slot 111 is reserved */ /* 112 */ EXTERN void TkpMenuThreadInit(void); /* 113 */ @@ -359,21 +340,15 @@ EXTERN int XSetRegion(Display *display, GC gc, Region rgn); EXTERN int XUnionRectWithRegion(XRectangle *rect, Region src, Region dr_return); /* Slot 120 is reserved */ -#ifdef MAC_OSX_TK /* AQUA */ /* 121 */ EXTERN Pixmap TkpCreateNativeBitmap(Display *display, const void *source); -#endif /* AQUA */ -#ifdef MAC_OSX_TK /* AQUA */ /* 122 */ EXTERN void TkpDefineNativeBitmaps(void); -#endif /* AQUA */ /* Slot 123 is reserved */ -#ifdef MAC_OSX_TK /* AQUA */ /* 124 */ EXTERN Pixmap TkpGetNativeAppBitmap(Display *display, const char *name, int *width, int *height); -#endif /* AQUA */ /* Slot 125 is reserved */ /* Slot 126 is reserved */ /* Slot 127 is reserved */ @@ -384,11 +359,7 @@ EXTERN Pixmap TkpGetNativeAppBitmap(Display *display, /* Slot 132 is reserved */ /* Slot 133 is reserved */ /* Slot 134 is reserved */ -/* 135 */ -TK_DEPRECATED("renamed to Tk_DrawHighlightBorder") -void TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC, - GC bgGC, int highlightWidth, - Drawable drawable); +/* Slot 135 is reserved */ /* 136 */ EXTERN void TkSetFocusWin(TkWindow *winPtr, int force); /* 137 */ @@ -592,7 +563,7 @@ typedef struct TkIntStubs { void (*reserved10)(void); void (*reserved11)(void); TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */ - int (*tkCreateFrame) (void *clientData, Tcl_Interp *interp, Tcl_Size argc, const char *const *argv, int toplevel, const char *appName); /* 13 */ + int (*tkCreateFrame) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int type, const char *appName); /* 13 */ Tk_Window (*tkCreateMainWindow) (Tcl_Interp *interp, const char *screenName, const char *baseName); /* 14 */ Time (*tkCurrentTime) (TkDisplay *dispPtr); /* 15 */ void (*tkDeleteAllImages) (TkMainInfo *mainPtr); /* 16 */ @@ -639,13 +610,13 @@ typedef struct TkIntStubs { void (*tkpClaimFocus) (TkWindow *topLevelPtr, int force); /* 57 */ void (*tkpDisplayWarning) (const char *msg, const char *title); /* 58 */ void (*tkpGetAppName) (Tcl_Interp *interp, Tcl_DString *name); /* 59 */ - TCL_DEPRECATED_API("renamed to Tk_GetOtherWindow") TkWindow * (*tkpGetOtherWindow) (TkWindow *winPtr); /* 60 */ + void (*reserved60)(void); TkWindow * (*tkpGetWrapperWindow) (TkWindow *winPtr); /* 61 */ int (*tkpInit) (Tcl_Interp *interp); /* 62 */ void (*tkpInitializeMenuBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable); /* 63 */ - TCL_DEPRECATED_API("renamed to Tk_MakeContainer") void (*tkpMakeContainer) (Tk_Window tkwin); /* 64 */ + void (*reserved64)(void); void (*tkpMakeMenuWindow) (Tk_Window tkwin, int transient); /* 65 */ - TCL_DEPRECATED_API("renamed to Tk_MakeWindow") Window (*tkpMakeWindow) (TkWindow *winPtr, Window parent); /* 66 */ + void (*reserved66)(void); void (*tkpMenuNotifyToplevelCreate) (Tcl_Interp *interp, const char *menuName); /* 67 */ TkDisplay * (*tkpOpenDisplay) (const char *display_name); /* 68 */ int (*tkPointerEvent) (XEvent *eventPtr, TkWindow *winPtr); /* 69 */ @@ -653,8 +624,8 @@ typedef struct TkIntStubs { double (*tkPolygonToPoint) (double *polyPtr, int numPoints, double *pointPtr); /* 71 */ int (*tkPositionInTree) (TkWindow *winPtr, TkWindow *treePtr); /* 72 */ void (*tkpRedirectKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 73 */ - TCL_DEPRECATED_API("renamed to Tk_SetMainMenubar") void (*tkpSetMainMenubar) (Tcl_Interp *interp, Tk_Window tkwin, const char *menuName); /* 74 */ - TCL_DEPRECATED_API("renamed to Tk_UseWindow") int (*tkpUseWindow) (Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* 75 */ + void (*reserved74)(void); + void (*reserved75)(void); void (*reserved76)(void); void (*tkQueueEventForAllChildren) (TkWindow *winPtr, XEvent *eventPtr); /* 77 */ int (*tkReadBitmapFile) (Display *display, Drawable d, const char *filename, unsigned int *width_return, unsigned int *height_return, Pixmap *bitmap_return, int *x_hot_return, int *y_hot_return); /* 78 */ @@ -664,7 +635,7 @@ typedef struct TkIntStubs { void (*tkSelInit) (Tk_Window tkwin); /* 82 */ void (*tkSelPropProc) (XEvent *eventPtr); /* 83 */ void (*reserved84)(void); - TCL_DEPRECATED_API("renamed to Tk_SetWindowMenubar") void (*tkSetWindowMenuBar) (Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName); /* 85 */ + void (*reserved85)(void); KeySym (*tkStringToKeysym) (const char *name); /* 86 */ int (*tkThickPolyLineToArea) (double *coordPtr, int numPoints, double width, int capStyle, int joinStyle, double *rectPtr); /* 87 */ void (*tkWmAddToColormapWindows) (TkWindow *winPtr); /* 88 */ @@ -690,7 +661,7 @@ typedef struct TkIntStubs { int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */ const char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */ void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */ - TCL_DEPRECATED_API("renamed to Tk_GetSystemDefault") Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */ + void (*reserved111)(void); void (*tkpMenuThreadInit) (void); /* 112 */ int (*xClipBox) (Region rgn, XRectangle *rect_return); /* 113 */ Region (*xCreateRegion) (void); /* 114 */ @@ -700,43 +671,10 @@ typedef struct TkIntStubs { int (*xSetRegion) (Display *display, GC gc, Region rgn); /* 118 */ int (*xUnionRectWithRegion) (XRectangle *rect, Region src, Region dr_return); /* 119 */ void (*reserved120)(void); -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ - void (*reserved121)(void); -#endif /* X11 */ -#if defined(_WIN32) /* WIN */ - void (*reserved121)(void); -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -# if TCL_MAJOR_VERSION < 9 - void (*reserved121)(void); /* Dummy entry for stubs table backwards compatibility */ -# endif /* TCL_MAJOR_VERSION < 9 */ Pixmap (*tkpCreateNativeBitmap) (Display *display, const void *source); /* 121 */ -#endif /* AQUA */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ - void (*reserved122)(void); -#endif /* X11 */ -#if defined(_WIN32) /* WIN */ - void (*reserved122)(void); -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -# if TCL_MAJOR_VERSION < 9 - void (*reserved122)(void); /* Dummy entry for stubs table backwards compatibility */ -# endif /* TCL_MAJOR_VERSION < 9 */ void (*tkpDefineNativeBitmaps) (void); /* 122 */ -#endif /* AQUA */ void (*reserved123)(void); -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ - void (*reserved124)(void); -#endif /* X11 */ -#if defined(_WIN32) /* WIN */ - void (*reserved124)(void); -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -# if TCL_MAJOR_VERSION < 9 - void (*reserved124)(void); /* Dummy entry for stubs table backwards compatibility */ -# endif /* TCL_MAJOR_VERSION < 9 */ Pixmap (*tkpGetNativeAppBitmap) (Display *display, const char *name, int *width, int *height); /* 124 */ -#endif /* AQUA */ void (*reserved125)(void); void (*reserved126)(void); void (*reserved127)(void); @@ -747,7 +685,7 @@ typedef struct TkIntStubs { void (*reserved132)(void); void (*reserved133)(void); void (*reserved134)(void); - TCL_DEPRECATED_API("renamed to Tk_DrawHighlightBorder") void (*tkpDrawHighlightBorder) (Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 135 */ + void (*reserved135)(void); void (*tkSetFocusWin) (TkWindow *winPtr, int force); /* 136 */ void (*tkpSetKeycodeAndState) (Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); /* 137 */ KeySym (*tkpGetKeySym) (TkDisplay *dispPtr, XEvent *eventPtr); /* 138 */ @@ -931,20 +869,17 @@ extern const TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkpDisplayWarning) /* 58 */ #define TkpGetAppName \ (tkIntStubsPtr->tkpGetAppName) /* 59 */ -#define TkpGetOtherWindow \ - (tkIntStubsPtr->tkpGetOtherWindow) /* 60 */ +/* Slot 60 is reserved */ #define TkpGetWrapperWindow \ (tkIntStubsPtr->tkpGetWrapperWindow) /* 61 */ #define TkpInit \ (tkIntStubsPtr->tkpInit) /* 62 */ #define TkpInitializeMenuBindings \ (tkIntStubsPtr->tkpInitializeMenuBindings) /* 63 */ -#define TkpMakeContainer \ - (tkIntStubsPtr->tkpMakeContainer) /* 64 */ +/* Slot 64 is reserved */ #define TkpMakeMenuWindow \ (tkIntStubsPtr->tkpMakeMenuWindow) /* 65 */ -#define TkpMakeWindow \ - (tkIntStubsPtr->tkpMakeWindow) /* 66 */ +/* Slot 66 is reserved */ #define TkpMenuNotifyToplevelCreate \ (tkIntStubsPtr->tkpMenuNotifyToplevelCreate) /* 67 */ #define TkpOpenDisplay \ @@ -959,10 +894,8 @@ extern const TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkPositionInTree) /* 72 */ #define TkpRedirectKeyEvent \ (tkIntStubsPtr->tkpRedirectKeyEvent) /* 73 */ -#define TkpSetMainMenubar \ - (tkIntStubsPtr->tkpSetMainMenubar) /* 74 */ -#define TkpUseWindow \ - (tkIntStubsPtr->tkpUseWindow) /* 75 */ +/* Slot 74 is reserved */ +/* Slot 75 is reserved */ /* Slot 76 is reserved */ #define TkQueueEventForAllChildren \ (tkIntStubsPtr->tkQueueEventForAllChildren) /* 77 */ @@ -979,8 +912,7 @@ extern const TkIntStubs *tkIntStubsPtr; #define TkSelPropProc \ (tkIntStubsPtr->tkSelPropProc) /* 83 */ /* Slot 84 is reserved */ -#define TkSetWindowMenuBar \ - (tkIntStubsPtr->tkSetWindowMenuBar) /* 85 */ +/* Slot 85 is reserved */ #define TkStringToKeysym \ (tkIntStubsPtr->tkStringToKeysym) /* 86 */ #define TkThickPolyLineToArea \ @@ -1031,8 +963,7 @@ extern const TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkpGetString) /* 109 */ #define TkpGetSubFonts \ (tkIntStubsPtr->tkpGetSubFonts) /* 110 */ -#define TkpGetSystemDefault \ - (tkIntStubsPtr->tkpGetSystemDefault) /* 111 */ +/* Slot 111 is reserved */ #define TkpMenuThreadInit \ (tkIntStubsPtr->tkpMenuThreadInit) /* 112 */ #define XClipBox \ @@ -1050,19 +981,13 @@ extern const TkIntStubs *tkIntStubsPtr; #define XUnionRectWithRegion \ (tkIntStubsPtr->xUnionRectWithRegion) /* 119 */ /* Slot 120 is reserved */ -#ifdef MAC_OSX_TK /* AQUA */ #define TkpCreateNativeBitmap \ (tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */ -#endif /* AQUA */ -#ifdef MAC_OSX_TK /* AQUA */ #define TkpDefineNativeBitmaps \ (tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */ -#endif /* AQUA */ /* Slot 123 is reserved */ -#ifdef MAC_OSX_TK /* AQUA */ #define TkpGetNativeAppBitmap \ (tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */ -#endif /* AQUA */ /* Slot 125 is reserved */ /* Slot 126 is reserved */ /* Slot 127 is reserved */ @@ -1073,8 +998,7 @@ extern const TkIntStubs *tkIntStubsPtr; /* Slot 132 is reserved */ /* Slot 133 is reserved */ /* Slot 134 is reserved */ -#define TkpDrawHighlightBorder \ - (tkIntStubsPtr->tkpDrawHighlightBorder) /* 135 */ +/* Slot 135 is reserved */ #define TkSetFocusWin \ (tkIntStubsPtr->tkSetFocusWin) /* 136 */ #define TkpSetKeycodeAndState \ @@ -1186,39 +1110,17 @@ extern const TkIntStubs *tkIntStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#undef TkpCmapStressed_ -#undef TkpSync_ -#undef TkUnixContainerId_ -#undef TkUnixDoOneXEvent_ -#undef TkUnixSetMenubar_ -#undef TkWmCleanup_ -#undef TkSendCleanup_ -#undef TkpTestsendCmd_ -#undef TkSetWindowMenuBar -#undef TkpDrawHighlightBorder -#undef TkpUseWindow -#undef TkpSetMainMenubar -#undef TkpGetOtherWindow -#undef TkpGetSystemDefault -#undef TkpMakeContainer -#undef TkpMakeWindow - -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION == 8) -# define TkSetWindowMenuBar Tk_SetWindowMenubar -# define TkpDrawHighlightBorder Tk_DrawHighlightBorder -# define TkpUseWindow Tk_UseWindow -# define TkpSetMainMenubar Tk_SetMainMenubar -# define TkpGetOtherWindow ((TkWindow *(*)(TkWindow *))(void *)Tk_GetOtherWindow) -# define TkpGetSystemDefault Tk_GetSystemDefault -# define TkpMakeContainer Tk_MakeContainer -# define TkpMakeWindow ((Window (*)(TkWindow *, Window))(void *)Tk_MakeWindow) -#endif - #if !defined(MAC_OSX_TK) && !defined(USE_TK_STUBS) # undef TkpWillDrawWidget # undef TkpRedrawWidget +# undef TkpDefineNativeBitmaps +# undef TkpCreateNativeBitmap +# undef TkpGetNativeAppBitmap # define TkpWillDrawWidget(w) 0 # define TkpRedrawWidget(w) +# define TkpDefineNativeBitmaps() +# define TkpCreateNativeBitmap(display, source) None +# define TkpGetNativeAppBitmap(display, name, w, h) None #endif #endif /* _TKINTDECLS */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index e87272e..4b93ab9 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -36,8 +36,7 @@ extern "C" { #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ -EXTERN char * TkAlignImageData(XImage *image, int alignment, - int bitOrder); +EXTERN void TkCreateXEventSource(void); /* Slot 1 is reserved */ /* 2 */ EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, @@ -114,7 +113,8 @@ EXTERN void TkWinDialogDebug(int debug); EXTERN Tcl_Obj * TkWinGetMenuSystemDefault(Tk_Window tkwin, const char *dbName, const char *className); /* 33 */ -EXTERN int TkWinGetPlatformId(void); +EXTERN char * TkAlignImageData(XImage *image, int alignment, + int bitOrder); /* 34 */ EXTERN void TkWinSetHINSTANCE(HINSTANCE hInstance); /* 35 */ @@ -122,8 +122,7 @@ EXTERN int TkWinGetPlatformTheme(void); /* 36 */ EXTERN LRESULT __stdcall TkWinChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -/* 37 */ -EXTERN void TkCreateXEventSource(void); +/* Slot 37 is reserved */ /* 38 */ EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); /* 39 */ @@ -146,30 +145,31 @@ EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, EXTERN Tk_Window TkpGetCapture(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ -/* 0 */ -EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, - int active); -/* Slot 1 is reserved */ +/* Slot 0 is reserved */ +/* 1 */ +EXTERN void TkAboutDlg(void); /* 2 */ -EXTERN void TkGenerateActivateEvents_(TkWindow *winPtr, +EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, int active); /* 3 */ -EXTERN void TkPointerDeadWindow(TkWindow *winPtr); +EXTERN unsigned long TkpGetMS(void); /* 4 */ -EXTERN void TkpSetCapture(TkWindow *winPtr); +EXTERN void TkPointerDeadWindow(TkWindow *winPtr); /* 5 */ EXTERN void TkpSetCursor(TkpCursor cursor); /* 6 */ -EXTERN void TkpWmSetState(TkWindow *winPtr, int state); +EXTERN int TkpScanWindowId(Tcl_Interp *interp, + const char *string, Window *idPtr); /* 7 */ -EXTERN void TkAboutDlg(void); +EXTERN int TkpWmSetState(TkWindow *winPtr, int state); /* 8 */ EXTERN unsigned int TkMacOSXButtonKeyState(void); /* 9 */ EXTERN void TkMacOSXClearMenubarActive(void); /* 10 */ EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index); -/* Slot 11 is reserved */ +/* 11 */ +EXTERN void TkpSetCapture(TkWindow *winPtr); /* 12 */ EXTERN void TkMacOSXHandleTearoffMenu(void); /* Slot 13 is reserved */ @@ -188,9 +188,7 @@ EXTERN void TkMacOSXHandleMenuSelect(short theMenu, /* 21 */ EXTERN void TkMacOSXInvalidateWindow(MacDrawable *macWin, int flag); -/* 22 */ -EXTERN int TkMacOSXIsCharacterMissing(Tk_Font tkfont, - unsigned int searchChar); +/* Slot 22 is reserved */ /* 23 */ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr); /* 24 */ @@ -204,8 +202,7 @@ EXTERN int TkMacOSXResizable(TkWindow *winPtr); EXTERN void TkMacOSXSetHelpMenuItemCount(void); /* 29 */ EXTERN void TkMacOSXSetScrollbarGrow(TkWindow *winPtr, int flag); -/* 30 */ -EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable); +/* Slot 30 is reserved */ /* 31 */ EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort); /* 32 */ @@ -251,13 +248,6 @@ EXTERN int TkGenerateButtonEvent(int x, int y, Window window, EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin); /* 52 */ EXTERN void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag); -/* 53 */ -EXTERN unsigned long TkpGetMS(void); -/* 54 */ -EXTERN void * TkMacOSXDrawable(Drawable drawable); -/* 55 */ -EXTERN int TkpScanWindowId(Tcl_Interp *interp, - const char *string, Window *idPtr); #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ @@ -266,29 +256,20 @@ EXTERN void TkCreateXEventSource(void); /* 2 */ EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, int active); -/* 3 */ -EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); -/* 4 */ -EXTERN void TkpSync(Display *display); -/* 5 */ -EXTERN Window TkUnixContainerId(TkWindow *winPtr); +/* Slot 3 is reserved */ +/* Slot 4 is reserved */ +/* Slot 5 is reserved */ /* 6 */ -EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr); -/* 7 */ -EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); -/* 8 */ EXTERN int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr); +/* Slot 7 is reserved */ +/* Slot 8 is reserved */ /* 9 */ -EXTERN void TkWmCleanup(TkDisplay *dispPtr); -/* 10 */ -EXTERN void TkSendCleanup(TkDisplay *dispPtr); -/* Slot 11 is reserved */ -/* 12 */ EXTERN int TkpWmSetState(TkWindow *winPtr, int state); -/* 13 */ -EXTERN int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, - Tcl_Size objc, Tcl_Obj *const objv[]); +/* Slot 10 is reserved */ +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ +/* Slot 13 is reserved */ /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* Slot 16 is reserved */ @@ -314,19 +295,19 @@ EXTERN int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* 38 */ -EXTERN int TkpCmapStressed_(Tk_Window tkwin, Colormap colormap); +EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); /* 39 */ -EXTERN void TkpSync_(Display *display); +EXTERN void TkpSync(Display *display); /* 40 */ -EXTERN Window TkUnixContainerId_(TkWindow *winPtr); +EXTERN Window TkUnixContainerId(TkWindow *winPtr); /* 41 */ -EXTERN int TkUnixDoOneXEvent_(Tcl_Time *timePtr); +EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr); /* 42 */ -EXTERN void TkUnixSetMenubar_(Tk_Window tkwin, Tk_Window menubar); +EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); /* 43 */ -EXTERN void TkWmCleanup_(TkDisplay *dispPtr); +EXTERN void TkWmCleanup(TkDisplay *dispPtr); /* 44 */ -EXTERN void TkSendCleanup_(TkDisplay *dispPtr); +EXTERN void TkSendCleanup(TkDisplay *dispPtr); /* 45 */ EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); @@ -337,7 +318,7 @@ typedef struct TkIntPlatStubs { void *hooks; #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ - char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 0 */ + void (*tkCreateXEventSource) (void); /* 0 */ void (*reserved1)(void); void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ unsigned long (*tkpGetMS) (void); /* 3 */ @@ -370,11 +351,11 @@ typedef struct TkIntPlatStubs { void (*tkWinSetForegroundWindow) (TkWindow *winPtr); /* 30 */ void (*tkWinDialogDebug) (int debug); /* 31 */ Tcl_Obj * (*tkWinGetMenuSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 32 */ - int (*tkWinGetPlatformId) (void); /* 33 */ + char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 33 */ void (*tkWinSetHINSTANCE) (HINSTANCE hInstance); /* 34 */ int (*tkWinGetPlatformTheme) (void); /* 35 */ LRESULT (__stdcall *tkWinChildProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */ - void (*tkCreateXEventSource) (void); /* 37 */ + void (*reserved37)(void); int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 38 */ void (*tkpSync) (Display *display); /* 39 */ Window (*tkUnixContainerId) (TkWindow *winPtr); /* 40 */ @@ -387,18 +368,18 @@ typedef struct TkIntPlatStubs { Tk_Window (*tkpGetCapture) (void); /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 0 */ - void (*reserved1)(void); - void (*tkGenerateActivateEvents_) (TkWindow *winPtr, int active); /* 2 */ - void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 3 */ - void (*tkpSetCapture) (TkWindow *winPtr); /* 4 */ + void (*reserved0)(void); + void (*tkAboutDlg) (void); /* 1 */ + void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ + unsigned long (*tkpGetMS) (void); /* 3 */ + void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 4 */ void (*tkpSetCursor) (TkpCursor cursor); /* 5 */ - void (*tkpWmSetState) (TkWindow *winPtr, int state); /* 6 */ - void (*tkAboutDlg) (void); /* 7 */ + int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 6 */ + int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 7 */ unsigned int (*tkMacOSXButtonKeyState) (void); /* 8 */ void (*tkMacOSXClearMenubarActive) (void); /* 9 */ int (*tkMacOSXDispatchMenuEvent) (int menuID, int index); /* 10 */ - void (*reserved11)(void); + void (*tkpSetCapture) (TkWindow *winPtr); /* 11 */ void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */ void (*reserved13)(void); int (*tkMacOSXDoHLEvent) (void *theEvent); /* 14 */ @@ -409,7 +390,7 @@ typedef struct TkIntPlatStubs { void (*reserved19)(void); void (*reserved20)(void); void (*tkMacOSXInvalidateWindow) (MacDrawable *macWin, int flag); /* 21 */ - int (*tkMacOSXIsCharacterMissing) (Tk_Font tkfont, unsigned int searchChar); /* 22 */ + void (*reserved22)(void); void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */ void * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */ void (*tkMacOSXMenuClick) (void); /* 25 */ @@ -417,7 +398,7 @@ typedef struct TkIntPlatStubs { int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */ void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */ void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */ - void (*tkMacOSXSetUpClippingRgn) (Drawable drawable); /* 30 */ + void (*reserved30)(void); void (*tkMacOSXSetUpGraphicsPort) (GC gc, void *destPort); /* 31 */ void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */ void (*reserved33)(void); @@ -440,25 +421,22 @@ typedef struct TkIntPlatStubs { int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */ void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */ - unsigned long (*tkpGetMS) (void); /* 53 */ - void * (*tkMacOSXDrawable) (Drawable drawable); /* 54 */ - int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 55 */ #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) (void); /* 0 */ void (*reserved1)(void); void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ - int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 3 */ - void (*tkpSync) (Display *display); /* 4 */ - Window (*tkUnixContainerId) (TkWindow *winPtr); /* 5 */ - int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 6 */ - void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 7 */ - int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 8 */ - void (*tkWmCleanup) (TkDisplay *dispPtr); /* 9 */ - void (*tkSendCleanup) (TkDisplay *dispPtr); /* 10 */ + void (*reserved3)(void); + void (*reserved4)(void); + void (*reserved5)(void); + int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 6 */ + void (*reserved7)(void); + void (*reserved8)(void); + int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 9 */ + void (*reserved10)(void); void (*reserved11)(void); - int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 12 */ - int (*tkpTestsendCmd_) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 13 */ + void (*reserved12)(void); + void (*reserved13)(void); void (*reserved14)(void); void (*reserved15)(void); void (*reserved16)(void); @@ -483,13 +461,13 @@ typedef struct TkIntPlatStubs { void (*reserved35)(void); void (*reserved36)(void); void (*reserved37)(void); - int (*tkpCmapStressed_) (Tk_Window tkwin, Colormap colormap); /* 38 */ - void (*tkpSync_) (Display *display); /* 39 */ - Window (*tkUnixContainerId_) (TkWindow *winPtr); /* 40 */ - int (*tkUnixDoOneXEvent_) (Tcl_Time *timePtr); /* 41 */ - void (*tkUnixSetMenubar_) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ - void (*tkWmCleanup_) (TkDisplay *dispPtr); /* 43 */ - void (*tkSendCleanup_) (TkDisplay *dispPtr); /* 44 */ + int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 38 */ + void (*tkpSync) (Display *display); /* 39 */ + Window (*tkUnixContainerId) (TkWindow *winPtr); /* 40 */ + int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 41 */ + void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ + void (*tkWmCleanup) (TkDisplay *dispPtr); /* 43 */ + void (*tkSendCleanup) (TkDisplay *dispPtr); /* 44 */ int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 45 */ #endif /* X11 */ } TkIntPlatStubs; @@ -507,8 +485,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ -#define TkAlignImageData \ - (tkIntPlatStubsPtr->tkAlignImageData) /* 0 */ +#define TkCreateXEventSource \ + (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ /* Slot 1 is reserved */ #define TkGenerateActivateEvents \ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ @@ -572,16 +550,15 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkWinDialogDebug) /* 31 */ #define TkWinGetMenuSystemDefault \ (tkIntPlatStubsPtr->tkWinGetMenuSystemDefault) /* 32 */ -#define TkWinGetPlatformId \ - (tkIntPlatStubsPtr->tkWinGetPlatformId) /* 33 */ +#define TkAlignImageData \ + (tkIntPlatStubsPtr->tkAlignImageData) /* 33 */ #define TkWinSetHINSTANCE \ (tkIntPlatStubsPtr->tkWinSetHINSTANCE) /* 34 */ #define TkWinGetPlatformTheme \ (tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */ #define TkWinChildProc \ (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */ -#define TkCreateXEventSource \ - (tkIntPlatStubsPtr->tkCreateXEventSource) /* 37 */ +/* Slot 37 is reserved */ #define TkpCmapStressed \ (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ #define TkpSync \ @@ -603,28 +580,29 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ +/* Slot 0 is reserved */ +#define TkAboutDlg \ + (tkIntPlatStubsPtr->tkAboutDlg) /* 1 */ #define TkGenerateActivateEvents \ - (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 0 */ -/* Slot 1 is reserved */ -#define TkGenerateActivateEvents_ \ - (tkIntPlatStubsPtr->tkGenerateActivateEvents_) /* 2 */ + (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ +#define TkpGetMS \ + (tkIntPlatStubsPtr->tkpGetMS) /* 3 */ #define TkPointerDeadWindow \ - (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 3 */ -#define TkpSetCapture \ - (tkIntPlatStubsPtr->tkpSetCapture) /* 4 */ + (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 4 */ #define TkpSetCursor \ (tkIntPlatStubsPtr->tkpSetCursor) /* 5 */ +#define TkpScanWindowId \ + (tkIntPlatStubsPtr->tkpScanWindowId) /* 6 */ #define TkpWmSetState \ - (tkIntPlatStubsPtr->tkpWmSetState) /* 6 */ -#define TkAboutDlg \ - (tkIntPlatStubsPtr->tkAboutDlg) /* 7 */ + (tkIntPlatStubsPtr->tkpWmSetState) /* 7 */ #define TkMacOSXButtonKeyState \ (tkIntPlatStubsPtr->tkMacOSXButtonKeyState) /* 8 */ #define TkMacOSXClearMenubarActive \ (tkIntPlatStubsPtr->tkMacOSXClearMenubarActive) /* 9 */ #define TkMacOSXDispatchMenuEvent \ (tkIntPlatStubsPtr->tkMacOSXDispatchMenuEvent) /* 10 */ -/* Slot 11 is reserved */ +#define TkpSetCapture \ + (tkIntPlatStubsPtr->tkpSetCapture) /* 11 */ #define TkMacOSXHandleTearoffMenu \ (tkIntPlatStubsPtr->tkMacOSXHandleTearoffMenu) /* 12 */ /* Slot 13 is reserved */ @@ -641,8 +619,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; /* Slot 20 is reserved */ #define TkMacOSXInvalidateWindow \ (tkIntPlatStubsPtr->tkMacOSXInvalidateWindow) /* 21 */ -#define TkMacOSXIsCharacterMissing \ - (tkIntPlatStubsPtr->tkMacOSXIsCharacterMissing) /* 22 */ +/* Slot 22 is reserved */ #define TkMacOSXMakeRealWindowExist \ (tkIntPlatStubsPtr->tkMacOSXMakeRealWindowExist) /* 23 */ #define TkMacOSXMakeStippleMap \ @@ -656,8 +633,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkMacOSXSetHelpMenuItemCount) /* 28 */ #define TkMacOSXSetScrollbarGrow \ (tkIntPlatStubsPtr->tkMacOSXSetScrollbarGrow) /* 29 */ -#define TkMacOSXSetUpClippingRgn \ - (tkIntPlatStubsPtr->tkMacOSXSetUpClippingRgn) /* 30 */ +/* Slot 30 is reserved */ #define TkMacOSXSetUpGraphicsPort \ (tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */ #define TkMacOSXUpdateClipRgn \ @@ -699,12 +675,6 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkGenWMDestroyEvent) /* 51 */ #define TkMacOSXSetDrawingEnabled \ (tkIntPlatStubsPtr->tkMacOSXSetDrawingEnabled) /* 52 */ -#define TkpGetMS \ - (tkIntPlatStubsPtr->tkpGetMS) /* 53 */ -#define TkMacOSXDrawable \ - (tkIntPlatStubsPtr->tkMacOSXDrawable) /* 54 */ -#define TkpScanWindowId \ - (tkIntPlatStubsPtr->tkpScanWindowId) /* 55 */ #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ #define TkCreateXEventSource \ @@ -712,27 +682,19 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; /* Slot 1 is reserved */ #define TkGenerateActivateEvents \ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ -#define TkpCmapStressed \ - (tkIntPlatStubsPtr->tkpCmapStressed) /* 3 */ -#define TkpSync \ - (tkIntPlatStubsPtr->tkpSync) /* 4 */ -#define TkUnixContainerId \ - (tkIntPlatStubsPtr->tkUnixContainerId) /* 5 */ -#define TkUnixDoOneXEvent \ - (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 6 */ -#define TkUnixSetMenubar \ - (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 7 */ +/* Slot 3 is reserved */ +/* Slot 4 is reserved */ +/* Slot 5 is reserved */ #define TkpScanWindowId \ - (tkIntPlatStubsPtr->tkpScanWindowId) /* 8 */ -#define TkWmCleanup \ - (tkIntPlatStubsPtr->tkWmCleanup) /* 9 */ -#define TkSendCleanup \ - (tkIntPlatStubsPtr->tkSendCleanup) /* 10 */ -/* Slot 11 is reserved */ + (tkIntPlatStubsPtr->tkpScanWindowId) /* 6 */ +/* Slot 7 is reserved */ +/* Slot 8 is reserved */ #define TkpWmSetState \ - (tkIntPlatStubsPtr->tkpWmSetState) /* 12 */ -#define TkpTestsendCmd_ \ - (tkIntPlatStubsPtr->tkpTestsendCmd_) /* 13 */ + (tkIntPlatStubsPtr->tkpWmSetState) /* 9 */ +/* Slot 10 is reserved */ +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ +/* Slot 13 is reserved */ /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* Slot 16 is reserved */ @@ -757,20 +719,20 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; /* Slot 35 is reserved */ /* Slot 36 is reserved */ /* Slot 37 is reserved */ -#define TkpCmapStressed_ \ - (tkIntPlatStubsPtr->tkpCmapStressed_) /* 38 */ -#define TkpSync_ \ - (tkIntPlatStubsPtr->tkpSync_) /* 39 */ -#define TkUnixContainerId_ \ - (tkIntPlatStubsPtr->tkUnixContainerId_) /* 40 */ -#define TkUnixDoOneXEvent_ \ - (tkIntPlatStubsPtr->tkUnixDoOneXEvent_) /* 41 */ -#define TkUnixSetMenubar_ \ - (tkIntPlatStubsPtr->tkUnixSetMenubar_) /* 42 */ -#define TkWmCleanup_ \ - (tkIntPlatStubsPtr->tkWmCleanup_) /* 43 */ -#define TkSendCleanup_ \ - (tkIntPlatStubsPtr->tkSendCleanup_) /* 44 */ +#define TkpCmapStressed \ + (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ +#define TkpSync \ + (tkIntPlatStubsPtr->tkpSync) /* 39 */ +#define TkUnixContainerId \ + (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ +#define TkUnixDoOneXEvent \ + (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */ +#define TkUnixSetMenubar \ + (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */ +#define TkWmCleanup \ + (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */ +#define TkSendCleanup \ + (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ #define TkpTestsendCmd \ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ #endif /* X11 */ @@ -779,23 +741,11 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; /* !END!: Do not edit above this line. */ -#undef TkpCmapStressed_ -#undef TkpSync_ -#undef TkUnixContainerId_ -#undef TkUnixDoOneXEvent_ -#undef TkUnixSetMenubar_ -#undef TkWmCleanup_ -#undef TkSendCleanup_ -#undef TkpTestsendCmd_ -#undef TkGenerateActivateEvents_ -#undef TkMacOSXSetUpClippingRgn -#undef TkMacOSXIsCharacterMissing -#define TkMacOSXIsCharacterMissing(tkfont) ((void)tkfont, 0) +#ifndef TK_NO_DEPRECATED +# define TkMacOSXDrawable Tk_MacOSXGetNSWindowForDrawable +#endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#undef TkWinGetPlatformId -#define TkWinGetPlatformId() (2) /* VER_PLATFORM_WIN32_NT */ - #endif /* _TKINTPLATDECLS */ diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index b935f0a..39258ba 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -498,284 +498,283 @@ EXTERN char * XKeysymToString(KeySym k); EXTERN Colormap XCreateColormap(Display *d, Window w, Visual *v, int i); /* 7 */ -EXTERN GContext XGContextFromGC(GC g); +EXTERN Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2, + XColor *x1, XColor *x2, unsigned int ui1, + unsigned int ui2); /* 8 */ -EXTERN KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i); +EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, + unsigned int ui1, unsigned int ui2, + XColor _Xconst *x1, XColor _Xconst *x2); /* 9 */ -EXTERN KeySym XStringToKeysym(_Xconst char *c); +EXTERN GContext XGContextFromGC(GC g); /* 10 */ -EXTERN Window XRootWindow(Display *d, int i); +EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b); /* 11 */ -EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x); +EXTERN KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i); /* 12 */ -EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp); +EXTERN KeySym XStringToKeysym(_Xconst char *c); /* 13 */ -EXTERN int XBell(Display *d, int i); +EXTERN Window XRootWindow(Display *d, int i); /* 14 */ +EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x); +/* 15 */ +EXTERN Status XIconifyWindow(Display *d, Window w, int i); +/* 16 */ +EXTERN Status XWithdrawWindow(Display *d, Window w, int i); +/* 17 */ +EXTERN Status XGetWMColormapWindows(Display *d, Window w, + Window **wpp, int *ip); +/* 18 */ +EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp); +/* 19 */ +EXTERN int XBell(Display *d, int i); +/* 20 */ EXTERN int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); -/* 15 */ +/* 21 */ EXTERN int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); -/* 16 */ +/* 22 */ +EXTERN int XClearWindow(Display *d, Window w); +/* 23 */ EXTERN int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x); -/* 17 */ +/* 24 */ EXTERN int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); -/* 18 */ +/* 25 */ EXTERN int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); -/* 19 */ +/* 26 */ EXTERN Pixmap XCreateBitmapFromData(Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); -/* 20 */ +/* 27 */ EXTERN int XDefineCursor(Display *d, Window w, Cursor c); -/* 21 */ +/* 28 */ +EXTERN int XDeleteProperty(Display *d, Window w, Atom a); +/* 29 */ EXTERN int XDestroyWindow(Display *d, Window w); -/* 22 */ +/* 30 */ EXTERN int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); -/* 23 */ +/* 31 */ EXTERN int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); -/* 24 */ +/* 32 */ EXTERN int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); -/* 25 */ +/* 33 */ EXTERN int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); -/* 26 */ +/* 34 */ EXTERN int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); -/* 27 */ +/* 35 */ EXTERN int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i); -/* 28 */ +/* 36 */ +EXTERN int XForceScreenSaver(Display *d, int i); +/* 37 */ EXTERN int XFreeColormap(Display *d, Colormap c); -/* 29 */ +/* 38 */ EXTERN int XFreeColors(Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); -/* 30 */ +/* 39 */ +EXTERN int XFreeCursor(Display *d, Cursor c); +/* 40 */ EXTERN int XFreeModifiermap(XModifierKeymap *x); -/* 31 */ +/* 41 */ EXTERN Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); -/* 32 */ +/* 42 */ +EXTERN int XGetInputFocus(Display *d, Window *w, int *i); +/* 43 */ EXTERN int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); -/* 33 */ +/* 44 */ +EXTERN Status XGetWindowAttributes(Display *d, Window w, + XWindowAttributes *x); +/* 45 */ EXTERN int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t); -/* 34 */ +/* 46 */ EXTERN int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); -/* 35 */ +/* 47 */ EXTERN KeyCode XKeysymToKeycode(Display *d, KeySym k); -/* 36 */ +/* 48 */ +EXTERN Status XLookupColor(Display *d, Colormap c1, + _Xconst char *c2, XColor *x1, XColor *x2); +/* 49 */ EXTERN int XMapWindow(Display *d, Window w); -/* 37 */ +/* 50 */ EXTERN int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); -/* 38 */ +/* 51 */ EXTERN int XMoveWindow(Display *d, Window w, int i1, int i2); -/* 39 */ +/* 52 */ +EXTERN int XNextEvent(Display *d, XEvent *x); +/* 53 */ +EXTERN int XPutBackEvent(Display *d, XEvent *x); +/* 54 */ +EXTERN int XQueryColors(Display *d, Colormap c, XColor *x, + int i); +/* 55 */ EXTERN Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); -/* 40 */ +/* 56 */ +EXTERN Status XQueryTree(Display *d, Window w1, Window *w2, + Window *w3, Window **w4, unsigned int *ui); +/* 57 */ EXTERN int XRaiseWindow(Display *d, Window w); -/* 41 */ +/* 58 */ EXTERN int XRefreshKeyboardMapping(XMappingEvent *x); -/* 42 */ +/* 59 */ EXTERN int XResizeWindow(Display *d, Window w, unsigned int ui1, unsigned int ui2); -/* 43 */ +/* 60 */ EXTERN int XSelectInput(Display *d, Window w, long l); -/* 44 */ +/* 61 */ EXTERN Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x); -/* 45 */ +/* 62 */ +EXTERN int XSetCommand(Display *d, Window w, char **c, int i); +/* 63 */ EXTERN int XSetIconName(Display *d, Window w, _Xconst char *c); -/* 46 */ +/* 64 */ EXTERN int XSetInputFocus(Display *d, Window w, int i, Time t); -/* 47 */ +/* 65 */ EXTERN int XSetSelectionOwner(Display *d, Atom a, Window w, Time t); -/* 48 */ +/* 66 */ EXTERN int XSetWindowBackground(Display *d, Window w, unsigned long ul); -/* 49 */ +/* 67 */ EXTERN int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p); -/* 50 */ +/* 68 */ EXTERN int XSetWindowBorder(Display *d, Window w, unsigned long ul); -/* 51 */ +/* 69 */ EXTERN int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p); -/* 52 */ +/* 70 */ EXTERN int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui); -/* 53 */ +/* 71 */ EXTERN int XSetWindowColormap(Display *d, Window w, Colormap c); -/* 54 */ +/* 72 */ +EXTERN Bool XTranslateCoordinates(Display *d, Window w1, + Window w2, int i1, int i2, int *i3, int *i4, + Window *w3); +/* 73 */ EXTERN int XUngrabKeyboard(Display *d, Time t); -/* 55 */ +/* 74 */ EXTERN int XUngrabPointer(Display *d, Time t); -/* 56 */ +/* 75 */ EXTERN int XUnmapWindow(Display *d, Window w); -/* 57 */ +/* 76 */ +EXTERN int XWindowEvent(Display *d, Window w, long l, XEvent *x); +/* 77 */ +EXTERN void XDestroyIC(XIC x); +/* 78 */ +EXTERN Bool XFilterEvent(XEvent *x, Window w); +/* 79 */ +EXTERN int XmbLookupString(XIC xi, XKeyPressedEvent *xk, + char *c, int i, KeySym *k, Status *s); +/* 80 */ EXTERN int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); -/* 58 */ +/* 81 */ +EXTERN int XSetClipRectangles(Display *display, GC gc, + int clip_x_origin, int clip_y_origin, + XRectangle rectangles[], int n, int ordering); +/* 82 */ EXTERN Status XParseColor(Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); -/* 59 */ +/* 83 */ EXTERN GC XCreateGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values); -/* 60 */ +/* 84 */ EXTERN int XFreeGC(Display *display, GC gc); -/* 61 */ +/* 85 */ EXTERN Atom XInternAtom(Display *display, _Xconst char *atom_name, Bool only_if_exists); -/* 62 */ +/* 86 */ EXTERN int XSetBackground(Display *display, GC gc, unsigned long foreground); -/* 63 */ +/* 87 */ EXTERN int XSetForeground(Display *display, GC gc, unsigned long foreground); -/* 64 */ +/* 88 */ EXTERN int XSetClipMask(Display *display, GC gc, Pixmap pixmap); -/* 65 */ +/* 89 */ EXTERN int XSetClipOrigin(Display *display, GC gc, int clip_x_origin, int clip_y_origin); -/* 66 */ +/* 90 */ EXTERN int XSetTSOrigin(Display *display, GC gc, int ts_x_origin, int ts_y_origin); -/* 67 */ +/* 91 */ EXTERN int XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values); -/* 68 */ +/* 92 */ EXTERN int XSetFont(Display *display, GC gc, Font font); -/* 69 */ +/* 93 */ EXTERN int XSetArcMode(Display *display, GC gc, int arc_mode); -/* 70 */ +/* 94 */ EXTERN int XSetStipple(Display *display, GC gc, Pixmap stipple); -/* 71 */ +/* 95 */ EXTERN int XSetFillRule(Display *display, GC gc, int fill_rule); -/* 72 */ +/* 96 */ EXTERN int XSetFillStyle(Display *display, GC gc, int fill_style); -/* 73 */ +/* 97 */ EXTERN int XSetFunction(Display *display, GC gc, int function); -/* 74 */ +/* 98 */ EXTERN int XSetLineAttributes(Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); -/* 75 */ +/* 99 */ EXTERN int _XInitImageFuncPtrs(XImage *image); -/* 76 */ +/* 100 */ EXTERN XIC XCreateIC(XIM xim, ...); -/* 77 */ +/* 101 */ EXTERN XVisualInfo * XGetVisualInfo(Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); -/* 78 */ +/* 102 */ EXTERN void XSetWMClientMachine(Display *display, Window w, XTextProperty *text_prop); -/* 79 */ +/* 103 */ EXTERN Status XStringListToTextProperty(char **list, int count, XTextProperty *text_prop_return); -/* 80 */ -EXTERN int XDrawSegments(Display *display, Drawable d, GC gc, - XSegment *segments, int nsegments); -/* 81 */ -EXTERN int XForceScreenSaver(Display *display, int mode); -/* 82 */ +/* 104 */ EXTERN int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); -/* 83 */ +/* 105 */ +EXTERN int XWarpPointer(Display *d, Window s, Window dw, int sx, + int sy, unsigned int sw, unsigned int sh, + int dx, int dy); +/* 106 */ EXTERN int XFillRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); -/* 84 */ -EXTERN int XClearWindow(Display *d, Window w); -/* 85 */ -EXTERN int XDrawPoint(Display *display, Drawable d, GC gc, - int x, int y); -/* 86 */ -EXTERN int XDrawPoints(Display *display, Drawable d, GC gc, - XPoint *points, int npoints, int mode); -/* 87 */ -EXTERN int XWarpPointer(Display *display, Window src_w, - Window dest_w, int src_x, int src_y, - unsigned int src_width, - unsigned int src_height, int dest_x, - int dest_y); -/* 88 */ -EXTERN int XQueryColor(Display *display, Colormap colormap, - XColor *def_in_out); -/* 89 */ -EXTERN int XQueryColors(Display *display, Colormap colormap, - XColor *defs_in_out, int ncolors); -/* 90 */ -EXTERN Status XQueryTree(Display *d, Window w1, Window *w2, - Window *w3, Window **w4, unsigned int *ui); -/* 91 */ -EXTERN int XSync(Display *display, Bool discard); -/* 92 */ -EXTERN Bool XTranslateCoordinates(Display *d, Window w1, - Window w2, int i1, int i2, int *i3, int *i4, - Window *w3); -/* 93 */ -EXTERN int XDeleteProperty(Display *d, Window w, Atom a); -/* 94 */ -EXTERN int XFreeCursor(Display *d, Cursor c); -/* 95 */ -EXTERN int XGetInputFocus(Display *d, Window *w, int *i); -/* 96 */ -EXTERN int XmbLookupString(XIC xi, XKeyPressedEvent *xk, - char *c, int i, KeySym *k, Status *s); -/* 97 */ -EXTERN int XNextEvent(Display *d, XEvent *x); -/* 98 */ -EXTERN int XPutBackEvent(Display *d, XEvent *x); -/* 99 */ -EXTERN int XSetCommand(Display *d, Window w, char **c, int i); -/* 100 */ -EXTERN int XWindowEvent(Display *d, Window w, long l, XEvent *x); -/* 101 */ -EXTERN Status XGetWindowAttributes(Display *d, Window w, - XWindowAttributes *x); -/* 102 */ -EXTERN Status XGetWMColormapWindows(Display *d, Window w, - Window **wpp, int *ip); -/* 103 */ -EXTERN Status XIconifyWindow(Display *d, Window w, int i); -/* 104 */ -EXTERN Status XWithdrawWindow(Display *d, Window w, int i); -/* 105 */ -EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b); -/* 106 */ -EXTERN int XSetClipRectangles(Display *display, GC gc, - int clip_x_origin, int clip_y_origin, - XRectangle rectangles[], int n, int ordering); /* 107 */ EXTERN int XFlush(Display *display); /* 108 */ @@ -789,8 +788,7 @@ EXTERN int XNoOp(Display *display); /* 112 */ EXTERN XAfterFunction XSynchronize(Display *display, Bool onoff); /* 113 */ -EXTERN Status XLookupColor(Display *d, Colormap c1, - _Xconst char *c2, XColor *x1, XColor *x2); +EXTERN int XSync(Display *display, Bool discard); /* 114 */ EXTERN VisualID XVisualIDFromVisual(Visual *visual); /* Slot 115 is reserved */ @@ -828,9 +826,15 @@ EXTERN int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, /* 132 */ EXTERN int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n); -/* Slot 133 is reserved */ -/* Slot 134 is reserved */ -/* Slot 135 is reserved */ +/* 133 */ +EXTERN int XDrawSegments(Display *d, Drawable dr, GC gc, + XSegment *s, int n); +/* 134 */ +EXTERN int XDrawPoint(Display *d, Drawable dr, GC gc, int x, + int y); +/* 135 */ +EXTERN int XDrawPoints(Display *d, Drawable dr, GC gc, + XPoint *p, int n, int m); /* 136 */ EXTERN int XReparentWindow(Display *d, Window w, Window p, int x, int y); @@ -850,16 +854,9 @@ EXTERN char * XSetICValues(XIC xic, ...); EXTERN char * XGetICValues(XIC xic, ...); /* 143 */ EXTERN void XSetICFocus(XIC xic); -/* 144 */ -EXTERN void XDestroyIC(XIC xic); -/* 145 */ -EXTERN Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2, - XColor *x1, XColor *x2, unsigned int ui1, - unsigned int ui2); -/* 146 */ -EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, - unsigned int ui1, unsigned int ui2, - XColor _Xconst *x1, XColor _Xconst *x2); +/* Slot 144 is reserved */ +/* Slot 145 is reserved */ +/* Slot 146 is reserved */ /* 147 */ EXTERN void XFreeFontSet(Display *display, XFontSet fontset); /* 148 */ @@ -1073,113 +1070,113 @@ typedef struct TkIntXlibStubs { char * (*xGetAtomName) (Display *d, Atom a); /* 4 */ char * (*xKeysymToString) (KeySym k); /* 5 */ Colormap (*xCreateColormap) (Display *d, Window w, Visual *v, int i); /* 6 */ - GContext (*xGContextFromGC) (GC g); /* 7 */ - KeySym (*xKeycodeToKeysym) (Display *d, unsigned int k, int i); /* 8 */ - KeySym (*xStringToKeysym) (_Xconst char *c); /* 9 */ - Window (*xRootWindow) (Display *d, int i); /* 10 */ - XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 11 */ - Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 12 */ - int (*xBell) (Display *d, int i); /* 13 */ - int (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 14 */ - int (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 15 */ - int (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 16 */ - int (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 17 */ - int (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 18 */ - Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 19 */ - int (*xDefineCursor) (Display *d, Window w, Cursor c); /* 20 */ - int (*xDestroyWindow) (Display *d, Window w); /* 21 */ - int (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 22 */ - int (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 23 */ - int (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 24 */ - int (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */ - int (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 26 */ - int (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 27 */ - int (*xFreeColormap) (Display *d, Colormap c); /* 28 */ - int (*xFreeColors) (Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 29 */ - int (*xFreeModifiermap) (XModifierKeymap *x); /* 30 */ - Status (*xGetGeometry) (Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); /* 31 */ - int (*xGetWindowProperty) (Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); /* 32 */ - int (*xGrabKeyboard) (Display *d, Window w, Bool b, int i1, int i2, Time t); /* 33 */ - int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 34 */ - KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 35 */ - int (*xMapWindow) (Display *d, Window w); /* 36 */ - int (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 37 */ - int (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 38 */ - Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 39 */ - int (*xRaiseWindow) (Display *d, Window w); /* 40 */ - int (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 41 */ - int (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 42 */ - int (*xSelectInput) (Display *d, Window w, long l); /* 43 */ - Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 44 */ - int (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 45 */ - int (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 46 */ - int (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 47 */ - int (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 48 */ - int (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 49 */ - int (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 50 */ - int (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 51 */ - int (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 52 */ - int (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 53 */ - int (*xUngrabKeyboard) (Display *d, Time t); /* 54 */ - int (*xUngrabPointer) (Display *d, Time t); /* 55 */ - int (*xUnmapWindow) (Display *d, Window w); /* 56 */ - int (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 57 */ - Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 58 */ - GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 59 */ - int (*xFreeGC) (Display *display, GC gc); /* 60 */ - Atom (*xInternAtom) (Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 61 */ - int (*xSetBackground) (Display *display, GC gc, unsigned long foreground); /* 62 */ - int (*xSetForeground) (Display *display, GC gc, unsigned long foreground); /* 63 */ - int (*xSetClipMask) (Display *display, GC gc, Pixmap pixmap); /* 64 */ - int (*xSetClipOrigin) (Display *display, GC gc, int clip_x_origin, int clip_y_origin); /* 65 */ - int (*xSetTSOrigin) (Display *display, GC gc, int ts_x_origin, int ts_y_origin); /* 66 */ - int (*xChangeGC) (Display *d, GC gc, unsigned long mask, XGCValues *values); /* 67 */ - int (*xSetFont) (Display *display, GC gc, Font font); /* 68 */ - int (*xSetArcMode) (Display *display, GC gc, int arc_mode); /* 69 */ - int (*xSetStipple) (Display *display, GC gc, Pixmap stipple); /* 70 */ - int (*xSetFillRule) (Display *display, GC gc, int fill_rule); /* 71 */ - int (*xSetFillStyle) (Display *display, GC gc, int fill_style); /* 72 */ - int (*xSetFunction) (Display *display, GC gc, int function); /* 73 */ - int (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 74 */ - int (*_XInitImageFuncPtrs) (XImage *image); /* 75 */ - XIC (*xCreateIC) (XIM xim, ...); /* 76 */ - XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 77 */ - void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 78 */ - Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 79 */ - int (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */ - int (*xForceScreenSaver) (Display *display, int mode); /* 81 */ - int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 82 */ - int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 83 */ - int (*xClearWindow) (Display *d, Window w); /* 84 */ - int (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */ - int (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */ - int (*xWarpPointer) (Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); /* 87 */ - int (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */ - int (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */ - Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 90 */ - int (*xSync) (Display *display, Bool discard); /* 91 */ - Bool (*xTranslateCoordinates) (Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3); /* 92 */ - int (*xDeleteProperty) (Display *d, Window w, Atom a); /* 93 */ - int (*xFreeCursor) (Display *d, Cursor c); /* 94 */ - int (*xGetInputFocus) (Display *d, Window *w, int *i); /* 95 */ - int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 96 */ - int (*xNextEvent) (Display *d, XEvent *x); /* 97 */ - int (*xPutBackEvent) (Display *d, XEvent *x); /* 98 */ - int (*xSetCommand) (Display *d, Window w, char **c, int i); /* 99 */ - int (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 100 */ - Status (*xGetWindowAttributes) (Display *d, Window w, XWindowAttributes *x); /* 101 */ - Status (*xGetWMColormapWindows) (Display *d, Window w, Window **wpp, int *ip); /* 102 */ - Status (*xIconifyWindow) (Display *d, Window w, int i); /* 103 */ - Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 104 */ - XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 105 */ - int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 106 */ + Cursor (*xCreatePixmapCursor) (Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 7 */ + Cursor (*xCreateGlyphCursor) (Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2); /* 8 */ + GContext (*xGContextFromGC) (GC g); /* 9 */ + XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 10 */ + KeySym (*xKeycodeToKeysym) (Display *d, unsigned int k, int i); /* 11 */ + KeySym (*xStringToKeysym) (_Xconst char *c); /* 12 */ + Window (*xRootWindow) (Display *d, int i); /* 13 */ + XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 14 */ + Status (*xIconifyWindow) (Display *d, Window w, int i); /* 15 */ + Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 16 */ + Status (*xGetWMColormapWindows) (Display *d, Window w, Window **wpp, int *ip); /* 17 */ + Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 18 */ + int (*xBell) (Display *d, int i); /* 19 */ + int (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 20 */ + int (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 21 */ + int (*xClearWindow) (Display *d, Window w); /* 22 */ + int (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 23 */ + int (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 24 */ + int (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 25 */ + Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 26 */ + int (*xDefineCursor) (Display *d, Window w, Cursor c); /* 27 */ + int (*xDeleteProperty) (Display *d, Window w, Atom a); /* 28 */ + int (*xDestroyWindow) (Display *d, Window w); /* 29 */ + int (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 30 */ + int (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 31 */ + int (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 32 */ + int (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 33 */ + int (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 34 */ + int (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 35 */ + int (*xForceScreenSaver) (Display *d, int i); /* 36 */ + int (*xFreeColormap) (Display *d, Colormap c); /* 37 */ + int (*xFreeColors) (Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 38 */ + int (*xFreeCursor) (Display *d, Cursor c); /* 39 */ + int (*xFreeModifiermap) (XModifierKeymap *x); /* 40 */ + Status (*xGetGeometry) (Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); /* 41 */ + int (*xGetInputFocus) (Display *d, Window *w, int *i); /* 42 */ + int (*xGetWindowProperty) (Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); /* 43 */ + Status (*xGetWindowAttributes) (Display *d, Window w, XWindowAttributes *x); /* 44 */ + int (*xGrabKeyboard) (Display *d, Window w, Bool b, int i1, int i2, Time t); /* 45 */ + int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 46 */ + KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 47 */ + Status (*xLookupColor) (Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2); /* 48 */ + int (*xMapWindow) (Display *d, Window w); /* 49 */ + int (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 50 */ + int (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 51 */ + int (*xNextEvent) (Display *d, XEvent *x); /* 52 */ + int (*xPutBackEvent) (Display *d, XEvent *x); /* 53 */ + int (*xQueryColors) (Display *d, Colormap c, XColor *x, int i); /* 54 */ + Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 55 */ + Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 56 */ + int (*xRaiseWindow) (Display *d, Window w); /* 57 */ + int (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 58 */ + int (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 59 */ + int (*xSelectInput) (Display *d, Window w, long l); /* 60 */ + Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 61 */ + int (*xSetCommand) (Display *d, Window w, char **c, int i); /* 62 */ + int (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 63 */ + int (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 64 */ + int (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 65 */ + int (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 66 */ + int (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 67 */ + int (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 68 */ + int (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 69 */ + int (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 70 */ + int (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 71 */ + Bool (*xTranslateCoordinates) (Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3); /* 72 */ + int (*xUngrabKeyboard) (Display *d, Time t); /* 73 */ + int (*xUngrabPointer) (Display *d, Time t); /* 74 */ + int (*xUnmapWindow) (Display *d, Window w); /* 75 */ + int (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 76 */ + void (*xDestroyIC) (XIC x); /* 77 */ + Bool (*xFilterEvent) (XEvent *x, Window w); /* 78 */ + int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 79 */ + int (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 80 */ + int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 81 */ + Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 82 */ + GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 83 */ + int (*xFreeGC) (Display *display, GC gc); /* 84 */ + Atom (*xInternAtom) (Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 85 */ + int (*xSetBackground) (Display *display, GC gc, unsigned long foreground); /* 86 */ + int (*xSetForeground) (Display *display, GC gc, unsigned long foreground); /* 87 */ + int (*xSetClipMask) (Display *display, GC gc, Pixmap pixmap); /* 88 */ + int (*xSetClipOrigin) (Display *display, GC gc, int clip_x_origin, int clip_y_origin); /* 89 */ + int (*xSetTSOrigin) (Display *display, GC gc, int ts_x_origin, int ts_y_origin); /* 90 */ + int (*xChangeGC) (Display *d, GC gc, unsigned long mask, XGCValues *values); /* 91 */ + int (*xSetFont) (Display *display, GC gc, Font font); /* 92 */ + int (*xSetArcMode) (Display *display, GC gc, int arc_mode); /* 93 */ + int (*xSetStipple) (Display *display, GC gc, Pixmap stipple); /* 94 */ + int (*xSetFillRule) (Display *display, GC gc, int fill_rule); /* 95 */ + int (*xSetFillStyle) (Display *display, GC gc, int fill_style); /* 96 */ + int (*xSetFunction) (Display *display, GC gc, int function); /* 97 */ + int (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 98 */ + int (*_XInitImageFuncPtrs) (XImage *image); /* 99 */ + XIC (*xCreateIC) (XIM xim, ...); /* 100 */ + XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 101 */ + void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 102 */ + Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 103 */ + int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 104 */ + int (*xWarpPointer) (Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy); /* 105 */ + int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 106 */ int (*xFlush) (Display *display); /* 107 */ int (*xGrabServer) (Display *display); /* 108 */ int (*xUngrabServer) (Display *display); /* 109 */ int (*xFree) (void *data); /* 110 */ int (*xNoOp) (Display *display); /* 111 */ XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */ - Status (*xLookupColor) (Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2); /* 113 */ + int (*xSync) (Display *display, Bool discard); /* 113 */ VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */ void (*reserved115)(void); void (*reserved116)(void); @@ -1199,9 +1196,9 @@ typedef struct TkIntXlibStubs { int (*xFillArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 130 */ int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */ - void (*reserved133)(void); - void (*reserved134)(void); - void (*reserved135)(void); + int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */ + int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */ + int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */ int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */ Region (*xPolygonRegion) (XPoint *pts, int n, int rule); /* 138 */ @@ -1210,9 +1207,9 @@ typedef struct TkIntXlibStubs { char * (*xSetICValues) (XIC xic, ...); /* 141 */ char * (*xGetICValues) (XIC xic, ...); /* 142 */ void (*xSetICFocus) (XIC xic); /* 143 */ - void (*xDestroyIC) (XIC xic); /* 144 */ - Cursor (*xCreatePixmapCursor) (Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 145 */ - Cursor (*xCreateGlyphCursor) (Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2); /* 146 */ + void (*reserved144)(void); + void (*reserved145)(void); + void (*reserved146)(void); void (*xFreeFontSet) (Display *display, XFontSet fontset); /* 147 */ int (*xCloseIM) (XIM im); /* 148 */ Bool (*xRegisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 149 */ @@ -1561,206 +1558,206 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xKeysymToString) /* 5 */ #define XCreateColormap \ (tkIntXlibStubsPtr->xCreateColormap) /* 6 */ +#define XCreatePixmapCursor \ + (tkIntXlibStubsPtr->xCreatePixmapCursor) /* 7 */ +#define XCreateGlyphCursor \ + (tkIntXlibStubsPtr->xCreateGlyphCursor) /* 8 */ #define XGContextFromGC \ - (tkIntXlibStubsPtr->xGContextFromGC) /* 7 */ + (tkIntXlibStubsPtr->xGContextFromGC) /* 9 */ +#define XListHosts \ + (tkIntXlibStubsPtr->xListHosts) /* 10 */ #define XKeycodeToKeysym \ - (tkIntXlibStubsPtr->xKeycodeToKeysym) /* 8 */ + (tkIntXlibStubsPtr->xKeycodeToKeysym) /* 11 */ #define XStringToKeysym \ - (tkIntXlibStubsPtr->xStringToKeysym) /* 9 */ + (tkIntXlibStubsPtr->xStringToKeysym) /* 12 */ #define XRootWindow \ - (tkIntXlibStubsPtr->xRootWindow) /* 10 */ + (tkIntXlibStubsPtr->xRootWindow) /* 13 */ #define XSetErrorHandler \ - (tkIntXlibStubsPtr->xSetErrorHandler) /* 11 */ + (tkIntXlibStubsPtr->xSetErrorHandler) /* 14 */ +#define XIconifyWindow \ + (tkIntXlibStubsPtr->xIconifyWindow) /* 15 */ +#define XWithdrawWindow \ + (tkIntXlibStubsPtr->xWithdrawWindow) /* 16 */ +#define XGetWMColormapWindows \ + (tkIntXlibStubsPtr->xGetWMColormapWindows) /* 17 */ #define XAllocColor \ - (tkIntXlibStubsPtr->xAllocColor) /* 12 */ + (tkIntXlibStubsPtr->xAllocColor) /* 18 */ #define XBell \ - (tkIntXlibStubsPtr->xBell) /* 13 */ + (tkIntXlibStubsPtr->xBell) /* 19 */ #define XChangeProperty \ - (tkIntXlibStubsPtr->xChangeProperty) /* 14 */ + (tkIntXlibStubsPtr->xChangeProperty) /* 20 */ #define XChangeWindowAttributes \ - (tkIntXlibStubsPtr->xChangeWindowAttributes) /* 15 */ + (tkIntXlibStubsPtr->xChangeWindowAttributes) /* 21 */ +#define XClearWindow \ + (tkIntXlibStubsPtr->xClearWindow) /* 22 */ #define XConfigureWindow \ - (tkIntXlibStubsPtr->xConfigureWindow) /* 16 */ + (tkIntXlibStubsPtr->xConfigureWindow) /* 23 */ #define XCopyArea \ - (tkIntXlibStubsPtr->xCopyArea) /* 17 */ + (tkIntXlibStubsPtr->xCopyArea) /* 24 */ #define XCopyPlane \ - (tkIntXlibStubsPtr->xCopyPlane) /* 18 */ + (tkIntXlibStubsPtr->xCopyPlane) /* 25 */ #define XCreateBitmapFromData \ - (tkIntXlibStubsPtr->xCreateBitmapFromData) /* 19 */ + (tkIntXlibStubsPtr->xCreateBitmapFromData) /* 26 */ #define XDefineCursor \ - (tkIntXlibStubsPtr->xDefineCursor) /* 20 */ + (tkIntXlibStubsPtr->xDefineCursor) /* 27 */ +#define XDeleteProperty \ + (tkIntXlibStubsPtr->xDeleteProperty) /* 28 */ #define XDestroyWindow \ - (tkIntXlibStubsPtr->xDestroyWindow) /* 21 */ + (tkIntXlibStubsPtr->xDestroyWindow) /* 29 */ #define XDrawArc \ - (tkIntXlibStubsPtr->xDrawArc) /* 22 */ + (tkIntXlibStubsPtr->xDrawArc) /* 30 */ #define XDrawLines \ - (tkIntXlibStubsPtr->xDrawLines) /* 23 */ + (tkIntXlibStubsPtr->xDrawLines) /* 31 */ #define XDrawRectangle \ - (tkIntXlibStubsPtr->xDrawRectangle) /* 24 */ + (tkIntXlibStubsPtr->xDrawRectangle) /* 32 */ #define XFillArc \ - (tkIntXlibStubsPtr->xFillArc) /* 25 */ + (tkIntXlibStubsPtr->xFillArc) /* 33 */ #define XFillPolygon \ - (tkIntXlibStubsPtr->xFillPolygon) /* 26 */ + (tkIntXlibStubsPtr->xFillPolygon) /* 34 */ #define XFillRectangles \ - (tkIntXlibStubsPtr->xFillRectangles) /* 27 */ + (tkIntXlibStubsPtr->xFillRectangles) /* 35 */ +#define XForceScreenSaver \ + (tkIntXlibStubsPtr->xForceScreenSaver) /* 36 */ #define XFreeColormap \ - (tkIntXlibStubsPtr->xFreeColormap) /* 28 */ + (tkIntXlibStubsPtr->xFreeColormap) /* 37 */ #define XFreeColors \ - (tkIntXlibStubsPtr->xFreeColors) /* 29 */ + (tkIntXlibStubsPtr->xFreeColors) /* 38 */ +#define XFreeCursor \ + (tkIntXlibStubsPtr->xFreeCursor) /* 39 */ #define XFreeModifiermap \ - (tkIntXlibStubsPtr->xFreeModifiermap) /* 30 */ + (tkIntXlibStubsPtr->xFreeModifiermap) /* 40 */ #define XGetGeometry \ - (tkIntXlibStubsPtr->xGetGeometry) /* 31 */ + (tkIntXlibStubsPtr->xGetGeometry) /* 41 */ +#define XGetInputFocus \ + (tkIntXlibStubsPtr->xGetInputFocus) /* 42 */ #define XGetWindowProperty \ - (tkIntXlibStubsPtr->xGetWindowProperty) /* 32 */ + (tkIntXlibStubsPtr->xGetWindowProperty) /* 43 */ +#define XGetWindowAttributes \ + (tkIntXlibStubsPtr->xGetWindowAttributes) /* 44 */ #define XGrabKeyboard \ - (tkIntXlibStubsPtr->xGrabKeyboard) /* 33 */ + (tkIntXlibStubsPtr->xGrabKeyboard) /* 45 */ #define XGrabPointer \ - (tkIntXlibStubsPtr->xGrabPointer) /* 34 */ + (tkIntXlibStubsPtr->xGrabPointer) /* 46 */ #define XKeysymToKeycode \ - (tkIntXlibStubsPtr->xKeysymToKeycode) /* 35 */ + (tkIntXlibStubsPtr->xKeysymToKeycode) /* 47 */ +#define XLookupColor \ + (tkIntXlibStubsPtr->xLookupColor) /* 48 */ #define XMapWindow \ - (tkIntXlibStubsPtr->xMapWindow) /* 36 */ + (tkIntXlibStubsPtr->xMapWindow) /* 49 */ #define XMoveResizeWindow \ - (tkIntXlibStubsPtr->xMoveResizeWindow) /* 37 */ + (tkIntXlibStubsPtr->xMoveResizeWindow) /* 50 */ #define XMoveWindow \ - (tkIntXlibStubsPtr->xMoveWindow) /* 38 */ + (tkIntXlibStubsPtr->xMoveWindow) /* 51 */ +#define XNextEvent \ + (tkIntXlibStubsPtr->xNextEvent) /* 52 */ +#define XPutBackEvent \ + (tkIntXlibStubsPtr->xPutBackEvent) /* 53 */ +#define XQueryColors \ + (tkIntXlibStubsPtr->xQueryColors) /* 54 */ #define XQueryPointer \ - (tkIntXlibStubsPtr->xQueryPointer) /* 39 */ + (tkIntXlibStubsPtr->xQueryPointer) /* 55 */ +#define XQueryTree \ + (tkIntXlibStubsPtr->xQueryTree) /* 56 */ #define XRaiseWindow \ - (tkIntXlibStubsPtr->xRaiseWindow) /* 40 */ + (tkIntXlibStubsPtr->xRaiseWindow) /* 57 */ #define XRefreshKeyboardMapping \ - (tkIntXlibStubsPtr->xRefreshKeyboardMapping) /* 41 */ + (tkIntXlibStubsPtr->xRefreshKeyboardMapping) /* 58 */ #define XResizeWindow \ - (tkIntXlibStubsPtr->xResizeWindow) /* 42 */ + (tkIntXlibStubsPtr->xResizeWindow) /* 59 */ #define XSelectInput \ - (tkIntXlibStubsPtr->xSelectInput) /* 43 */ + (tkIntXlibStubsPtr->xSelectInput) /* 60 */ #define XSendEvent \ - (tkIntXlibStubsPtr->xSendEvent) /* 44 */ + (tkIntXlibStubsPtr->xSendEvent) /* 61 */ +#define XSetCommand \ + (tkIntXlibStubsPtr->xSetCommand) /* 62 */ #define XSetIconName \ - (tkIntXlibStubsPtr->xSetIconName) /* 45 */ + (tkIntXlibStubsPtr->xSetIconName) /* 63 */ #define XSetInputFocus \ - (tkIntXlibStubsPtr->xSetInputFocus) /* 46 */ + (tkIntXlibStubsPtr->xSetInputFocus) /* 64 */ #define XSetSelectionOwner \ - (tkIntXlibStubsPtr->xSetSelectionOwner) /* 47 */ + (tkIntXlibStubsPtr->xSetSelectionOwner) /* 65 */ #define XSetWindowBackground \ - (tkIntXlibStubsPtr->xSetWindowBackground) /* 48 */ + (tkIntXlibStubsPtr->xSetWindowBackground) /* 66 */ #define XSetWindowBackgroundPixmap \ - (tkIntXlibStubsPtr->xSetWindowBackgroundPixmap) /* 49 */ + (tkIntXlibStubsPtr->xSetWindowBackgroundPixmap) /* 67 */ #define XSetWindowBorder \ - (tkIntXlibStubsPtr->xSetWindowBorder) /* 50 */ + (tkIntXlibStubsPtr->xSetWindowBorder) /* 68 */ #define XSetWindowBorderPixmap \ - (tkIntXlibStubsPtr->xSetWindowBorderPixmap) /* 51 */ + (tkIntXlibStubsPtr->xSetWindowBorderPixmap) /* 69 */ #define XSetWindowBorderWidth \ - (tkIntXlibStubsPtr->xSetWindowBorderWidth) /* 52 */ + (tkIntXlibStubsPtr->xSetWindowBorderWidth) /* 70 */ #define XSetWindowColormap \ - (tkIntXlibStubsPtr->xSetWindowColormap) /* 53 */ + (tkIntXlibStubsPtr->xSetWindowColormap) /* 71 */ +#define XTranslateCoordinates \ + (tkIntXlibStubsPtr->xTranslateCoordinates) /* 72 */ #define XUngrabKeyboard \ - (tkIntXlibStubsPtr->xUngrabKeyboard) /* 54 */ + (tkIntXlibStubsPtr->xUngrabKeyboard) /* 73 */ #define XUngrabPointer \ - (tkIntXlibStubsPtr->xUngrabPointer) /* 55 */ + (tkIntXlibStubsPtr->xUngrabPointer) /* 74 */ #define XUnmapWindow \ - (tkIntXlibStubsPtr->xUnmapWindow) /* 56 */ + (tkIntXlibStubsPtr->xUnmapWindow) /* 75 */ +#define XWindowEvent \ + (tkIntXlibStubsPtr->xWindowEvent) /* 76 */ +#define XDestroyIC \ + (tkIntXlibStubsPtr->xDestroyIC) /* 77 */ +#define XFilterEvent \ + (tkIntXlibStubsPtr->xFilterEvent) /* 78 */ +#define XmbLookupString \ + (tkIntXlibStubsPtr->xmbLookupString) /* 79 */ #define TkPutImage \ - (tkIntXlibStubsPtr->tkPutImage) /* 57 */ + (tkIntXlibStubsPtr->tkPutImage) /* 80 */ +#define XSetClipRectangles \ + (tkIntXlibStubsPtr->xSetClipRectangles) /* 81 */ #define XParseColor \ - (tkIntXlibStubsPtr->xParseColor) /* 58 */ + (tkIntXlibStubsPtr->xParseColor) /* 82 */ #define XCreateGC \ - (tkIntXlibStubsPtr->xCreateGC) /* 59 */ + (tkIntXlibStubsPtr->xCreateGC) /* 83 */ #define XFreeGC \ - (tkIntXlibStubsPtr->xFreeGC) /* 60 */ + (tkIntXlibStubsPtr->xFreeGC) /* 84 */ #define XInternAtom \ - (tkIntXlibStubsPtr->xInternAtom) /* 61 */ + (tkIntXlibStubsPtr->xInternAtom) /* 85 */ #define XSetBackground \ - (tkIntXlibStubsPtr->xSetBackground) /* 62 */ + (tkIntXlibStubsPtr->xSetBackground) /* 86 */ #define XSetForeground \ - (tkIntXlibStubsPtr->xSetForeground) /* 63 */ + (tkIntXlibStubsPtr->xSetForeground) /* 87 */ #define XSetClipMask \ - (tkIntXlibStubsPtr->xSetClipMask) /* 64 */ + (tkIntXlibStubsPtr->xSetClipMask) /* 88 */ #define XSetClipOrigin \ - (tkIntXlibStubsPtr->xSetClipOrigin) /* 65 */ + (tkIntXlibStubsPtr->xSetClipOrigin) /* 89 */ #define XSetTSOrigin \ - (tkIntXlibStubsPtr->xSetTSOrigin) /* 66 */ + (tkIntXlibStubsPtr->xSetTSOrigin) /* 90 */ #define XChangeGC \ - (tkIntXlibStubsPtr->xChangeGC) /* 67 */ + (tkIntXlibStubsPtr->xChangeGC) /* 91 */ #define XSetFont \ - (tkIntXlibStubsPtr->xSetFont) /* 68 */ + (tkIntXlibStubsPtr->xSetFont) /* 92 */ #define XSetArcMode \ - (tkIntXlibStubsPtr->xSetArcMode) /* 69 */ + (tkIntXlibStubsPtr->xSetArcMode) /* 93 */ #define XSetStipple \ - (tkIntXlibStubsPtr->xSetStipple) /* 70 */ + (tkIntXlibStubsPtr->xSetStipple) /* 94 */ #define XSetFillRule \ - (tkIntXlibStubsPtr->xSetFillRule) /* 71 */ + (tkIntXlibStubsPtr->xSetFillRule) /* 95 */ #define XSetFillStyle \ - (tkIntXlibStubsPtr->xSetFillStyle) /* 72 */ + (tkIntXlibStubsPtr->xSetFillStyle) /* 96 */ #define XSetFunction \ - (tkIntXlibStubsPtr->xSetFunction) /* 73 */ + (tkIntXlibStubsPtr->xSetFunction) /* 97 */ #define XSetLineAttributes \ - (tkIntXlibStubsPtr->xSetLineAttributes) /* 74 */ + (tkIntXlibStubsPtr->xSetLineAttributes) /* 98 */ #define _XInitImageFuncPtrs \ - (tkIntXlibStubsPtr->_XInitImageFuncPtrs) /* 75 */ + (tkIntXlibStubsPtr->_XInitImageFuncPtrs) /* 99 */ #define XCreateIC \ - (tkIntXlibStubsPtr->xCreateIC) /* 76 */ + (tkIntXlibStubsPtr->xCreateIC) /* 100 */ #define XGetVisualInfo \ - (tkIntXlibStubsPtr->xGetVisualInfo) /* 77 */ + (tkIntXlibStubsPtr->xGetVisualInfo) /* 101 */ #define XSetWMClientMachine \ - (tkIntXlibStubsPtr->xSetWMClientMachine) /* 78 */ + (tkIntXlibStubsPtr->xSetWMClientMachine) /* 102 */ #define XStringListToTextProperty \ - (tkIntXlibStubsPtr->xStringListToTextProperty) /* 79 */ -#define XDrawSegments \ - (tkIntXlibStubsPtr->xDrawSegments) /* 80 */ -#define XForceScreenSaver \ - (tkIntXlibStubsPtr->xForceScreenSaver) /* 81 */ + (tkIntXlibStubsPtr->xStringListToTextProperty) /* 103 */ #define XDrawLine \ - (tkIntXlibStubsPtr->xDrawLine) /* 82 */ -#define XFillRectangle \ - (tkIntXlibStubsPtr->xFillRectangle) /* 83 */ -#define XClearWindow \ - (tkIntXlibStubsPtr->xClearWindow) /* 84 */ -#define XDrawPoint \ - (tkIntXlibStubsPtr->xDrawPoint) /* 85 */ -#define XDrawPoints \ - (tkIntXlibStubsPtr->xDrawPoints) /* 86 */ + (tkIntXlibStubsPtr->xDrawLine) /* 104 */ #define XWarpPointer \ - (tkIntXlibStubsPtr->xWarpPointer) /* 87 */ -#define XQueryColor \ - (tkIntXlibStubsPtr->xQueryColor) /* 88 */ -#define XQueryColors \ - (tkIntXlibStubsPtr->xQueryColors) /* 89 */ -#define XQueryTree \ - (tkIntXlibStubsPtr->xQueryTree) /* 90 */ -#define XSync \ - (tkIntXlibStubsPtr->xSync) /* 91 */ -#define XTranslateCoordinates \ - (tkIntXlibStubsPtr->xTranslateCoordinates) /* 92 */ -#define XDeleteProperty \ - (tkIntXlibStubsPtr->xDeleteProperty) /* 93 */ -#define XFreeCursor \ - (tkIntXlibStubsPtr->xFreeCursor) /* 94 */ -#define XGetInputFocus \ - (tkIntXlibStubsPtr->xGetInputFocus) /* 95 */ -#define XmbLookupString \ - (tkIntXlibStubsPtr->xmbLookupString) /* 96 */ -#define XNextEvent \ - (tkIntXlibStubsPtr->xNextEvent) /* 97 */ -#define XPutBackEvent \ - (tkIntXlibStubsPtr->xPutBackEvent) /* 98 */ -#define XSetCommand \ - (tkIntXlibStubsPtr->xSetCommand) /* 99 */ -#define XWindowEvent \ - (tkIntXlibStubsPtr->xWindowEvent) /* 100 */ -#define XGetWindowAttributes \ - (tkIntXlibStubsPtr->xGetWindowAttributes) /* 101 */ -#define XGetWMColormapWindows \ - (tkIntXlibStubsPtr->xGetWMColormapWindows) /* 102 */ -#define XIconifyWindow \ - (tkIntXlibStubsPtr->xIconifyWindow) /* 103 */ -#define XWithdrawWindow \ - (tkIntXlibStubsPtr->xWithdrawWindow) /* 104 */ -#define XListHosts \ - (tkIntXlibStubsPtr->xListHosts) /* 105 */ -#define XSetClipRectangles \ - (tkIntXlibStubsPtr->xSetClipRectangles) /* 106 */ + (tkIntXlibStubsPtr->xWarpPointer) /* 105 */ +#define XFillRectangle \ + (tkIntXlibStubsPtr->xFillRectangle) /* 106 */ #define XFlush \ (tkIntXlibStubsPtr->xFlush) /* 107 */ #define XGrabServer \ @@ -1773,8 +1770,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xNoOp) /* 111 */ #define XSynchronize \ (tkIntXlibStubsPtr->xSynchronize) /* 112 */ -#define XLookupColor \ - (tkIntXlibStubsPtr->xLookupColor) /* 113 */ +#define XSync \ + (tkIntXlibStubsPtr->xSync) /* 113 */ #define XVisualIDFromVisual \ (tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */ /* Slot 115 is reserved */ @@ -1802,9 +1799,12 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xDrawArcs) /* 131 */ #define XDrawRectangles \ (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */ -/* Slot 133 is reserved */ -/* Slot 134 is reserved */ -/* Slot 135 is reserved */ +#define XDrawSegments \ + (tkIntXlibStubsPtr->xDrawSegments) /* 133 */ +#define XDrawPoint \ + (tkIntXlibStubsPtr->xDrawPoint) /* 134 */ +#define XDrawPoints \ + (tkIntXlibStubsPtr->xDrawPoints) /* 135 */ #define XReparentWindow \ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */ #define XPutImage \ @@ -1821,12 +1821,9 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xGetICValues) /* 142 */ #define XSetICFocus \ (tkIntXlibStubsPtr->xSetICFocus) /* 143 */ -#define XDestroyIC \ - (tkIntXlibStubsPtr->xDestroyIC) /* 144 */ -#define XCreatePixmapCursor \ - (tkIntXlibStubsPtr->xCreatePixmapCursor) /* 145 */ -#define XCreateGlyphCursor \ - (tkIntXlibStubsPtr->xCreateGlyphCursor) /* 146 */ +/* Slot 144 is reserved */ +/* Slot 145 is reserved */ +/* Slot 146 is reserved */ #define XFreeFontSet \ (tkIntXlibStubsPtr->xFreeFontSet) /* 147 */ #define XCloseIM \ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index d676769..d09b503 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -57,9 +57,9 @@ typedef struct { Tk_3DBorder normalBorder; /* Used for drawing border around whole * window, plus used for background. */ - int borderWidth; /* Width of 3-D border around window. */ + Tcl_Obj *borderWidthObj; /* Width of 3-D border around window. */ int relief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ - int highlightWidth; /* Width in pixels of highlight to draw around + Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw around * widget when it has the focus. <= 0 means * don't draw a highlight. */ XColor *highlightBgColorPtr; @@ -77,7 +77,7 @@ typedef struct { GC textGC; /* For drawing normal text. */ Tk_3DBorder selBorder; /* Borders and backgrounds for selected * elements. */ - int selBorderWidth; /* Width of border around selection. */ + Tcl_Obj *selBorderWidthObj; /* Width of border around selection. */ XColor *selFgColorPtr; /* Foreground color for selected elements. */ GC selTextGC; /* For drawing selected text. */ int width; /* Desired width of window, in characters. */ @@ -163,6 +163,9 @@ typedef struct { int flags; /* Various flag bits: see below for * definitions. */ Tk_Justify justify; /* Justification. */ +#ifdef BUILD_tk + int borderWidth, selBorderWidth, highlightWidth; +#endif } Listbox; /* @@ -241,7 +244,7 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_LISTBOX_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(Listbox, borderWidth), + DEF_LISTBOX_BORDER_WIDTH, offsetof(Listbox, borderWidthObj), offsetof(Listbox, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_LISTBOX_CURSOR, TCL_INDEX_NONE, offsetof(Listbox, cursor), @@ -267,7 +270,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_LISTBOX_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Listbox, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, + "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, offsetof(Listbox, highlightWidthObj), offsetof(Listbox, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_LISTBOX_JUSTIFY, TCL_INDEX_NONE, offsetof(Listbox, justify), TK_OPTION_ENUM_VAR, 0, 0}, @@ -277,7 +280,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_LISTBOX_SELECT_COLOR, TCL_INDEX_NONE, offsetof(Listbox, selBorder), 0, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", - "BorderWidth", DEF_LISTBOX_SELECT_BD, TCL_INDEX_NONE, + "BorderWidth", DEF_LISTBOX_SELECT_BD, offsetof(Listbox, selBorderWidthObj), offsetof(Listbox, selBorderWidth), 0, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_LISTBOX_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(Listbox, selFgColorPtr), @@ -1594,8 +1597,23 @@ ConfigureListbox( Tk_SetBackgroundFromBorder(listPtr->tkwin, listPtr->normalBorder); + if (listPtr->borderWidth < 0) { + listPtr->borderWidth = 0; + Tcl_DecrRefCount(listPtr->borderWidthObj); + listPtr->borderWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(listPtr->borderWidthObj); + } if (listPtr->highlightWidth < 0) { listPtr->highlightWidth = 0; + Tcl_DecrRefCount(listPtr->highlightWidthObj); + listPtr->highlightWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(listPtr->highlightWidthObj); + } + if (listPtr->selBorderWidth < 0) { + listPtr->selBorderWidth = 0; + Tcl_DecrRefCount(listPtr->selBorderWidthObj); + listPtr->selBorderWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(listPtr->selBorderWidthObj); } listPtr->inset = listPtr->highlightWidth + listPtr->borderWidth; diff --git a/generic/tkMain.c b/generic/tkMain.c index 07a7813..f172130 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -163,7 +163,7 @@ static void StdinProc(void *clientData, int mask); *---------------------------------------------------------------------- */ -TCL_NORETURN1 void +void Tk_MainEx( Tcl_Size argc, /* Number of arguments. */ TCHAR **argv, /* Array of argument strings. */ @@ -189,7 +189,7 @@ Tk_MainEx( * Ensure that we are getting a compatible version of Tcl. */ - if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { abort(); } else { @@ -203,7 +203,7 @@ Tk_MainEx( /* We are running win32 Tk under Cygwin, so let's check * whether the env("DISPLAY") variable or the -display * argument is set. If so, we really want to run the - * Tk_MainEx function of libtk8.?.dll, not this one. */ + * Tk_MainEx function of libtcl9tk9.?.dll, not this one. */ if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) { loadCygwinTk: TkCygwinMainEx(argc, argv, appInitProc, interp); @@ -247,9 +247,6 @@ Tk_MainEx( */ if (NULL == Tcl_GetStartupScript(NULL)) { -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - size_t length; -#endif /* * Check whether first 3 args (argv[1] - argv[3]) look like @@ -264,7 +261,8 @@ Tk_MainEx( if ((argc >= 3) && (0 == _tcscmp(TEXT("-encoding"), argv[1])) && ('-' != argv[3][0])) { Tcl_Obj *value = NewNativeObj(argv[2]); - Tcl_SetStartupScript(NewNativeObj(argv[3]), Tcl_GetString(value)); + Tcl_SetStartupScript(NewNativeObj(argv[3]), + Tcl_GetString(value)); Tcl_DecrRefCount(value); argc -= 3; i += 3; @@ -272,14 +270,6 @@ Tk_MainEx( Tcl_SetStartupScript(NewNativeObj(argv[1]), NULL); argc--; i++; -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - } else if ((argc >= 2) && (length = _tcslen(argv[1])) - && (length > 1) && (0 == _tcsncmp(TEXT("-file"), argv[1], length)) - && ('-' != argv[2][0])) { - Tcl_SetStartupScript(NewNativeObj(argv[2]), NULL); - argc -= 2; - i += 2; -#endif } } @@ -291,7 +281,7 @@ Tk_MainEx( } Tcl_SetVar2Ex(interp, "argv0", NULL, appName, TCL_GLOBAL_ONLY); - Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(argc), TCL_GLOBAL_ONLY); + Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj((Tcl_WideInt)argc), TCL_GLOBAL_ONLY); argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { @@ -318,7 +308,7 @@ Tk_MainEx( } #endif Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, - Tcl_NewBooleanObj(!path && (is.tty || nullStdin)), TCL_GLOBAL_ONLY); + Tcl_NewWideIntObj(!path && (is.tty || nullStdin)), TCL_GLOBAL_ONLY); /* * Invoke application-specific initialization. diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 66d919f..019a881 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -260,7 +260,7 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = { NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENU_BORDER_WIDTH, - offsetof(TkMenu, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0}, + offsetof(TkMenu, borderWidthObj), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENU_CURSOR, offsetof(TkMenu, cursorPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, @@ -278,7 +278,7 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = { DEF_MENU_POST_COMMAND, offsetof(TkMenu, postCommandPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_MENU_RELIEF, offsetof(TkMenu, reliefPtr), TCL_INDEX_NONE, 0, NULL, 0}, + DEF_MENU_RELIEF, TCL_INDEX_NONE, offsetof(TkMenu, relief), 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", "selectColor", "Background", DEF_MENU_SELECT_COLOR, offsetof(TkMenu, indicatorFgPtr), TCL_INDEX_NONE, 0, DEF_MENU_SELECT_MONO, 0}, @@ -855,11 +855,7 @@ MenuWidgetObjCmd( goto error; } if (index < 0) { -#if defined(TK_NO_DEPRECATED) Tcl_SetObjResult(interp, Tcl_NewObj()); -#else - Tcl_SetObjResult(interp, Tcl_NewStringObj("none", TCL_INDEX_NONE)); -#endif } else { Tcl_SetObjResult(interp, TkNewIndexObj(index)); } @@ -3047,7 +3043,7 @@ GetIndexFromCoords( TkRecomputeMenu(menuPtr); p = string + 1; Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, - menuPtr->borderWidthPtr, &borderwidth); + menuPtr->borderWidthObj, &borderwidth); rest = strchr(p, ','); if (rest) { Tcl_DString ds; diff --git a/generic/tkMenu.h b/generic/tkMenu.h index ffe6770..5f77128 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -279,12 +279,12 @@ typedef struct TkMenu { Tcl_Obj *borderPtr; /* Structure used to draw 3-D border and * background for menu. */ - Tcl_Obj *borderWidthPtr; /* Width of border around whole menu. */ + Tcl_Obj *borderWidthObj; /* Width of border around whole menu. */ Tcl_Obj *activeBorderPtr; /* Used to draw background and border for * active element (if any). */ Tcl_Obj *activeBorderWidthPtr; /* Width of border around active element. */ - Tcl_Obj *reliefPtr; /* 3-d effect: TK_RELIEF_RAISED, etc. */ + int relief; /* 3-d effect: TK_RELIEF_RAISED, etc. */ Tcl_Obj *fontPtr; /* Text font for menu entries. */ Tcl_Obj *fgPtr; /* Foreground color for entries. */ Tcl_Obj *disabledFgPtr; /* Foreground color when disabled. NULL means diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 8c1d2a4..4510c96 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -626,7 +626,6 @@ DisplayMenu( int width; int borderWidth; Tk_3DBorder border; - int relief; menuPtr->menuFlags &= ~REDRAW_PENDING; @@ -634,7 +633,7 @@ DisplayMenu( return; } - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, + Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj, &borderWidth); border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); @@ -732,10 +731,9 @@ DisplayMenu( width, height, 0, TK_RELIEF_FLAT); } - Tk_GetReliefFromObj(NULL, menuPtr->reliefPtr, &relief); Tk_Draw3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin), border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), borderWidth, - relief); + menuPtr->relief); } /* @@ -991,7 +989,7 @@ AdjustMenuCoords( } else { int borderWidth, activeBorderWidth; - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, + Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index b9056e9..d7d2850 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -62,7 +62,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_MENUBUTTON_BITMAP, TCL_INDEX_NONE, offsetof(TkMenuButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_MENUBUTTON_BORDER_WIDTH, TCL_INDEX_NONE, + DEF_MENUBUTTON_BORDER_WIDTH, offsetof(TkMenuButton, borderWidthObj), offsetof(TkMenuButton, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENUBUTTON_CURSOR, TCL_INDEX_NONE, offsetof(TkMenuButton, cursor), @@ -91,7 +91,7 @@ static const Tk_OptionSpec optionSpecs[] = { offsetof(TkMenuButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_MENUBUTTON_HIGHLIGHT_WIDTH, - TCL_INDEX_NONE, offsetof(TkMenuButton, highlightWidth), 0, 0, 0}, + offsetof(TkMenuButton, highlightWidthObj), offsetof(TkMenuButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_MENUBUTTON_IMAGE, TCL_INDEX_NONE, offsetof(TkMenuButton, imageString), TK_OPTION_NULL_OK, 0, 0}, @@ -104,10 +104,10 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_MENUBUTTON_MENU, TCL_INDEX_NONE, offsetof(TkMenuButton, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_MENUBUTTON_PADX, TCL_INDEX_NONE, offsetof(TkMenuButton, padX), + DEF_MENUBUTTON_PADX, offsetof(TkMenuButton, padXObj), offsetof(TkMenuButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_MENUBUTTON_PADY, TCL_INDEX_NONE, offsetof(TkMenuButton, padY), + DEF_MENUBUTTON_PADY, offsetof(TkMenuButton, padYObj), offsetof(TkMenuButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MENUBUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkMenuButton, relief), @@ -132,7 +132,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_MENUBUTTON_WIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, widthString), 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_MENUBUTTON_WRAP_LENGTH, TCL_INDEX_NONE, offsetof(TkMenuButton, wrapLength), + DEF_MENUBUTTON_WRAP_LENGTH, offsetof(TkMenuButton, wrapLengthObj), offsetof(TkMenuButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; @@ -282,6 +282,11 @@ Tk_MenubuttonObjCmd( mbPtr->cursor = NULL; mbPtr->takeFocus = NULL; mbPtr->flags = 0; + mbPtr->borderWidthObj = NULL; + mbPtr->highlightWidthObj = NULL; + mbPtr->padXObj = NULL; + mbPtr->padYObj = NULL; + mbPtr->wrapLengthObj = NULL; Tk_CreateEventHandler(mbPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, @@ -533,13 +538,28 @@ ConfigureMenuButton( if (mbPtr->highlightWidth < 0) { mbPtr->highlightWidth = 0; + if (mbPtr->highlightWidthObj) { + Tcl_DecrRefCount(mbPtr->highlightWidthObj); + } + mbPtr->highlightWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(mbPtr->highlightWidthObj); } if (mbPtr->padX < 0) { mbPtr->padX = 0; + if (mbPtr->padXObj) { + Tcl_DecrRefCount(mbPtr->padXObj); + } + mbPtr->padXObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(mbPtr->padXObj); } if (mbPtr->padY < 0) { mbPtr->padY = 0; + if (mbPtr->padYObj) { + Tcl_DecrRefCount(mbPtr->padYObj); + } + mbPtr->padYObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(mbPtr->padYObj); } /* diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h index 16ed223..1c8d175 100644 --- a/generic/tkMenubutton.h +++ b/generic/tkMenubutton.h @@ -89,10 +89,10 @@ typedef struct { Tk_3DBorder activeBorder; /* Structure used to draw 3-D border and * background when window is active. NULL * means no such border exists. */ - int borderWidth; /* Width of border. */ + Tcl_Obj *borderWidthObj; /* Width of border. */ int relief; /* 3-d effect: TK_RELIEF_RAISED, etc. */ - int highlightWidth; /* Width in pixels of highlight to draw around - * widget when it has the focus. <= 0 means + Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw around + * widget when it has the focus. 0 means * don't draw a highlight. */ XColor *highlightBgColorPtr;/* Color for drawing traversal highlight area * when highlight is off. */ @@ -129,10 +129,10 @@ typedef struct { * size of the text string or bitmap is * ignored in computing desired window * size. */ - int wrapLength; /* Line length (in pixels) at which to wrap - * onto next line. <= 0 means don't wrap + Tcl_Obj *wrapLengthObj; /* Line length (in pixels) at which to wrap + * onto next line. 0 means don't wrap * except at newlines. */ - int padX, padY; /* Extra space around text or bitmap (pixels + Tcl_Obj *padXObj, *padYObj; /* Extra space around text or bitmap (pixels * on each side). */ Tk_Anchor anchor; /* Where text/bitmap should be displayed * inside window region. */ @@ -176,6 +176,13 @@ typedef struct { * scripts. Malloc'ed, but may be NULL. */ int flags; /* Various flags; see below for * definitions. */ +#ifdef BUILD_tk + int borderWidth; + int highlightWidth; + int padX; + int padY; + int wrapLength; +#endif } TkMenuButton; /* diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 0dc912c..75caf7c 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -21,13 +21,6 @@ * managed by this file: */ -#ifdef TK_NO_DEPRECATED -# undef DEF_MESSAGE_PADX -# undef DEF_MESSAGE_PADY -# define DEF_MESSAGE_PADX NULL -# define DEF_MESSAGE_PADY NULL -#endif - typedef struct { Tk_Window tkwin; /* Window that embodies the message. NULL * means that the window has been destroyed @@ -496,7 +489,7 @@ ConfigureMessage( * be specified to Tk_ConfigureWidget. */ - msgPtr->numChars = TkNumUtfChars(msgPtr->string, TCL_INDEX_NONE); + msgPtr->numChars = Tcl_NumUtfChars(msgPtr->string, TCL_INDEX_NONE); Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->widthObj, &width); if (width < 0) { @@ -522,28 +515,18 @@ ConfigureMessage( msgPtr->highlightWidthObj = Tcl_NewIntObj(0); Tcl_IncrRefCount(msgPtr->highlightWidthObj); } - if (!msgPtr->padXObj) { - msgPtr->padXObj = Tcl_NewIntObj(-1); - Tcl_IncrRefCount(msgPtr->padXObj); - } - Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX); - if (padX < 0) { - if (strcmp(Tcl_GetString(msgPtr->padXObj), "-1")) { + if (msgPtr->padXObj) { + Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX); + if (padX < 0) { Tcl_DecrRefCount(msgPtr->padXObj); - msgPtr->padXObj = Tcl_NewIntObj(-1); - Tcl_IncrRefCount(msgPtr->padXObj); + msgPtr->padXObj = NULL; } } - if (!msgPtr->padYObj) { - msgPtr->padYObj = Tcl_NewIntObj(-1); - Tcl_IncrRefCount(msgPtr->padYObj); - } - Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY); - if (padY < 0) { - if (strcmp(Tcl_GetString(msgPtr->padYObj), "-1")) { + if (msgPtr->padYObj) { + Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY); + if (padY < 0) { Tcl_DecrRefCount(msgPtr->padYObj); - msgPtr->padYObj = Tcl_NewIntObj(-1); - Tcl_IncrRefCount(msgPtr->padYObj); + msgPtr->padYObj = NULL; } } @@ -635,13 +618,15 @@ ComputeMessageGeometry( Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->highlightWidthObj, &highlightWidth); - Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX); - Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY); Tk_GetFontMetrics(msgPtr->tkfont, &fm); - if (padX < 0) { + if (msgPtr->padXObj) { + Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX); + } else { padX = fm.ascent / 2; } - if (padY < 0) { + if (msgPtr->padYObj) { + Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY); + } else { padY = fm.ascent / 4; } @@ -729,13 +714,15 @@ DisplayMessage( Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->highlightWidthObj, &highlightWidth); - Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX); - Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY); Tk_GetFontMetrics(msgPtr->tkfont, &fm); - if (padX < 0) { + if (msgPtr->padXObj) { + Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX); + } else { padX = fm.ascent / 2; } - if (padY < 0) { + if (msgPtr->padYObj) { + Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY); + } else { padY = fm.ascent / 4; } @@ -952,7 +939,7 @@ MessageTextVarProc( if (msgPtr->string != NULL) { ckfree(msgPtr->string); } - msgPtr->numChars = TkNumUtfChars(value, TCL_INDEX_NONE); + msgPtr->numChars = Tcl_NumUtfChars(value, TCL_INDEX_NONE); msgPtr->string = (char *)ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index 7239aa2..a91e460 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -96,35 +96,6 @@ static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); -#if TCL_MAJOR_VERSION < 9 -#ifdef __cplusplus -extern "C" { -#endif -#if defined(USE_TCL_STUBS) -/* Little hack to eliminate the need for "tclInt.h" here: - Just copy a small portion of TclIntStubs, just - enough to make it work */ -typedef struct TclIntStubs { - int magic; - void *hooks; - void (*dummy[34]) (void); /* dummy entries 0-33, not used */ - int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */ -} TclIntStubs; -extern const TclIntStubs *tclIntStubsPtr; - -# undef Tcl_GetIntForIndex -# define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \ - ((int (*)(Tcl_Interp*, Tcl_Obj *, int, int*))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[645]))((interp), (obj), (max), (ptr)): \ - tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr))) -#elif TCL_MINOR_VERSION < 7 -extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*); -# define Tcl_GetIntForIndex(interp, obj, max, ptr) TclGetIntForIndex(interp, obj, max, ptr) -#endif -#ifdef __cplusplus -} -#endif -#endif - /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 23259ec..0f22e3b 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -61,7 +61,7 @@ static void DeleteSpecCacheTable(void *clientData, * will hold an error message. * * Side effects: - * The fields of widgRec get filled in with information from argc/argv + * The fields of widgRec get filled in with information from objc/objv * and the option database. Old information in widgRec's fields gets * recycled. A copy of the spec-table is taken with (some of) the char* * fields converted into Tk_Uid fields; this copy will be released when @@ -76,8 +76,8 @@ Tk_ConfigureWidget( Tk_Window tkwin, /* Window containing widget (needed to set up * X resources). */ const Tk_ConfigSpec *specs, /* Describes legal options. */ - Tcl_Size argc, /* Number of elements in argv. */ - const char **argv, /* Command-line options. */ + Tcl_Size objc, /* Number of elements in objv. */ + Tcl_Obj *const *objv, /* Command-line options. */ void *widgRec, /* Record whose fields are to be modified. * Values must be properly initialized. */ int flags) /* Used to specify additional flags that must @@ -125,18 +125,10 @@ Tk_ConfigureWidget( * match entries in the specs. */ - for ( ; argc > 0; argc -= 2, argv += 2) { + for ( ; objc > 0; objc -= 2, objv += 2) { const char *arg; - if (flags & TK_CONFIG_OBJS) { - arg = Tcl_GetString((Tcl_Obj *) *argv); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - arg = *argv; -#endif - } + arg = Tcl_GetString(*objv); specPtr = FindConfigSpec(interp, staticSpecs, arg, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; @@ -146,21 +138,13 @@ Tk_ConfigureWidget( * Process the entry. */ - if (argc < 2) { + if (objc < 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", arg)); Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", (char *)NULL); return TCL_ERROR; } - if (flags & TK_CONFIG_OBJS) { - arg = Tcl_GetString((Tcl_Obj *) argv[1]); - } else { -#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8) - Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory"); -#else - arg = argv[1]; -#endif - } + arg = Tcl_GetString(objv[1]); if (DoConfig(interp, tkwin, specPtr, arg, 0, widgRec) != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (processing \"%.40s\" option)",specPtr->argvName)); diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c deleted file mode 100644 index 82b8ef2..0000000 --- a/generic/tkOldTest.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - * tkOldTest.c -- - * - * This file contains C command functions for additional Tcl - * commands that are used to test Tk's support for legacy - * interfaces. These commands are not normally included in Tcl/Tk - * applications; they're only used for testing. - * - * Copyright © 1993-1994 The Regents of the University of California. - * Copyright © 1994-1997 Sun Microsystems, Inc. - * Copyright © 1998-1999 Scriptics Corporation. - * Contributions by Don Porter, NIST, 2007. (not subject to US copyright) - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#define USE_OLD_IMAGE -#ifndef USE_TCL_STUBS -# define USE_TCL_STUBS -#endif -#ifndef USE_TK_STUBS -# define USE_TK_STUBS -#endif -#include "tkInt.h" - -#ifdef _WIN32 -#include "tkWinInt.h" -#endif - -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) -/* - * The following data structure represents the model for a test image: - */ - -typedef struct TImageModel { - Tk_ImageModel model; /* Tk's token for image model. */ - Tcl_Interp *interp; /* Interpreter for application. */ - int width, height; /* Dimensions of image. */ - char *imageName; /* Name of image (malloc-ed). */ - char *varName; /* Name of variable in which to log events for - * image (malloc-ed). */ -} TImageModel; - -/* - * The following data structure represents a particular use of a particular - * test image. - */ - -typedef struct TImageInstance { - TImageModel *modelPtr; /* Pointer to model for image. */ - XColor *fg; /* Foreground color for drawing in image. */ - GC gc; /* Graphics context for drawing in image. */ -} TImageInstance; - -/* - * The type record for test images: - */ - -static int ImageCreate(Tcl_Interp *interp, - char *name, Tcl_Size argc, char **argv, - Tk_ImageType *typePtr, Tk_ImageModel model, - void **clientDataPtr); -static void *ImageGet(Tk_Window tkwin, void *clientData); -static void ImageDisplay(void *clientData, - Display *display, Drawable drawable, - int imageX, int imageY, int width, - int height, int drawableX, - int drawableY); -static void ImageFree(void *clientData, Display *display); -static void ImageDelete(void *clientData); - -static Tk_ImageType imageType = { - "oldtest", /* name */ - (Tk_ImageCreateProc *) ImageCreate, /* createProc */ - ImageGet, /* getProc */ - ImageDisplay, /* displayProc */ - ImageFree, /* freeProc */ - ImageDelete, /* deleteProc */ - NULL, /* postscriptPtr */ - NULL, /* nextPtr */ - NULL -}; - -/* - * Forward declarations for functions defined later in this file: - */ - -static Tcl_ObjCmdProc ImageObjCmd; -#endif - -/* - *---------------------------------------------------------------------- - * - * TkOldTestInit -- - * - * This function performs initialization for the Tk test suite - * extensions for testing support for legacy interfaces. - * - * Results: - * Returns a standard Tcl completion code, and leaves an error message in - * the interp's result if an error occurs. - * - * Side effects: - * Creates several test commands. - * - *---------------------------------------------------------------------- - */ - -int -TkOldTestInit( - Tcl_Interp *dummy) -{ - static int initialized = 0; - (void)dummy; - - if (!initialized) { - initialized = 1; -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) - Tk_CreateImageType(&imageType); -#endif - } - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * ImageCreate -- - * - * This function is called by the Tk image code to create "oldtest" images. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * The data structure for a new image is allocated. - * - *---------------------------------------------------------------------- - */ -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) -static int -ImageCreate( - Tcl_Interp *interp, /* Interpreter for application containing - * image. */ - char *name, /* Name to use for image. */ - Tcl_Size argc, /* Number of arguments. */ - char **argv, /* Argument strings for options (doesn't - * include image name or type). */ - Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ - Tk_ImageModel model, /* Token for image, to be used by us in later - * callbacks. */ - void **clientDataPtr) /* Store manager's token for image here; it - * will be returned in later callbacks. */ -{ - TImageModel *timPtr; - const char *varName; - Tcl_Size i; - (void)typePtr; - - varName = "log"; - for (i = 0; i < argc; i += 2) { - if (strcmp(argv[i], "-variable") != 0) { - Tcl_AppendResult(interp, "bad option name \"", - argv[i], "\"", NULL); - return TCL_ERROR; - } - if ((i+1) == argc) { - Tcl_AppendResult(interp, "no value given for \"", - argv[i], "\" option", NULL); - return TCL_ERROR; - } - varName = argv[i+1]; - } - - timPtr = (TImageModel *)ckalloc(sizeof(TImageModel)); - timPtr->model = model; - timPtr->interp = interp; - timPtr->width = 30; - timPtr->height = 15; - timPtr->imageName = (char *)ckalloc(strlen(name) + 1); - strcpy(timPtr->imageName, name); - timPtr->varName = (char *)ckalloc(strlen(varName) + 1); - strcpy(timPtr->varName, varName); - Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); - *clientDataPtr = timPtr; - Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * ImageObjCmd -- - * - * This function implements the commands corresponding to individual - * images. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * Forces windows to be created. - * - *---------------------------------------------------------------------- - */ - -static int -ImageObjCmd( - void *clientData, /* Main window for application. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument strings. */ -{ - TImageModel *timPtr = (TImageModel *)clientData; - int x, y, width, height; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); - return TCL_ERROR; - } - if (strcmp(Tcl_GetString(objv[1]), "changed") == 0) { - if (objc != 8) { - Tcl_WrongNumArgs(interp, 1, objv, "changed x y width height" - " imageWidth imageHeight"); - return TCL_ERROR; - } - if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) - || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) - || (Tcl_GetIntFromObj(interp, objv[4], &width) != TCL_OK) - || (Tcl_GetIntFromObj(interp, objv[5], &height) != TCL_OK) - || (Tcl_GetIntFromObj(interp, objv[6], &timPtr->width) != TCL_OK) - || (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) { - return TCL_ERROR; - } - Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width, - timPtr->height); - } else { - Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), - "\": must be changed", NULL); - return TCL_ERROR; - } - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * ImageGet -- - * - * This function is called by Tk to set things up for using a test image - * in a particular widget. - * - * Results: - * The return value is a token for the image instance, which is used in - * future callbacks to ImageDisplay and ImageFree. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -static void * -ImageGet( - Tk_Window tkwin, /* Token for window in which image will be - * used. */ - void *clientData) /* Pointer to TImageModel for image. */ -{ - TImageModel *timPtr = (TImageModel *)clientData; - TImageInstance *instPtr; - char buffer[100]; - XGCValues gcValues; - - snprintf(buffer, sizeof(buffer), "%s get", timPtr->imageName); - Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, - TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - - instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); - instPtr->modelPtr = timPtr; - instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); - gcValues.foreground = instPtr->fg->pixel; - instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); - return instPtr; -} - -/* - *---------------------------------------------------------------------- - * - * ImageDisplay -- - * - * This function is invoked to redisplay part or all of an image in a - * given drawable. - * - * Results: - * None. - * - * Side effects: - * The image gets partially redrawn, as an "X" that shows the exact - * redraw area. - * - *---------------------------------------------------------------------- - */ - -static void -ImageDisplay( - void *clientData, /* Pointer to TImageInstance for image. */ - Display *display, /* Display to use for drawing. */ - Drawable drawable, /* Where to redraw image. */ - int imageX, int imageY, /* Origin of area to redraw, relative to - * origin of image. */ - int width, int height, /* Dimensions of area to redraw. */ - int drawableX, int drawableY) - /* Coordinates in drawable corresponding to - * imageX and imageY. */ -{ - TImageInstance *instPtr = (TImageInstance *)clientData; - char buffer[200 + TCL_INTEGER_SPACE * 6]; - - snprintf(buffer, sizeof(buffer), "%s display %d %d %d %d %d %d", - instPtr->modelPtr->imageName, imageX, imageY, width, height, - drawableX, drawableY); - Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, - buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - if (width > (instPtr->modelPtr->width - imageX)) { - width = instPtr->modelPtr->width - imageX; - } - if (height > (instPtr->modelPtr->height - imageY)) { - height = instPtr->modelPtr->height - imageY; - } - XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY, - (unsigned) (width-1), (unsigned) (height-1)); - XDrawLine(display, drawable, instPtr->gc, drawableX, drawableY, - (int) (drawableX + width - 1), (int) (drawableY + height - 1)); - XDrawLine(display, drawable, instPtr->gc, drawableX, - (int) (drawableY + height - 1), - (int) (drawableX + width - 1), drawableY); -} - -/* - *---------------------------------------------------------------------- - * - * ImageFree -- - * - * This function is called when an instance of an image is no longer - * used. - * - * Results: - * None. - * - * Side effects: - * Information related to the instance is freed. - * - *---------------------------------------------------------------------- - */ - -static void -ImageFree( - void *clientData, /* Pointer to TImageInstance for instance. */ - Display *display) /* Display where image was to be drawn. */ -{ - TImageInstance *instPtr = (TImageInstance *)clientData; - char buffer[200]; - - snprintf(buffer, sizeof(buffer), "%s free", instPtr->modelPtr->imageName); - Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, - buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - Tk_FreeColor(instPtr->fg); - Tk_FreeGC(display, instPtr->gc); - ckfree(instPtr); -} - -/* - *---------------------------------------------------------------------- - * - * ImageDelete -- - * - * This function is called to clean up a test image when an application - * goes away. - * - * Results: - * None. - * - * Side effects: - * Information about the image is deleted. - * - *---------------------------------------------------------------------- - */ - -static void -ImageDelete( - void *clientData) /* Pointer to TImageModel for image. When - * this function is called, no more instances - * exist. */ -{ - TImageModel *timPtr = (TImageModel *)clientData; - char buffer[100]; - - snprintf(buffer, sizeof(buffer), "%s delete", timPtr->imageName); - Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, - TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - - Tcl_DeleteCommand(timPtr->interp, timPtr->imageName); - ckfree(timPtr->imageName); - ckfree(timPtr->varName); - ckfree(timPtr); -} -#endif - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/generic/tkPack.c b/generic/tkPack.c index 65962bf..3ad8cae 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -122,10 +122,6 @@ static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyPacker; static Packer * GetPacker(Tk_Window tkwin); -#ifndef TK_NO_DEPRECATED -static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, - Packer *containerPtr, int objc,Tcl_Obj *const objv[]); -#endif /* !TK_NO_DEPRECATED */ static void PackStructureProc(void *clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); @@ -199,16 +195,10 @@ Tk_PackObjCmd( Tk_Window tkwin = (Tk_Window)clientData; const char *argv2; static const char *const optionStrings[] = { -#ifndef TK_NO_DEPRECATED - "after", "append", "before", "unpack", -#endif /* !TK_NO_DEPRECATED */ "configure", "content", "forget", "info", "propagate", "slaves", NULL }; static const char *const optionStringsNoDep[] = { "configure", "content", "forget", "info", "propagate", NULL }; enum options { -#ifndef TK_NO_DEPRECATED - PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, -#endif /* !TK_NO_DEPRECATED */ PACK_CONFIGURE, PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; int index; @@ -239,77 +229,11 @@ Tk_PackObjCmd( argv2 = Tcl_GetString(objv[2]); switch ((enum options) index) { -#ifndef TK_NO_DEPRECATED - case PACK_AFTER: { - Packer *prevPtr; - Tk_Window tkwin2; - - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - prevPtr = GetPacker(tkwin2); - if (prevPtr->containerPtr == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window \"%s\" isn't packed", argv2)); - Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", (char *)NULL); - return TCL_ERROR; - } - return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3); - } - case PACK_APPEND: { - Packer *containerPtr; - Packer *prevPtr; - Tk_Window tkwin2; - - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - containerPtr = GetPacker(tkwin2); - prevPtr = containerPtr->contentPtr; - if (prevPtr != NULL) { - while (prevPtr->nextPtr != NULL) { - prevPtr = prevPtr->nextPtr; - } - } - return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); - } - case PACK_BEFORE: { - Packer *packPtr, *containerPtr; - Packer *prevPtr; - Tk_Window tkwin2; - - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - packPtr = GetPacker(tkwin2); - if (packPtr->containerPtr == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window \"%s\" isn't packed", argv2)); - Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", (char *)NULL); - return TCL_ERROR; - } - containerPtr = packPtr->containerPtr; - prevPtr = containerPtr->contentPtr; - if (prevPtr == packPtr) { - prevPtr = NULL; - } else { - for ( ; ; prevPtr = prevPtr->nextPtr) { - if (prevPtr == NULL) { - Tcl_Panic("\"pack before\" couldn't find predecessor"); - } - if (prevPtr->nextPtr == packPtr) { - break; - } - } - } - return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); - } -#endif /* !TK_NO_DEPRECATED */ case PACK_CONFIGURE: if (argv2[0] != '.') { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be name of window", argv2)); - Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return TCL_ERROR; } return ConfigureContent(interp, tkwin, objc-2, objv+2); @@ -351,7 +275,7 @@ Tk_PackObjCmd( if (contentPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); - Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); return TCL_ERROR; } @@ -467,31 +391,6 @@ Tk_PackObjCmd( Tcl_SetObjResult(interp, resultObj); break; } -#ifndef TK_NO_DEPRECATED - case PACK_UNPACK: { - Tk_Window tkwin2; - Packer *packPtr; - - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "window"); - return TCL_ERROR; - } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - packPtr = GetPacker(tkwin2); - if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) { - Tk_ManageGeometry(tkwin2, NULL, NULL); - if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) { - Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->containerPtr->tkwin); - } - Unlink(packPtr); - Tk_UnmapWindow(packPtr->tkwin); - } - break; - } -#endif /* !TK_NO_DEPRECATED */ } return TCL_OK; @@ -1078,248 +977,6 @@ GetPacker( } /* - *------------------------------------------------------------------------ - * - * PackAfter -- - * - * This function does most of the real work of adding one or more windows - * into the packing order for its container. - * - * Results: - * A standard Tcl return value. - * - * Side effects: - * The geometry of the specified windows may change, both now and again - * in the future. - * - *------------------------------------------------------------------------ - */ - -#ifndef TK_NO_DEPRECATED -static int -PackAfter( - Tcl_Interp *interp, /* Interpreter for error reporting. */ - Packer *prevPtr, /* Pack windows in argv just after this - * window; NULL means pack as first child of - * containerPtr. */ - Packer *containerPtr, /* Container in which to pack windows. */ - int objc, /* Number of elements in objv. */ - Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: - * window name and side against which to - * pack. */ -{ - Packer *packPtr; - Tk_Window tkwin, ancestor, parent; - Tcl_Obj **options; - int c; - Tcl_Size index, optionCount; - - /* - * Iterate over all of the window specifiers, each consisting of two - * arguments. The first argument contains the window name and the - * additional arguments contain options such as "top" or "padx 20". - */ - - for ( ; objc > 0; objc -= 2, objv += 2, prevPtr = packPtr) { - if (objc < 2) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "wrong # args: window \"%s\" should be followed by options", - Tcl_GetString(objv[0]))); - Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", (char *)NULL); - return TCL_ERROR; - } - - /* - * Find the packer for the window to be packed, and make sure that the - * window in which it will be packed is either its or a descendant of - * its parent. - */ - - if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin) - != TCL_OK) { - return TCL_ERROR; - } - - parent = Tk_Parent(tkwin); - for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { - if (ancestor == parent) { - break; - } - if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) { - badWindow: - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[0]), - Tk_PathName(containerPtr->tkwin))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", (char *)NULL); - return TCL_ERROR; - } - } - if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) { - goto badWindow; - } - if (tkwin == containerPtr->tkwin) { - goto badWindow; - } - packPtr = GetPacker(tkwin); - - /* - * Process options for this window. - */ - - if (Tcl_ListObjGetElements(interp, objv[1], &optionCount, &options) - != TCL_OK) { - return TCL_ERROR; - } - packPtr->side = TOP; - packPtr->anchor = TK_ANCHOR_CENTER; - packPtr->padX = packPtr->padY = 0; - packPtr->padLeft = packPtr->padTop = 0; - packPtr->iPadX = packPtr->iPadY = 0; - packPtr->flags &= ~(FILLX|FILLY|EXPAND); - packPtr->flags |= OLD_STYLE; - for (index = 0 ; index < optionCount; index++) { - Tcl_Obj *curOptPtr = options[index]; - Tcl_Size length; - const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); - - c = curOpt[0]; - - if ((c == 't') - && (strncmp(curOpt, "top", length)) == 0) { - packPtr->side = TOP; - } else if ((c == 'b') - && (strncmp(curOpt, "bottom", length)) == 0) { - packPtr->side = BOTTOM; - } else if ((c == 'l') - && (strncmp(curOpt, "left", length)) == 0) { - packPtr->side = LEFT; - } else if ((c == 'r') - && (strncmp(curOpt, "right", length)) == 0) { - packPtr->side = RIGHT; - } else if ((c == 'e') - && (strncmp(curOpt, "expand", length)) == 0) { - packPtr->flags |= EXPAND; - } else if ((c == 'f') - && (strcmp(curOpt, "fill")) == 0) { - packPtr->flags |= FILLX|FILLY; - } else if ((length == 5) && (strcmp(curOpt, "fillx")) == 0) { - packPtr->flags |= FILLX; - } else if ((length == 5) && (strcmp(curOpt, "filly")) == 0) { - packPtr->flags |= FILLY; - } else if ((c == 'p') && (strcmp(curOpt, "padx")) == 0) { - if (optionCount <= (index+1)) { - missingPad: - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "wrong # args: \"%s\" option must be" - " followed by screen distance", curOpt)); - Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", - (char *)NULL); - return TCL_ERROR; - } - if (TkParsePadAmount(interp, tkwin, options[index+1], - &packPtr->padLeft, &packPtr->padX) != TCL_OK) { - return TCL_ERROR; - } - packPtr->padX /= 2; - packPtr->padLeft /= 2; - packPtr->iPadX = 0; - index++; - } else if ((c == 'p') && (strcmp(curOpt, "pady")) == 0) { - if (optionCount <= (index+1)) { - goto missingPad; - } - if (TkParsePadAmount(interp, tkwin, options[index+1], - &packPtr->padTop, &packPtr->padY) != TCL_OK) { - return TCL_ERROR; - } - packPtr->padY /= 2; - packPtr->padTop /= 2; - packPtr->iPadY = 0; - index++; - } else if ((c == 'f') && (length > 1) - && (strncmp(curOpt, "frame", length) == 0)) { - if (optionCount <= (index+1)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "wrong # args: \"frame\"" - " option must be followed by anchor point", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", - (char *)NULL); - return TCL_ERROR; - } - if (Tk_GetAnchorFromObj(interp, options[index+1], - &packPtr->anchor) != TCL_OK) { - return TCL_ERROR; - } - index++; - } else { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad option \"%s\": should be top, bottom, left," - " right, expand, fill, fillx, filly, padx, pady, or" - " frame", curOpt)); - Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", - (char *)NULL); - return TCL_ERROR; - } - } - - if (packPtr != prevPtr) { - /* - * Unpack this window if it's currently packed. - */ - - if (packPtr->containerPtr != NULL) { - if ((packPtr->containerPtr != containerPtr) && - (packPtr->containerPtr->tkwin - != Tk_Parent(packPtr->tkwin))) { - Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->containerPtr->tkwin); - } - Unlink(packPtr); - } - - /* - * Add the window in the correct place in its container's packing - * order, then make sure that the window is managed by us. - */ - - packPtr->containerPtr = containerPtr; - if (prevPtr == NULL) { - packPtr->nextPtr = containerPtr->contentPtr; - containerPtr->contentPtr = packPtr; - } else { - packPtr->nextPtr = prevPtr->nextPtr; - prevPtr->nextPtr = packPtr; - } - Tk_ManageGeometry(tkwin, &packerType, packPtr); - - if (!(containerPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") - != TCL_OK) { - Tk_ManageGeometry(tkwin, NULL, NULL); - Unlink(packPtr); - return TCL_ERROR; - } - containerPtr->flags |= ALLOCED_CONTAINER; - } - } - } - - /* - * Arrange for the container to be re-packed at the first idle moment. - */ - - if (containerPtr->abortPtr != NULL) { - *containerPtr->abortPtr = 1; - } - if (!(containerPtr->flags & REQUESTED_REPACK)) { - containerPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, containerPtr); - } - return TCL_OK; -} -#endif /* !TK_NO_DEPRECATED */ - -/* *---------------------------------------------------------------------- * * Unlink -- @@ -1586,7 +1243,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack \"%s\": it's a top-level window", Tcl_GetString(objv[j]))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } contentPtr = GetPacker(content); @@ -1612,7 +1269,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "extra option \"%s\" (option with no value?)", Tcl_GetString(objv[i]))); - Tcl_SetErrorCode(interp, "TK", "PACK", "BAD_PARAMETER", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "PACK", "BAD_PARAMETER", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, @@ -1634,7 +1291,7 @@ ConfigureContent( "window \"%s\" isn't packed", Tcl_GetString(objv[i+1]))); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", - (char *)NULL); + NULL); return TCL_ERROR; } containerPtr = prevPtr->containerPtr; @@ -1692,7 +1349,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad fill style \"%s\": must be " "none, x, y, or both", string)); - Tcl_SetErrorCode(interp, "TK", "VALUE", "FILL", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "FILL", NULL); return TCL_ERROR; } break; @@ -1718,7 +1375,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipadx value \"%s\": must be positive screen" " distance", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } contentPtr->iPadX = tmp * 2; @@ -1729,7 +1386,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipady value \"%s\": must be positive screen" " distance", Tcl_GetString(objv[i+1]))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } contentPtr->iPadY = tmp * 2; @@ -1809,14 +1466,14 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); return TCL_ERROR; } } if (content == containerPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack \"%s\" inside itself", Tcl_GetString(objv[j]))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } @@ -1830,7 +1487,7 @@ ConfigureContent( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); return TCL_ERROR; } } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index b244c9a..aab335e 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -80,11 +80,11 @@ typedef struct { typedef struct Pane { Tk_Window tkwin; /* Window being managed. */ - int minSize; /* Minimum size of this pane, on the relevant + Tcl_Obj *minSizeObj; /* Minimum size of this pane, on the relevant * axis, in pixels. */ - int padx; /* Additional padding requested for pane, in + Tcl_Obj *padXObj; /* Additional padding requested for pane, in * the x dimension. */ - int pady; /* Additional padding requested for pane, in + Tcl_Obj *padYObj; /* Additional padding requested for pane, in * the y dimension. */ Tcl_Obj *widthObj, *heightObj; /* Tcl_Obj rep's of pane width/height, to @@ -106,6 +106,10 @@ typedef struct Pane { /* Paned window managing the window. */ Tk_Window after; /* Placeholder for parsing options. */ Tk_Window before; /* Placeholder for parsing options. */ +#ifdef BUILD_tk + int padX, padY; + int minSize; +#endif } Pane; /* @@ -155,6 +159,8 @@ typedef struct PanedWindow { int numPanes; /* Number of panes. */ int sizeofPanes; /* Number of elements in the panes array. */ int flags; /* Flags for widget; see below. */ + Tcl_Obj *borderWidthObj; + Tcl_Obj *handlePadPtr; } PanedWindow; /* @@ -279,13 +285,13 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_PANEDWINDOW_BORDERWIDTH, TCL_INDEX_NONE, offsetof(PanedWindow, borderWidth), + DEF_PANEDWINDOW_BORDERWIDTH, offsetof(PanedWindow, borderWidthObj), offsetof(PanedWindow, borderWidth), 0, 0, GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad", - DEF_PANEDWINDOW_HANDLEPAD, TCL_INDEX_NONE, offsetof(PanedWindow, handlePad), + DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadPtr), offsetof(PanedWindow, handlePad), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize", DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr), @@ -314,7 +320,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad", - DEF_PANEDWINDOW_SASHPAD, TCL_INDEX_NONE, offsetof(PanedWindow, sashPad), + DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadPtr), offsetof(PanedWindow, sashPad), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief", DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief), @@ -344,11 +350,11 @@ static const Tk_OptionSpec paneOptionSpecs[] = { {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, - DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_MINSIZE, offsetof(Pane, minSizeObj), offsetof(Pane, minSize), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADX, offsetof(Pane, padXObj), offsetof(Pane, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADY, offsetof(Pane, padYObj), offsetof(Pane, padY), 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0, &stickyOption, 0}, @@ -798,7 +804,7 @@ ConfigurePanes( */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't add %s to itself", arg)); + "cannot add %s to itself", arg)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", (char *)NULL); return TCL_ERROR; } else if (Tk_IsTopLevel(tkwin)) { @@ -807,7 +813,7 @@ ConfigurePanes( */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't add toplevel %s to %s", arg, + "cannot add toplevel %s to %s", arg, Tk_PathName(pwPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL); return TCL_ERROR; @@ -824,7 +830,7 @@ ConfigurePanes( } if (Tk_IsTopLevel(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't add %s to %s", arg, + "cannot add %s to %s", arg, Tk_PathName(pwPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", (char *)NULL); @@ -949,7 +955,7 @@ ConfigurePanes( /* * Make sure this pane wasn't already put into the inserts array, * i.e., when the user specifies the same window multiple times in a - * single add commaned. + * single add command. */ for (j = 0; j < insertIndex; j++) { if (inserts[j]->tkwin == tkwin) { @@ -1794,14 +1800,14 @@ ArrangePanes( } else { paneSize = panePtr->paneWidth; } - stretchReserve -= paneSize + (2 * panePtr->padx); + stretchReserve -= paneSize + (2 * panePtr->padX); } else { if (panePtr->height > 0) { paneSize = panePtr->height; } else { paneSize = panePtr->paneHeight; } - stretchReserve -= paneSize + (2 * panePtr->pady); + stretchReserve -= paneSize + (2 * panePtr->padY); } if (IsStretchable(panePtr->stretch,i,first,last) && Tk_IsMapped(pwPtr->tkwin)) { @@ -1899,9 +1905,9 @@ ArrangePanes( } if (horizontal) { paneWidth = paneSize; - paneHeight = pwHeight - (2 * panePtr->pady); + paneHeight = pwHeight - (2 * panePtr->padY); } else { - paneWidth = pwWidth - (2 * panePtr->padx); + paneWidth = pwWidth - (2 * panePtr->padX); paneHeight = paneSize; } @@ -1945,7 +1951,7 @@ ArrangePanes( */ if (horizontal) { - x += paneWidth + (2 * panePtr->padx); + x += paneWidth + (2 * panePtr->padX); if (x < internalBW) { x = internalBW; } @@ -1955,7 +1961,7 @@ ArrangePanes( panePtr->handley = y + pwPtr->handlePad; x += sashWidth; } else { - y += paneHeight + (2 * panePtr->pady); + y += paneHeight + (2 * panePtr->padY); if (y < internalBW) { y = internalBW; } @@ -1975,8 +1981,8 @@ ArrangePanes( AdjustForSticky(panePtr->sticky, paneWidth, paneHeight, &paneX, &paneY, &newPaneWidth, &newPaneHeight); - paneX += panePtr->padx; - paneY += panePtr->pady; + paneX += panePtr->padX; + paneY += panePtr->padY; /* * Now put the window in the proper spot. @@ -2258,14 +2264,14 @@ ComputeGeometry( */ if (horizontal) { - x += panePtr->paneWidth + (2 * panePtr->padx); + x += panePtr->paneWidth + (2 * panePtr->padX); panePtr->sashx = x + sashOffset; panePtr->sashy = y; panePtr->handlex = x + handleOffset; panePtr->handley = y + pwPtr->handlePad; x += sashWidth; } else { - y += panePtr->paneHeight + (2 * panePtr->pady); + y += panePtr->paneHeight + (2 * panePtr->padY); panePtr->sashx = x; panePtr->sashy = y + sashOffset; panePtr->handlex = x + pwPtr->handlePad; @@ -2290,7 +2296,7 @@ ComputeGeometry( doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw; } - dim += 2 * panePtr->pady; + dim += 2 * panePtr->padY; if (dim > reqHeight) { reqHeight = dim; } @@ -2306,7 +2312,7 @@ ComputeGeometry( doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw; } - dim += 2 * panePtr->padx; + dim += 2 * panePtr->padX; if (dim > reqWidth) { reqWidth = dim; } @@ -2635,10 +2641,10 @@ MoveSash( } if (horizontal) { panePtr->paneWidth = panePtr->width = panePtr->sashx - - sashOffset - panePtr->x - (2 * panePtr->padx); + - sashOffset - panePtr->x - (2 * panePtr->padX); } else { panePtr->paneHeight = panePtr->height = panePtr->sashy - - sashOffset - panePtr->y - (2 * panePtr->pady); + - sashOffset - panePtr->y - (2 * panePtr->padY); } } diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c index 5050f8a..44c5e5e 100644 --- a/generic/tkPkgConfig.c +++ b/generic/tkPkgConfig.c @@ -14,20 +14,9 @@ /* Note, the definitions in this module are influenced by the following C * preprocessor macros: * - * OSCMa = shortcut for "old style configuration macro activates" - * NSCMdt = shortcut for "new style configuration macro declares that" - * - * - TCL_THREADS OSCMa compilation as threaded. - * - TCL_MEM_DEBUG OSCMa memory debugging. - * - * - TCL_CFG_DO64BIT NSCMdt tk is compiled for a 64bit system. - * - NDEBUG NSCMdt tk is compiled with symbol info off. - * - TCL_CFG_OPTIMIZED NSCMdt tk is compiled with cc optimizations on - * - TCL_CFG_PROFILED NSCMdt tk is compiled with profiling info. - * * - _WIN32 || __CYGWIN__ The value for the fontsytem key will be * MAC_OSX_TK chosen based on these macros/defines. - * HAVE_XFT NSCMdt xft font support was requested. + * HAVE_XFT declares that xft font support was requested. * * - CFG_RUNTIME_* Paths to various stuff at runtime. * - CFG_INSTALL_* Paths to various stuff at installation time. @@ -48,42 +37,6 @@ * configuration information. */ -#ifdef TCL_THREADS -# define CFG_THREADED "1" -#else -# define CFG_THREADED "0" -#endif - -#ifdef TCL_MEM_DEBUG -# define CFG_MEMDEBUG "1" -#else -# define CFG_MEMDEBUG "0" -#endif - -#ifdef TCL_CFG_DO64BIT -# define CFG_64 "1" -#else -# define CFG_64 "0" -#endif - -#ifndef NDEBUG -# define CFG_DEBUG "1" -#else -# define CFG_DEBUG "0" -#endif - -#ifdef TCL_CFG_OPTIMIZED -# define CFG_OPTIMIZED "1" -#else -# define CFG_OPTIMIZED "0" -#endif - -#ifdef TCL_CFG_PROFILED -# define CFG_PROFILED "1" -#else -# define CFG_PROFILED "0" -#endif - #if defined(_WIN32) # define CFG_FONTSYSTEM "gdi" #elif defined(MAC_OSX_TK) @@ -95,14 +48,6 @@ #endif static const Tcl_Config cfg[] = { -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - {"debug", CFG_DEBUG}, - {"threaded", CFG_THREADED}, - {"profiled", CFG_PROFILED}, - {"64bit", CFG_64}, - {"optimized", CFG_OPTIMIZED}, - {"mem_debug", CFG_MEMDEBUG}, -#endif {"fontsystem", CFG_FONTSYSTEM}, /* Runtime paths to various stuff */ diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index 46d425f..06012a7 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -46,12 +46,6 @@ EXTERN HINSTANCE Tk_GetHINSTANCE(void); EXTERN HWND Tk_GetHWND(Window window); /* 3 */ EXTERN Tk_Window Tk_HWNDToWindow(HWND hwnd); -/* 4 */ -EXTERN void Tk_PointerEvent(HWND hwnd, int x, int y); -/* 5 */ -EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam, - LRESULT *result); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* Slot 0 is reserved */ @@ -60,9 +54,7 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message, /* Slot 3 is reserved */ /* 4 */ EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp); -/* 5 */ -EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, - int width, int height, int flags); +/* Slot 5 is reserved */ /* 6 */ EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin); /* Slot 7 is reserved */ @@ -94,8 +86,6 @@ typedef struct TkPlatStubs { HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */ HWND (*tk_GetHWND) (Window window); /* 2 */ Tk_Window (*tk_HWNDToWindow) (HWND hwnd); /* 3 */ - void (*tk_PointerEvent) (HWND hwnd, int x, int y); /* 4 */ - int (*tk_TranslateWinEvent) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); /* 5 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*reserved0)(void); @@ -103,7 +93,7 @@ typedef struct TkPlatStubs { void (*reserved2)(void); void (*reserved3)(void); void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */ - void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */ + void (*reserved5)(void); void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */ void (*reserved7)(void); void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */ @@ -139,10 +129,6 @@ extern const TkPlatStubs *tkPlatStubsPtr; (tkPlatStubsPtr->tk_GetHWND) /* 2 */ #define Tk_HWNDToWindow \ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ -#define Tk_PointerEvent \ - (tkPlatStubsPtr->tk_PointerEvent) /* 4 */ -#define Tk_TranslateWinEvent \ - (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* Slot 0 is reserved */ @@ -151,8 +137,7 @@ extern const TkPlatStubs *tkPlatStubsPtr; /* Slot 3 is reserved */ #define TkMacOSXInitAppleEvents \ (tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */ -#define TkGenWMConfigureEvent_ \ - (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 5 */ +/* Slot 5 is reserved */ #define TkMacOSXInvalClipRgns \ (tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */ /* Slot 7 is reserved */ @@ -185,7 +170,6 @@ extern const TkPlatStubs *tkPlatStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#undef TkGenWMConfigureEvent_ #define Tk_MacOSXGetNSViewForDrawable TkMacOSXGetRootControl #endif /* _TKPLATDECLS */ diff --git a/generic/tkPointer.c b/generic/tkPointer.c index 2fbdedf..1bc8411 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -512,14 +512,14 @@ TkPointerDeadWindow( } if (!(tsdPtr->restrictWinPtr || tsdPtr->grabWinPtr)) { - /* - * Release mouse capture only if the dead window is the capturing - * window. - */ + /* + * Release mouse capture only if the dead window is the capturing + * window. + */ - if (winPtr == (TkWindow *)TkpGetCapture()) { + if (winPtr == (TkWindow *)TkpGetCapture()) { TkpSetCapture(NULL); - } + } } } diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 2162591..a228f88 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -171,7 +171,7 @@ Tk_ItemType tkRectangleType = { RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ RectToPoint, /* pointProc */ RectToArea, /* areaProc */ RectOvalToPostscript, /* postscriptProc */ @@ -196,7 +196,7 @@ Tk_ItemType tkOvalType = { RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ - TK_CONFIG_OBJS, /* flags */ + 0, /* flags */ OvalToPoint, /* pointProc */ OvalToArea, /* areaProc */ RectOvalToPostscript, /* postscriptProc */ @@ -416,7 +416,7 @@ ConfigureRectOval( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (const char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) { + objv, rectOvalPtr, flags)) { return TCL_ERROR; } state = itemPtr->state; @@ -765,101 +765,101 @@ DisplayRectOval( &x2, &y2); if (x2 == x1) { - /* - * The width of the bounding box corresponds to less than one pixel - * on screen. Adjustment is needed to avoid drawing attempts with zero - * width items (which would draw nothing). The bounding box spans - * either 1 or 2 pixels. Select which pixel will be drawn. - */ - - short ix1 = (short) (rectOvalPtr->bbox[0]); - short ix2 = (short) (rectOvalPtr->bbox[2]); - - if (ix1 == ix2) { - - /* - * x1 and x2 are "within the same pixel". Use this pixel. - * Note: the degenerated case (bbox[0]==bbox[2]) of a completely - * flat box results in arbitrary selection of the pixel at the - * right (with positive coordinate) or left (with negative - * coordinate) of the box. There is no "best choice" here. - */ - - if (ix1 > 0) { - x2 += 1; - } else { - x1 -= 1; - } - } else { - - /* - * (x1,x2) span two pixels. Select the one with the larger - * covered "area". - */ - - if (ix1 > 0) { - if ((rectOvalPtr->bbox[2] - ix2) > (ix2 - rectOvalPtr->bbox[0])) { - x2 += 1; - } else { - x1 -= 1; - } - } else { - if ((rectOvalPtr->bbox[2] - ix1) > (ix1 - rectOvalPtr->bbox[0])) { - x2 += 1; - } else { - x1 -= 1; - } - } - } + /* + * The width of the bounding box corresponds to less than one pixel + * on screen. Adjustment is needed to avoid drawing attempts with zero + * width items (which would draw nothing). The bounding box spans + * either 1 or 2 pixels. Select which pixel will be drawn. + */ + + short ix1 = (short) (rectOvalPtr->bbox[0]); + short ix2 = (short) (rectOvalPtr->bbox[2]); + + if (ix1 == ix2) { + + /* + * x1 and x2 are "within the same pixel". Use this pixel. + * Note: the degenerated case (bbox[0]==bbox[2]) of a completely + * flat box results in arbitrary selection of the pixel at the + * right (with positive coordinate) or left (with negative + * coordinate) of the box. There is no "best choice" here. + */ + + if (ix1 > 0) { + x2 += 1; + } else { + x1 -= 1; + } + } else { + + /* + * (x1,x2) span two pixels. Select the one with the larger + * covered "area". + */ + + if (ix1 > 0) { + if ((rectOvalPtr->bbox[2] - ix2) > (ix2 - rectOvalPtr->bbox[0])) { + x2 += 1; + } else { + x1 -= 1; + } + } else { + if ((rectOvalPtr->bbox[2] - ix1) > (ix1 - rectOvalPtr->bbox[0])) { + x2 += 1; + } else { + x1 -= 1; + } + } + } } if (y2 == y1) { - /* - * The height of the bounding box corresponds to less than one pixel - * on screen. Adjustment is needed to avoid drawing attempts with zero - * height items (which would draw nothing). The bounding box spans - * either 1 or 2 pixels. Select which pixel will be drawn. - */ - - short iy1 = (short) (rectOvalPtr->bbox[1]); - short iy2 = (short) (rectOvalPtr->bbox[3]); - - if (iy1 == iy2) { - - /* - * y1 and y2 are "within the same pixel". Use this pixel. - * Note: the degenerated case (bbox[1]==bbox[3]) of a completely - * flat box results in arbitrary selection of the pixel below - * (with positive coordinate) or above (with negative coordinate) - * the box. There is no "best choice" here. - */ - - if (iy1 > 0) { - y2 += 1; - } else { - y1 -= 1; - } - } else { - - /* - * (y1,y2) span two pixels. Select the one with the larger - * covered "area". - */ - - if (iy1 > 0) { - if ((rectOvalPtr->bbox[3] - iy2) > (iy2 - rectOvalPtr->bbox[1])) { - y2 += 1; - } else { - y1 -= 1; - } - } else { - if ((rectOvalPtr->bbox[3] - iy1) > (iy1 - rectOvalPtr->bbox[1])) { - y2 += 1; - } else { - y1 -= 1; - } - } - } + /* + * The height of the bounding box corresponds to less than one pixel + * on screen. Adjustment is needed to avoid drawing attempts with zero + * height items (which would draw nothing). The bounding box spans + * either 1 or 2 pixels. Select which pixel will be drawn. + */ + + short iy1 = (short) (rectOvalPtr->bbox[1]); + short iy2 = (short) (rectOvalPtr->bbox[3]); + + if (iy1 == iy2) { + + /* + * y1 and y2 are "within the same pixel". Use this pixel. + * Note: the degenerated case (bbox[1]==bbox[3]) of a completely + * flat box results in arbitrary selection of the pixel below + * (with positive coordinate) or above (with negative coordinate) + * the box. There is no "best choice" here. + */ + + if (iy1 > 0) { + y2 += 1; + } else { + y1 -= 1; + } + } else { + + /* + * (y1,y2) span two pixels. Select the one with the larger + * covered "area". + */ + + if (iy1 > 0) { + if ((rectOvalPtr->bbox[3] - iy2) > (iy2 - rectOvalPtr->bbox[1])) { + y2 += 1; + } else { + y1 -= 1; + } + } else { + if ((rectOvalPtr->bbox[3] - iy1) > (iy1 - rectOvalPtr->bbox[1])) { + y2 += 1; + } else { + y1 -= 1; + } + } + } } /* diff --git a/generic/tkScale.c b/generic/tkScale.c index a112f48..c55ebfd 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -49,7 +49,7 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_SCALE_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(TkScale, borderWidth), + DEF_SCALE_BORDER_WIDTH, offsetof(TkScale, borderWidthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_SCALE_COMMAND, TCL_INDEX_NONE, offsetof(TkScale, command), @@ -77,13 +77,13 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_SCALE_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkScale, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, - offsetof(TkScale, highlightWidth), 0, 0, 0}, + "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, offsetof(TkScale, highlightWidthObj), + TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING, "-label", "label", "Label", DEF_SCALE_LABEL, TCL_INDEX_NONE, offsetof(TkScale, label), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", - DEF_SCALE_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, length), 0, 0, 0}, + DEF_SCALE_LENGTH, offsetof(TkScale, lengthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", DEF_SCALE_ORIENT, TCL_INDEX_NONE, offsetof(TkScale, orient), TK_OPTION_ENUM_VAR, orientStrings, 0}, @@ -102,7 +102,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_SCALE_SHOW_VALUE, TCL_INDEX_NONE, offsetof(TkScale, showValue), 0, 0, 0}, {TK_OPTION_PIXELS, "-sliderlength", "sliderLength", "SliderLength", - DEF_SCALE_SLIDER_LENGTH, TCL_INDEX_NONE, offsetof(TkScale, sliderLength), + DEF_SCALE_SLIDER_LENGTH, offsetof(TkScale, sliderLengthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief", DEF_SCALE_SLIDER_RELIEF, TCL_INDEX_NONE, offsetof(TkScale, sliderRelief), @@ -125,7 +125,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_SCALE_VARIABLE, offsetof(TkScale, varNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_SCALE_WIDTH, TCL_INDEX_NONE, offsetof(TkScale, width), 0, 0, 0}, + DEF_SCALE_WIDTH, offsetof(TkScale, widthObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; @@ -281,8 +281,8 @@ Tk_ScaleObjCmd( scalePtr, ScaleCmdDeletedProc); scalePtr->optionTable = optionTable; scalePtr->orient = ORIENT_VERTICAL; - scalePtr->width = 0; - scalePtr->length = 0; + scalePtr->widthObj = NULL; + scalePtr->lengthObj = NULL; scalePtr->value = 0.0; scalePtr->varNamePtr = NULL; scalePtr->fromValue = 0.0; @@ -297,7 +297,7 @@ Tk_ScaleObjCmd( scalePtr->label = NULL; scalePtr->labelLength = 0; scalePtr->state = STATE_NORMAL; - scalePtr->borderWidth = 0; + scalePtr->borderWidthObj = NULL; scalePtr->bgBorder = NULL; scalePtr->activeBorder = NULL; scalePtr->sliderRelief = TK_RELIEF_RAISED; @@ -308,11 +308,11 @@ Tk_ScaleObjCmd( scalePtr->textColorPtr = NULL; scalePtr->textGC = NULL; scalePtr->relief = TK_RELIEF_FLAT; - scalePtr->highlightWidth = 0; + scalePtr->highlightWidthObj = NULL; scalePtr->highlightBorder = NULL; scalePtr->highlightColorPtr = NULL; scalePtr->inset = 0; - scalePtr->sliderLength = 0; + scalePtr->sliderLengthObj = NULL; scalePtr->showValue = 0; scalePtr->horizLabelY = 0; scalePtr->horizValueY = 0; @@ -327,6 +327,8 @@ Tk_ScaleObjCmd( scalePtr->takeFocusPtr = NULL; scalePtr->flags = NEVER_SET; + + Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, scalePtr); Tk_CreateEventHandler(scalePtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, @@ -416,7 +418,7 @@ ScaleWidgetObjCmd( } break; case COMMAND_COORDS: { - int x, y; + int x, y, width, borderWidth; double value; Tcl_Obj *coords[2]; @@ -431,14 +433,16 @@ ScaleWidgetObjCmd( } else { value = scalePtr->value; } + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->widthObj, &width); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); if (scalePtr->orient == ORIENT_VERTICAL) { - x = scalePtr->vertTroughX + scalePtr->width/2 - + scalePtr->borderWidth; + x = scalePtr->vertTroughX + width/2 + + borderWidth; y = TkScaleValueToPixel(scalePtr, value); } else { x = TkScaleValueToPixel(scalePtr, value); - y = scalePtr->horizTroughY + scalePtr->width/2 - + scalePtr->borderWidth; + y = scalePtr->horizTroughY + width/2 + + borderWidth; } coords[0] = Tcl_NewWideIntObj(x); coords[1] = Tcl_NewWideIntObj(y); @@ -595,7 +599,7 @@ ConfigureScale( { Tk_SavedOptions savedOptions; Tcl_Obj *errorResult = NULL; - int error; + int error, highlightWidth, borderWidth; double varValue; /* @@ -647,10 +651,10 @@ ConfigureScale( } } - /* - * The fromValue shall not be rounded to the resolution, but the - * toValue and tickInterval do. - */ + /* + * The fromValue shall not be rounded to the resolution, but the + * toValue and tickInterval do. + */ scalePtr->toValue = TkRoundValueToResolution(scalePtr, scalePtr->toValue); scalePtr->tickInterval = TkRoundIntervalToResolution(scalePtr, @@ -673,10 +677,17 @@ ConfigureScale( Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder); - if (scalePtr->highlightWidth < 0) { - scalePtr->highlightWidth = 0; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->highlightWidthObj, &highlightWidth); + if (highlightWidth < 0) { + highlightWidth = 0; + if (scalePtr->highlightWidthObj) { + Tcl_DecrRefCount(scalePtr->highlightWidthObj); + } + scalePtr->highlightWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(scalePtr->highlightWidthObj); } - scalePtr->inset = scalePtr->highlightWidth + scalePtr->borderWidth; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); + scalePtr->inset = highlightWidth + borderWidth; break; } if (!error) { @@ -712,9 +723,9 @@ ConfigureScale( } else { char varString[TCL_DOUBLE_SPACE], scaleString[TCL_DOUBLE_SPACE]; - Tcl_PrintDouble(NULL, varValue, varString); - Tcl_PrintDouble(NULL, scalePtr->value, scaleString); - if (strcmp(varString, scaleString)) { + Tcl_PrintDouble(NULL, varValue, varString); + Tcl_PrintDouble(NULL, scalePtr->value, scaleString); + if (strcmp(varString, scaleString)) { ScaleSetVariable(scalePtr); } } @@ -757,6 +768,7 @@ ScaleWorldChanged( XGCValues gcValues; GC gc; TkScale *scalePtr = (TkScale *)instanceData; + int highlightWidth, borderWidth; gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); @@ -778,7 +790,9 @@ ScaleWorldChanged( scalePtr->copyGC = Tk_GetGC(scalePtr->tkwin, GCGraphicsExposures, &gcValues); } - scalePtr->inset = scalePtr->highlightWidth + scalePtr->borderWidth; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->highlightWidthObj, &highlightWidth); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); + scalePtr->inset = highlightWidth + borderWidth; /* * Recompute display-related information, and let the geometry manager @@ -931,10 +945,12 @@ ComputeFormat( * value between adjacent pixels and use it for the least * significant digit. */ + int length; x = fabs(scalePtr->fromValue - scalePtr->toValue); - if (scalePtr->length > 0) { - x /= scalePtr->length; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->lengthObj, &length); + if (length > 0) { + x /= length; } if (x > 0) { leastSigDigit = ScaleDigit(x); @@ -1011,6 +1027,7 @@ ComputeScaleGeometry( char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, tickPixels, x, y, extraSpace; Tk_FontMetrics fm; + int length, width, borderWidth; Tk_GetFontMetrics(scalePtr->tkfont, &fm); scalePtr->fontHeight = fm.linespace + SPACING; @@ -1038,13 +1055,16 @@ ComputeScaleGeometry( } y += extraSpace; scalePtr->horizTroughY = y; - y += scalePtr->width + 2*scalePtr->borderWidth; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->lengthObj, &length); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->widthObj, &width); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); + y += width + 2 * borderWidth; if (scalePtr->tickInterval != 0) { scalePtr->horizTickY = y + SPACING; y += scalePtr->fontHeight + SPACING; } Tk_GeometryRequest(scalePtr->tkwin, - scalePtr->length + 2*scalePtr->inset, y + scalePtr->inset); + length + 2*scalePtr->inset, y + scalePtr->inset); Tk_SetInternalBorder(scalePtr->tkwin, scalePtr->inset); return; } @@ -1056,14 +1076,14 @@ ComputeScaleGeometry( */ if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->valueFormat, - scalePtr->fromValue) < 0) { - valueString[TCL_DOUBLE_SPACE - 1] = '\0'; + scalePtr->fromValue) < 0) { + valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } valuePixels = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->valueFormat, - scalePtr->toValue) < 0) { - valueString[TCL_DOUBLE_SPACE - 1] = '\0'; + scalePtr->toValue) < 0) { + valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tmp = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (valuePixels < tmp) { @@ -1075,14 +1095,14 @@ ComputeScaleGeometry( */ if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->tickFormat, - scalePtr->fromValue) < 0) { - valueString[TCL_DOUBLE_SPACE - 1] = '\0'; + scalePtr->fromValue) < 0) { + valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tickPixels = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->tickFormat, - scalePtr->toValue) < 0) { - valueString[TCL_DOUBLE_SPACE - 1] = '\0'; + scalePtr->toValue) < 0) { + valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tmp = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (tickPixels < tmp) { @@ -1113,7 +1133,9 @@ ComputeScaleGeometry( scalePtr->vertValueRightX = x; } scalePtr->vertTroughX = x; - x += 2*scalePtr->borderWidth + scalePtr->width; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->widthObj, &width); + x += 2 * borderWidth + width; if (scalePtr->labelLength == 0) { scalePtr->vertLabelX = 0; } else { @@ -1122,8 +1144,9 @@ ComputeScaleGeometry( + Tk_TextWidth(scalePtr->tkfont, scalePtr->label, scalePtr->labelLength); } + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->lengthObj, &length); Tk_GeometryRequest(scalePtr->tkwin, x + scalePtr->inset, - scalePtr->length + 2*scalePtr->inset); + length + 2*scalePtr->inset); Tk_SetInternalBorder(scalePtr->tkwin, scalePtr->inset); } @@ -1151,6 +1174,7 @@ ScaleEventProc( XEvent *eventPtr) /* Information about event. */ { TkScale *scalePtr = (TkScale *)clientData; + int highlightWidth; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); @@ -1162,14 +1186,16 @@ ScaleEventProc( } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { scalePtr->flags |= GOT_FOCUS; - if (scalePtr->highlightWidth > 0) { + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->highlightWidthObj, &highlightWidth); + if (highlightWidth > 0) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); } } } else if (eventPtr->type == FocusOut) { if (eventPtr->xfocus.detail != NotifyInferior) { scalePtr->flags &= ~GOT_FOCUS; - if (scalePtr->highlightWidth > 0) { + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->highlightWidthObj, &highlightWidth); + if (highlightWidth > 0) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); } } @@ -1277,7 +1303,7 @@ TkRoundValueToResolution( double value) /* Value to round. */ { return TkRoundIntervalToResolution(scalePtr, value - scalePtr->fromValue) - + scalePtr->fromValue; + + scalePtr->fromValue; } double @@ -1294,13 +1320,13 @@ TkRoundIntervalToResolution( rounded = scalePtr->resolution * tick; rem = value - rounded; if (rem < 0) { - if (rem <= -scalePtr->resolution/2) { - rounded = (tick - 1.0) * scalePtr->resolution; - } + if (rem <= -scalePtr->resolution/2) { + rounded = (tick - 1.0) * scalePtr->resolution; + } } else { - if (rem >= scalePtr->resolution/2) { - rounded = (tick + 1.0) * scalePtr->resolution; - } + if (rem >= scalePtr->resolution/2) { + rounded = (tick + 1.0) * scalePtr->resolution; + } } return rounded; } @@ -1344,27 +1370,27 @@ ScaleVarProc( */ if (flags & TCL_TRACE_UNSETS) { - if (!Tcl_InterpDeleted(interp) && scalePtr->varNamePtr) { - void *probe = NULL; - - do { - probe = Tcl_VarTraceInfo(interp, - Tcl_GetString(scalePtr->varNamePtr), - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - ScaleVarProc, probe); - if (probe == (void *)scalePtr) { - break; - } - } while (probe); - if (probe) { - /* - * We were able to fetch the unset trace for our - * varNamePtr, which means it is not unset and not - * the cause of this unset trace. Instead some outdated - * former variable must be, and we should ignore it. - */ - return NULL; - } + if (!Tcl_InterpDeleted(interp) && scalePtr->varNamePtr) { + void *probe = NULL; + + do { + probe = Tcl_VarTraceInfo(interp, + Tcl_GetString(scalePtr->varNamePtr), + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + ScaleVarProc, probe); + if (probe == (void *)scalePtr) { + break; + } + } while (probe); + if (probe) { + /* + * We were able to fetch the unset trace for our + * varNamePtr, which means it is not unset and not + * the cause of this unset trace. Instead some outdated + * former variable must be, and we should ignore it. + */ + return NULL; + } Tcl_TraceVar2(interp, Tcl_GetString(scalePtr->varNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, clientData); @@ -1490,10 +1516,10 @@ ScaleSetVariable( if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; - if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, - scalePtr->value) < 0) { - string[TCL_DOUBLE_SPACE - 1] = '\0'; - } + if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, + scalePtr->value) < 0) { + string[TCL_DOUBLE_SPACE - 1] = '\0'; + } scalePtr->flags |= SETTING_VAR; Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL, Tcl_NewStringObj(string, TCL_INDEX_NONE), TCL_GLOBAL_ONLY); @@ -1525,14 +1551,17 @@ TkScalePixelToValue( int x, int y) /* Coordinates of point within window. */ { double value, pixelRange; + int borderWidth, sliderLength; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->sliderLengthObj, &sliderLength); if (scalePtr->orient == ORIENT_VERTICAL) { - pixelRange = Tk_Height(scalePtr->tkwin) - scalePtr->sliderLength - - 2*scalePtr->inset - 2*scalePtr->borderWidth; + pixelRange = Tk_Height(scalePtr->tkwin) - sliderLength + - 2 * scalePtr->inset - 2 * borderWidth; value = y; } else { - pixelRange = Tk_Width(scalePtr->tkwin) - scalePtr->sliderLength - - 2*scalePtr->inset - 2*scalePtr->borderWidth; + pixelRange = Tk_Width(scalePtr->tkwin) - sliderLength + - 2 * scalePtr->inset - 2 * borderWidth; value = x; } @@ -1544,8 +1573,8 @@ TkScalePixelToValue( return scalePtr->value; } - value -= scalePtr->sliderLength/2 + scalePtr->inset - + scalePtr->borderWidth; + value -= sliderLength/2 + scalePtr->inset + + borderWidth; value /= pixelRange; if (value < 0) { value = 0; @@ -1584,11 +1613,14 @@ TkScaleValueToPixel( { int y, pixelRange; double valueRange; + int borderWidth, sliderLength; + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth); + Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->sliderLengthObj, &sliderLength); valueRange = scalePtr->toValue - scalePtr->fromValue; pixelRange = ((scalePtr->orient == ORIENT_VERTICAL) ? Tk_Height(scalePtr->tkwin) : Tk_Width(scalePtr->tkwin)) - - scalePtr->sliderLength - 2*scalePtr->inset - 2*scalePtr->borderWidth; + - sliderLength - 2 * scalePtr->inset - 2 * borderWidth; if (valueRange == 0) { y = 0; } else { @@ -1600,7 +1632,7 @@ TkScaleValueToPixel( y = pixelRange; } } - y += scalePtr->sliderLength/2 + scalePtr->inset + scalePtr->borderWidth; + y += sliderLength / 2 + scalePtr->inset + borderWidth; return y; } diff --git a/generic/tkScale.h b/generic/tkScale.h index 7ecf1a1..4a59901 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -53,9 +53,9 @@ typedef struct TkScale { * available for this widget. */ enum orient orient; /* Orientation for window (vertical or * horizontal). */ - int width; /* Desired narrow dimension of scale, in + Tcl_Obj *widthObj; /* Desired narrow dimension of scale, in * pixels. */ - int length; /* Desired long dimension of scale, in + Tcl_Obj *lengthObj; /* Desired long dimension of scale, in * pixels. */ double value; /* Current value of scale. */ Tcl_Obj *varNamePtr; /* Name of variable or NULL. If non-NULL, @@ -96,7 +96,7 @@ typedef struct TkScale { * Information used when displaying widget: */ - int borderWidth; /* Width of 3-D border around window. */ + Tcl_Obj *borderWidthObj; /* Width of 3-D border around window. */ Tk_3DBorder bgBorder; /* Used for drawing slider and other * background areas. */ Tk_3DBorder activeBorder; /* For drawing the slider when active. */ @@ -110,7 +110,7 @@ typedef struct TkScale { GC textGC; /* GC for drawing text in normal mode. */ int relief; /* Indicates whether window as a whole is * raised, sunken, or flat. */ - int highlightWidth; /* Width in pixels of highlight to draw around + Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw around * widget when it has the focus. <= 0 means * don't draw a highlight. */ Tk_3DBorder highlightBorder;/* Value of -highlightbackground option: @@ -123,7 +123,7 @@ typedef struct TkScale { * Indicates how much interior stuff must be * offset from outside edges to leave room for * borders. */ - int sliderLength; /* Length of slider, measured in pixels along + Tcl_Obj *sliderLengthObj; /* Length of slider, measured in pixels along * long dimension of scale. */ int showValue; /* Non-zero means to display the scale value * below or to the left of the slider; zero diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index ec94418..eaf3314 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -172,18 +172,12 @@ Tk_ScrollbarObjCmd( scrollPtr->highlightBgColorPtr = NULL; scrollPtr->highlightColorPtr = NULL; scrollPtr->inset = 0; - scrollPtr->elementBorderWidth = -1; + scrollPtr->elementBorderWidth = INT_MIN; scrollPtr->arrowLength = 0; scrollPtr->sliderFirst = 0; scrollPtr->sliderLast = 0; scrollPtr->activeField = 0; scrollPtr->activeRelief = TK_RELIEF_RAISED; -#ifndef TK_NO_DEPRECATED - scrollPtr->totalUnits = 0; - scrollPtr->windowUnits = 0; - scrollPtr->firstUnit = 0; - scrollPtr->lastUnit = 0; -#endif /* TK_NO_DEPRECATED */ scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; scrollPtr->cursor = NULL; @@ -228,12 +222,12 @@ ScrollbarWidgetObjCmd( int result = TCL_OK, cmdIndex, length; Tcl_Size len; static const char *const commandNames[] = { - "activate", "cget", "configure", "delta", "fraction", - "get", "identify", "set", NULL + "activate", "cget", "configure", "delta", "fraction", + "get", "identify", "set", NULL }; enum command { - COMMAND_ACTIVATE, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELTA, - COMMAND_FRACTION, COMMAND_GET, COMMAND_IDENTIFY, COMMAND_SET + COMMAND_ACTIVATE, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELTA, + COMMAND_FRACTION, COMMAND_GET, COMMAND_IDENTIFY, COMMAND_SET }; if (objc < 2) { @@ -378,16 +372,6 @@ ScrollbarWidgetObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "get"); goto error; } -#ifndef TK_NO_DEPRECATED - if (scrollPtr->flags & OLD_STYLE_COMMANDS) { - resObjs[0] = Tcl_NewWideIntObj(scrollPtr->totalUnits); - resObjs[1] = Tcl_NewWideIntObj(scrollPtr->windowUnits); - resObjs[2] = Tcl_NewWideIntObj(scrollPtr->firstUnit); - resObjs[3] = Tcl_NewWideIntObj(scrollPtr->lastUnit); - Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs)); - break; - } -#endif /* TK_NO_DEPRECATED */ resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction); resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction); Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs)); @@ -439,48 +423,6 @@ ScrollbarWidgetObjCmd( } else { scrollPtr->lastFraction = last; } -#ifndef TK_NO_DEPRECATED - scrollPtr->flags &= ~OLD_STYLE_COMMANDS; - } else if (objc == 6) { - int totalUnits, windowUnits, firstUnit, lastUnit; - if (Tcl_GetIntFromObj(interp, objv[2], &totalUnits) != TCL_OK) { - goto error; - } - if (totalUnits < 0) { - totalUnits = 0; - } - if (Tcl_GetIntFromObj(interp, objv[3], &windowUnits) != TCL_OK) { - goto error; - } - if (windowUnits < 0) { - windowUnits = 0; - } - if (Tcl_GetIntFromObj(interp, objv[4], &firstUnit) != TCL_OK) { - goto error; - } - if (Tcl_GetIntFromObj(interp, objv[5], &lastUnit) != TCL_OK) { - goto error; - } - if (totalUnits > 0) { - if (lastUnit < firstUnit) { - lastUnit = firstUnit; - } - } else { - firstUnit = lastUnit = 0; - } - scrollPtr->totalUnits = totalUnits; - scrollPtr->windowUnits = windowUnits; - scrollPtr->firstUnit = firstUnit; - scrollPtr->lastUnit = lastUnit; - if (scrollPtr->totalUnits == 0) { - scrollPtr->firstFraction = 0.0; - scrollPtr->lastFraction = 1.0; - } else { - scrollPtr->firstFraction = ((double) firstUnit)/totalUnits; - scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits; - } - scrollPtr->flags |= OLD_STYLE_COMMANDS; -#endif /* !TK_NO_DEPRECATED */ } else { Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction"); goto error; @@ -531,7 +473,7 @@ ConfigureScrollbar( int flags) /* Flags to pass to Tk_ConfigureWidget. */ { if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc, - (const char **)objv, (char *) scrollPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { + objv, scrollPtr, flags) != TCL_OK) { return TCL_ERROR; } @@ -541,17 +483,19 @@ ConfigureScrollbar( */ if (scrollPtr->command != NULL) { - scrollPtr->commandSize = (int) strlen(scrollPtr->command); + scrollPtr->commandSize = (int) strlen(scrollPtr->command); } else { scrollPtr->commandSize = 0; } if (scrollPtr->highlightWidth < 0) { scrollPtr->highlightWidth = 0; } + if (scrollPtr->borderWidth < 0) { + scrollPtr->borderWidth = 0; + } if (scrollPtr->elementBorderWidth < 0) { - scrollPtr->elementBorderWidth = -1; + scrollPtr->elementBorderWidth = INT_MIN; } - /* * Configure platform specific options. */ diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index 6912e71..3543d4f 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.h @@ -96,22 +96,6 @@ typedef struct TkScrollbar { * the OLD_STYLE_COMMANDS flag is 1. */ -#ifndef TK_NO_DEPRECATED - int totalUnits; /* Total dimension of application, in units. - * Valid only if the OLD_STYLE_COMMANDS flag - * is set. */ - int windowUnits; /* Maximum number of units that can be - * displayed in the window at once. Valid only - * if the OLD_STYLE_COMMANDS flag is set. */ - int firstUnit; /* Number of last unit visible in - * application's window. Valid only if the - * OLD_STYLE_COMMANDS flag is set. */ - int lastUnit; /* Index of last unit visible in window. - * Valid only if the OLD_STYLE_COMMANDS flag - * isn't set. */ -#else - int dummy1,dummy2,dummy3,dummy4; /* sizeof(TkScrollbar) should not depend on TK_NO_DEPRECATED */ -#endif /* TK_NO_DEPRECATED */ double firstFraction; /* Position of first visible thing in window, * specified as a fraction between 0 and * 1.0. */ @@ -157,9 +141,6 @@ typedef struct TkScrollbar { */ #define REDRAW_PENDING 1 -#ifndef TK_NO_DEPRECATED -# define OLD_STYLE_COMMANDS 2 -#endif /* TK_NO_DEPRECATED */ #define GOT_FOCUS 4 /* diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 3478c3c..752b5ea 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1401,15 +1401,15 @@ HandleTclCommand( if (cmdInfoPtr->interp != NULL) { if (length <= maxBytes) { - cmdInfoPtr->charOffset += TkNumUtfChars(string, TCL_INDEX_NONE); + cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, TCL_INDEX_NONE); cmdInfoPtr->buffer[0] = '\0'; } else { - int ch = 0; + Tcl_UniChar ch = 0; p = string; string += count; numChars = 0; while (p < string) { - p += TkUtfToUniChar(p, &ch); + p += Tcl_UtfToUniChar(p, &ch); numChars++; } cmdInfoPtr->charOffset += numChars; diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 708adbe..2c58e3f 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -23,6 +23,7 @@ # define USE_TK_STUBS #endif #include "tkInt.h" +#include <stdbool.h> /* * A data structure of the following type is kept for each square widget @@ -47,16 +48,16 @@ typedef struct { * Information used when displaying widget: */ - Tcl_Obj *borderWidthPtr; /* Width of 3-D border around whole widget. */ + Tcl_Obj *borderWidthObj; /* Width of 3-D border around whole widget. */ Tcl_Obj *bgBorderPtr; Tcl_Obj *fgBorderPtr; Tcl_Obj *reliefPtr; GC gc; /* Graphics context for copying from * off-screen pixmap onto screen. */ - Tcl_Obj *doubleBufferPtr; /* Non-zero means double-buffer redisplay with - * pixmap; zero means draw straight onto the + bool doubleBuffer; /* true means double-buffer redisplay with + * pixmap; false means draw straight onto the * display. */ - int updatePending; /* Non-zero means a call to SquareDisplay has + bool updatePending; /* true means a call to SquareDisplay has * already been scheduled. */ } Square; @@ -73,9 +74,9 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - "2", offsetof(Square, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0}, + "2", offsetof(Square, borderWidthObj), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer", - "1", offsetof(Square, doubleBufferPtr), TCL_INDEX_NONE, 0 , NULL, 0}, + "1", TCL_INDEX_NONE, offsetof(Square, doubleBuffer), TK_OPTION_VAR(bool) , NULL, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", @@ -279,7 +280,7 @@ SquareWidgetObjCmd( } if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); - squarePtr->updatePending = 1; + squarePtr->updatePending = true; } } if (resultObjPtr != NULL) { @@ -321,7 +322,6 @@ SquareConfigure( { int borderWidth; Tk_3DBorder bgBorder; - int doubleBuffer; /* * Set the background for the window and create a graphics context for use @@ -332,8 +332,7 @@ SquareConfigure( squarePtr->bgBorderPtr); Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); - Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); - if ((squarePtr->gc == NULL) && doubleBuffer) { + if ((squarePtr->gc == NULL) && squarePtr->doubleBuffer) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; @@ -347,12 +346,12 @@ SquareConfigure( */ Tk_GeometryRequest(squarePtr->tkwin, 200, 150); - Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr, + Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthObj, &borderWidth); Tk_SetInternalBorder(squarePtr->tkwin, borderWidth); if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); - squarePtr->updatePending = 1; + squarePtr->updatePending = true; } KeepInWindow(squarePtr); return TCL_OK; @@ -386,13 +385,13 @@ SquareObjEventProc( if (eventPtr->type == Expose) { if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); - squarePtr->updatePending = 1; + squarePtr->updatePending = true; } } else if (eventPtr->type == ConfigureNotify) { KeepInWindow(squarePtr); if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); - squarePtr->updatePending = 1; + squarePtr->updatePending = true; } } else if (eventPtr->type == DestroyNotify) { if (squarePtr->tkwin != NULL) { @@ -477,9 +476,8 @@ SquareDisplay( Drawable d; int borderWidth, size, relief; Tk_3DBorder bgBorder, fgBorder; - int doubleBuffer; - squarePtr->updatePending = 0; + squarePtr->updatePending = false; if (!Tk_IsMapped(tkwin)) { return; } @@ -488,8 +486,7 @@ SquareDisplay( * Create a pixmap for double-buffering, if necessary. */ - Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); - if (doubleBuffer) { + if (squarePtr->doubleBuffer) { pm = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), DefaultDepthOfScreen(Tk_Screen(tkwin))); @@ -502,7 +499,7 @@ SquareDisplay( * Redraw the widget's background and border. */ - Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr, + Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthObj, &borderWidth); bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin, squarePtr->bgBorderPtr); @@ -524,7 +521,7 @@ SquareDisplay( * If double-buffered, copy to the screen and release the pixmap. */ - if (doubleBuffer) { + if (squarePtr->doubleBuffer) { XCopyArea(Tk_Display(tkwin), pm, Tk_WindowId(tkwin), squarePtr->gc, 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); @@ -557,7 +554,7 @@ KeepInWindow( int i, bd, relief; int borderWidth, size; - Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr, + Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->xPtr, &squarePtr->x); diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index ac0af8e..a5c6460 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -39,88 +39,26 @@ MODULE_SCOPE const TkStubs tkStubs; * Remove macro that might interfere with the definition below. */ -#undef Tk_MainEx -#undef Tk_FreeXId -#undef Tk_FreeStyleFromObj -#undef Tk_GetStyleFromObj -#undef TkWinGetPlatformId #undef TkPutImage #undef XPutImage -#define TkMacOSXSetUpClippingRgn (void (*)(Drawable))(void *)doNothing -#undef TkMacOSXIsCharacterMissing -#define TkMacOSXIsCharacterMissing (int (*)(Tk_Font, unsigned int))(void *)doNothing - -#if defined(_WIN32) && !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -# define Tk_TranslateWinEvent TkTranslateWinEvent -# define Tk_PointerEvent TkWinPointerEvent -#define TkWinGetPlatformId winGetPlatformId -static int TkWinGetPlatformId(void) { - return 2; -} -#else -# define Tk_TranslateWinEvent 0 -# define Tk_PointerEvent 0 -# define TkWinGetPlatformId 0 -#endif - -#if defined(TK_NO_DEPRECATED) || (TCL_MAJOR_VERSION > 8) -# define TkSetWindowMenuBar 0 -# define TkpDrawHighlightBorder 0 -# define TkpUseWindow 0 -# define TkpSetMainMenubar 0 -# define TkpGetOtherWindow 0 -# define TkpGetSystemDefault 0 -# define TkpMakeContainer 0 -# define TkpMakeWindow 0 -#endif +#if !defined(MAC_OSX_TK) static int doNothing(void) { /* dummy implementation, no need to do anything */ return 0; } - -#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 -#define Tk_MainEx 0 -#define Tk_FreeXId 0 -#define Tk_FreeStyleFromObj 0 -#define Tk_GetStyleFromObj 0 -#define TkWinGetPlatformId 0 -#define Tk_PhotoPutBlock_NoComposite 0 -#define Tk_PhotoPutZoomedBlock_NoComposite 0 -#define Tk_PhotoExpand_Panic 0 -#define Tk_PhotoPutBlock_Panic 0 -#define Tk_PhotoPutZoomedBlock_Panic 0 -#define Tk_PhotoSetSize_Panic 0 -#define Tk_CreateOldPhotoImageFormat 0 -#else -#define Tk_FreeXId ((void (*)(Display *, XID))(void *)doNothing) -#define Tk_FreeStyleFromObj ((void (*)(Tcl_Obj *))(void *)doNothing) -#define Tk_GetStyleFromObj getStyleFromObj -static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj) -{ - return Tk_AllocStyleFromObj(NULL, obj); -} -#endif /* !TK_NO_DEPRECATED */ - -#define TkpCmapStressed_ TkpCmapStressed -#define TkpSync_ TkpSync -#define TkUnixContainerId_ TkUnixContainerId -#define TkUnixDoOneXEvent_ TkUnixDoOneXEvent -#define TkUnixSetMenubar_ TkUnixSetMenubar -#define TkWmCleanup_ TkWmCleanup -#define TkSendCleanup_ TkSendCleanup -#define TkpTestsendCmd_ TkpTestsendCmd -#define TkGenWMConfigureEvent_ TkGenWMConfigureEvent -#define TkGenerateActivateEvents_ TkGenerateActivateEvents -#define TkMacOSXDrawable Tk_MacOSXGetNSWindowForDrawable - -#if !defined(MAC_OSX_TK) # undef TkpWillDrawWidget # undef TkpRedrawWidget +# undef TkpDefineNativeBitmaps +# undef TkpCreateNativeBitmap +# undef TkpGetNativeAppBitmap # define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing) # define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing) +# define TkpDefineNativeBitmaps ((void (*)(void))(void *)doNothing) +# define TkpCreateNativeBitmap ((Pixmap (*)(Display *, const void *))(void *)doNothing) +# define TkpGetNativeAppBitmap ((Pixmap (*)(Display *, const char*, int *, int *))(void *)doNothing) #endif #ifdef _WIN32 @@ -358,13 +296,13 @@ static const TkIntStubs tkIntStubs = { TkpClaimFocus, /* 57 */ TkpDisplayWarning, /* 58 */ TkpGetAppName, /* 59 */ - TkpGetOtherWindow, /* 60 */ + 0, /* 60 */ TkpGetWrapperWindow, /* 61 */ TkpInit, /* 62 */ TkpInitializeMenuBindings, /* 63 */ - TkpMakeContainer, /* 64 */ + 0, /* 64 */ TkpMakeMenuWindow, /* 65 */ - TkpMakeWindow, /* 66 */ + 0, /* 66 */ TkpMenuNotifyToplevelCreate, /* 67 */ TkpOpenDisplay, /* 68 */ TkPointerEvent, /* 69 */ @@ -372,8 +310,8 @@ static const TkIntStubs tkIntStubs = { TkPolygonToPoint, /* 71 */ TkPositionInTree, /* 72 */ TkpRedirectKeyEvent, /* 73 */ - TkpSetMainMenubar, /* 74 */ - TkpUseWindow, /* 75 */ + 0, /* 74 */ + 0, /* 75 */ 0, /* 76 */ TkQueueEventForAllChildren, /* 77 */ TkReadBitmapFile, /* 78 */ @@ -383,7 +321,7 @@ static const TkIntStubs tkIntStubs = { TkSelInit, /* 82 */ TkSelPropProc, /* 83 */ 0, /* 84 */ - TkSetWindowMenuBar, /* 85 */ + 0, /* 85 */ TkStringToKeysym, /* 86 */ TkThickPolyLineToArea, /* 87 */ TkWmAddToColormapWindows, /* 88 */ @@ -409,7 +347,7 @@ static const TkIntStubs tkIntStubs = { TkGetWindowFromObj, /* 108 */ TkpGetString, /* 109 */ TkpGetSubFonts, /* 110 */ - TkpGetSystemDefault, /* 111 */ + 0, /* 111 */ TkpMenuThreadInit, /* 112 */ XClipBox, /* 113 */ XCreateRegion, /* 114 */ @@ -419,43 +357,10 @@ static const TkIntStubs tkIntStubs = { XSetRegion, /* 118 */ XUnionRectWithRegion, /* 119 */ 0, /* 120 */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ - 0, /* 121 */ -#endif /* X11 */ -#if defined(_WIN32) /* WIN */ - 0, /* 121 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -# if TCL_MAJOR_VERSION < 9 - 0, /* 121 */ /* Dummy entry for stubs table backwards compatibility */ -# endif /* TCL_MAJOR_VERSION < 9 */ TkpCreateNativeBitmap, /* 121 */ -#endif /* AQUA */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ - 0, /* 122 */ -#endif /* X11 */ -#if defined(_WIN32) /* WIN */ - 0, /* 122 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -# if TCL_MAJOR_VERSION < 9 - 0, /* 122 */ /* Dummy entry for stubs table backwards compatibility */ -# endif /* TCL_MAJOR_VERSION < 9 */ TkpDefineNativeBitmaps, /* 122 */ -#endif /* AQUA */ 0, /* 123 */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ - 0, /* 124 */ -#endif /* X11 */ -#if defined(_WIN32) /* WIN */ - 0, /* 124 */ -#endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ -# if TCL_MAJOR_VERSION < 9 - 0, /* 124 */ /* Dummy entry for stubs table backwards compatibility */ -# endif /* TCL_MAJOR_VERSION < 9 */ TkpGetNativeAppBitmap, /* 124 */ -#endif /* AQUA */ 0, /* 125 */ 0, /* 126 */ 0, /* 127 */ @@ -466,7 +371,7 @@ static const TkIntStubs tkIntStubs = { 0, /* 132 */ 0, /* 133 */ 0, /* 134 */ - TkpDrawHighlightBorder, /* 135 */ + 0, /* 135 */ TkSetFocusWin, /* 136 */ TkpSetKeycodeAndState, /* 137 */ TkpGetKeySym, /* 138 */ @@ -525,7 +430,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ - TkAlignImageData, /* 0 */ + TkCreateXEventSource, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ TkpGetMS, /* 3 */ @@ -558,11 +463,11 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkWinSetForegroundWindow, /* 30 */ TkWinDialogDebug, /* 31 */ TkWinGetMenuSystemDefault, /* 32 */ - TkWinGetPlatformId, /* 33 */ + TkAlignImageData, /* 33 */ TkWinSetHINSTANCE, /* 34 */ TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ - TkCreateXEventSource, /* 37 */ + 0, /* 37 */ TkpCmapStressed, /* 38 */ TkpSync, /* 39 */ TkUnixContainerId, /* 40 */ @@ -575,18 +480,18 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkpGetCapture, /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ - TkGenerateActivateEvents, /* 0 */ - 0, /* 1 */ - TkGenerateActivateEvents_, /* 2 */ - TkPointerDeadWindow, /* 3 */ - TkpSetCapture, /* 4 */ + 0, /* 0 */ + TkAboutDlg, /* 1 */ + TkGenerateActivateEvents, /* 2 */ + TkpGetMS, /* 3 */ + TkPointerDeadWindow, /* 4 */ TkpSetCursor, /* 5 */ - TkpWmSetState, /* 6 */ - TkAboutDlg, /* 7 */ + TkpScanWindowId, /* 6 */ + TkpWmSetState, /* 7 */ TkMacOSXButtonKeyState, /* 8 */ TkMacOSXClearMenubarActive, /* 9 */ TkMacOSXDispatchMenuEvent, /* 10 */ - 0, /* 11 */ + TkpSetCapture, /* 11 */ TkMacOSXHandleTearoffMenu, /* 12 */ 0, /* 13 */ TkMacOSXDoHLEvent, /* 14 */ @@ -597,7 +502,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { 0, /* 19 */ 0, /* 20 */ TkMacOSXInvalidateWindow, /* 21 */ - TkMacOSXIsCharacterMissing, /* 22 */ + 0, /* 22 */ TkMacOSXMakeRealWindowExist, /* 23 */ TkMacOSXMakeStippleMap, /* 24 */ TkMacOSXMenuClick, /* 25 */ @@ -605,7 +510,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkMacOSXResizable, /* 27 */ TkMacOSXSetHelpMenuItemCount, /* 28 */ TkMacOSXSetScrollbarGrow, /* 29 */ - TkMacOSXSetUpClippingRgn, /* 30 */ + 0, /* 30 */ TkMacOSXSetUpGraphicsPort, /* 31 */ TkMacOSXUpdateClipRgn, /* 32 */ 0, /* 33 */ @@ -628,25 +533,22 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkGenerateButtonEvent, /* 50 */ TkGenWMDestroyEvent, /* 51 */ TkMacOSXSetDrawingEnabled, /* 52 */ - TkpGetMS, /* 53 */ - TkMacOSXDrawable, /* 54 */ - TkpScanWindowId, /* 55 */ #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ - TkpCmapStressed, /* 3 */ - TkpSync, /* 4 */ - TkUnixContainerId, /* 5 */ - TkUnixDoOneXEvent, /* 6 */ - TkUnixSetMenubar, /* 7 */ - TkpScanWindowId, /* 8 */ - TkWmCleanup, /* 9 */ - TkSendCleanup, /* 10 */ + 0, /* 3 */ + 0, /* 4 */ + 0, /* 5 */ + TkpScanWindowId, /* 6 */ + 0, /* 7 */ + 0, /* 8 */ + TkpWmSetState, /* 9 */ + 0, /* 10 */ 0, /* 11 */ - TkpWmSetState, /* 12 */ - TkpTestsendCmd_, /* 13 */ + 0, /* 12 */ + 0, /* 13 */ 0, /* 14 */ 0, /* 15 */ 0, /* 16 */ @@ -671,13 +573,13 @@ static const TkIntPlatStubs tkIntPlatStubs = { 0, /* 35 */ 0, /* 36 */ 0, /* 37 */ - TkpCmapStressed_, /* 38 */ - TkpSync_, /* 39 */ - TkUnixContainerId_, /* 40 */ - TkUnixDoOneXEvent_, /* 41 */ - TkUnixSetMenubar_, /* 42 */ - TkWmCleanup_, /* 43 */ - TkSendCleanup_, /* 44 */ + TkpCmapStressed, /* 38 */ + TkpSync, /* 39 */ + TkUnixContainerId, /* 40 */ + TkUnixDoOneXEvent, /* 41 */ + TkUnixSetMenubar, /* 42 */ + TkWmCleanup, /* 43 */ + TkSendCleanup, /* 44 */ TkpTestsendCmd, /* 45 */ #endif /* X11 */ }; @@ -854,113 +756,113 @@ static const TkIntXlibStubs tkIntXlibStubs = { XGetAtomName, /* 4 */ XKeysymToString, /* 5 */ XCreateColormap, /* 6 */ - XGContextFromGC, /* 7 */ - XKeycodeToKeysym, /* 8 */ - XStringToKeysym, /* 9 */ - XRootWindow, /* 10 */ - XSetErrorHandler, /* 11 */ - XAllocColor, /* 12 */ - XBell, /* 13 */ - XChangeProperty, /* 14 */ - XChangeWindowAttributes, /* 15 */ - XConfigureWindow, /* 16 */ - XCopyArea, /* 17 */ - XCopyPlane, /* 18 */ - XCreateBitmapFromData, /* 19 */ - XDefineCursor, /* 20 */ - XDestroyWindow, /* 21 */ - XDrawArc, /* 22 */ - XDrawLines, /* 23 */ - XDrawRectangle, /* 24 */ - XFillArc, /* 25 */ - XFillPolygon, /* 26 */ - XFillRectangles, /* 27 */ - XFreeColormap, /* 28 */ - XFreeColors, /* 29 */ - XFreeModifiermap, /* 30 */ - XGetGeometry, /* 31 */ - XGetWindowProperty, /* 32 */ - XGrabKeyboard, /* 33 */ - XGrabPointer, /* 34 */ - XKeysymToKeycode, /* 35 */ - XMapWindow, /* 36 */ - XMoveResizeWindow, /* 37 */ - XMoveWindow, /* 38 */ - XQueryPointer, /* 39 */ - XRaiseWindow, /* 40 */ - XRefreshKeyboardMapping, /* 41 */ - XResizeWindow, /* 42 */ - XSelectInput, /* 43 */ - XSendEvent, /* 44 */ - XSetIconName, /* 45 */ - XSetInputFocus, /* 46 */ - XSetSelectionOwner, /* 47 */ - XSetWindowBackground, /* 48 */ - XSetWindowBackgroundPixmap, /* 49 */ - XSetWindowBorder, /* 50 */ - XSetWindowBorderPixmap, /* 51 */ - XSetWindowBorderWidth, /* 52 */ - XSetWindowColormap, /* 53 */ - XUngrabKeyboard, /* 54 */ - XUngrabPointer, /* 55 */ - XUnmapWindow, /* 56 */ - TkPutImage, /* 57 */ - XParseColor, /* 58 */ - XCreateGC, /* 59 */ - XFreeGC, /* 60 */ - XInternAtom, /* 61 */ - XSetBackground, /* 62 */ - XSetForeground, /* 63 */ - XSetClipMask, /* 64 */ - XSetClipOrigin, /* 65 */ - XSetTSOrigin, /* 66 */ - XChangeGC, /* 67 */ - XSetFont, /* 68 */ - XSetArcMode, /* 69 */ - XSetStipple, /* 70 */ - XSetFillRule, /* 71 */ - XSetFillStyle, /* 72 */ - XSetFunction, /* 73 */ - XSetLineAttributes, /* 74 */ - _XInitImageFuncPtrs, /* 75 */ - XCreateIC, /* 76 */ - XGetVisualInfo, /* 77 */ - XSetWMClientMachine, /* 78 */ - XStringListToTextProperty, /* 79 */ - XDrawSegments, /* 80 */ - XForceScreenSaver, /* 81 */ - XDrawLine, /* 82 */ - XFillRectangle, /* 83 */ - XClearWindow, /* 84 */ - XDrawPoint, /* 85 */ - XDrawPoints, /* 86 */ - XWarpPointer, /* 87 */ - XQueryColor, /* 88 */ - XQueryColors, /* 89 */ - XQueryTree, /* 90 */ - XSync, /* 91 */ - XTranslateCoordinates, /* 92 */ - XDeleteProperty, /* 93 */ - XFreeCursor, /* 94 */ - XGetInputFocus, /* 95 */ - XmbLookupString, /* 96 */ - XNextEvent, /* 97 */ - XPutBackEvent, /* 98 */ - XSetCommand, /* 99 */ - XWindowEvent, /* 100 */ - XGetWindowAttributes, /* 101 */ - XGetWMColormapWindows, /* 102 */ - XIconifyWindow, /* 103 */ - XWithdrawWindow, /* 104 */ - XListHosts, /* 105 */ - XSetClipRectangles, /* 106 */ + XCreatePixmapCursor, /* 7 */ + XCreateGlyphCursor, /* 8 */ + XGContextFromGC, /* 9 */ + XListHosts, /* 10 */ + XKeycodeToKeysym, /* 11 */ + XStringToKeysym, /* 12 */ + XRootWindow, /* 13 */ + XSetErrorHandler, /* 14 */ + XIconifyWindow, /* 15 */ + XWithdrawWindow, /* 16 */ + XGetWMColormapWindows, /* 17 */ + XAllocColor, /* 18 */ + XBell, /* 19 */ + XChangeProperty, /* 20 */ + XChangeWindowAttributes, /* 21 */ + XClearWindow, /* 22 */ + XConfigureWindow, /* 23 */ + XCopyArea, /* 24 */ + XCopyPlane, /* 25 */ + XCreateBitmapFromData, /* 26 */ + XDefineCursor, /* 27 */ + XDeleteProperty, /* 28 */ + XDestroyWindow, /* 29 */ + XDrawArc, /* 30 */ + XDrawLines, /* 31 */ + XDrawRectangle, /* 32 */ + XFillArc, /* 33 */ + XFillPolygon, /* 34 */ + XFillRectangles, /* 35 */ + XForceScreenSaver, /* 36 */ + XFreeColormap, /* 37 */ + XFreeColors, /* 38 */ + XFreeCursor, /* 39 */ + XFreeModifiermap, /* 40 */ + XGetGeometry, /* 41 */ + XGetInputFocus, /* 42 */ + XGetWindowProperty, /* 43 */ + XGetWindowAttributes, /* 44 */ + XGrabKeyboard, /* 45 */ + XGrabPointer, /* 46 */ + XKeysymToKeycode, /* 47 */ + XLookupColor, /* 48 */ + XMapWindow, /* 49 */ + XMoveResizeWindow, /* 50 */ + XMoveWindow, /* 51 */ + XNextEvent, /* 52 */ + XPutBackEvent, /* 53 */ + XQueryColors, /* 54 */ + XQueryPointer, /* 55 */ + XQueryTree, /* 56 */ + XRaiseWindow, /* 57 */ + XRefreshKeyboardMapping, /* 58 */ + XResizeWindow, /* 59 */ + XSelectInput, /* 60 */ + XSendEvent, /* 61 */ + XSetCommand, /* 62 */ + XSetIconName, /* 63 */ + XSetInputFocus, /* 64 */ + XSetSelectionOwner, /* 65 */ + XSetWindowBackground, /* 66 */ + XSetWindowBackgroundPixmap, /* 67 */ + XSetWindowBorder, /* 68 */ + XSetWindowBorderPixmap, /* 69 */ + XSetWindowBorderWidth, /* 70 */ + XSetWindowColormap, /* 71 */ + XTranslateCoordinates, /* 72 */ + XUngrabKeyboard, /* 73 */ + XUngrabPointer, /* 74 */ + XUnmapWindow, /* 75 */ + XWindowEvent, /* 76 */ + XDestroyIC, /* 77 */ + XFilterEvent, /* 78 */ + XmbLookupString, /* 79 */ + TkPutImage, /* 80 */ + XSetClipRectangles, /* 81 */ + XParseColor, /* 82 */ + XCreateGC, /* 83 */ + XFreeGC, /* 84 */ + XInternAtom, /* 85 */ + XSetBackground, /* 86 */ + XSetForeground, /* 87 */ + XSetClipMask, /* 88 */ + XSetClipOrigin, /* 89 */ + XSetTSOrigin, /* 90 */ + XChangeGC, /* 91 */ + XSetFont, /* 92 */ + XSetArcMode, /* 93 */ + XSetStipple, /* 94 */ + XSetFillRule, /* 95 */ + XSetFillStyle, /* 96 */ + XSetFunction, /* 97 */ + XSetLineAttributes, /* 98 */ + _XInitImageFuncPtrs, /* 99 */ + XCreateIC, /* 100 */ + XGetVisualInfo, /* 101 */ + XSetWMClientMachine, /* 102 */ + XStringListToTextProperty, /* 103 */ + XDrawLine, /* 104 */ + XWarpPointer, /* 105 */ + XFillRectangle, /* 106 */ XFlush, /* 107 */ XGrabServer, /* 108 */ XUngrabServer, /* 109 */ XFree, /* 110 */ XNoOp, /* 111 */ XSynchronize, /* 112 */ - XLookupColor, /* 113 */ + XSync, /* 113 */ XVisualIDFromVisual, /* 114 */ 0, /* 115 */ 0, /* 116 */ @@ -980,9 +882,9 @@ static const TkIntXlibStubs tkIntXlibStubs = { XFillArcs, /* 130 */ XDrawArcs, /* 131 */ XDrawRectangles, /* 132 */ - 0, /* 133 */ - 0, /* 134 */ - 0, /* 135 */ + XDrawSegments, /* 133 */ + XDrawPoint, /* 134 */ + XDrawPoints, /* 135 */ XReparentWindow, /* 136 */ XPutImage, /* 137 */ XPolygonRegion, /* 138 */ @@ -991,9 +893,9 @@ static const TkIntXlibStubs tkIntXlibStubs = { XSetICValues, /* 141 */ XGetICValues, /* 142 */ XSetICFocus, /* 143 */ - XDestroyIC, /* 144 */ - XCreatePixmapCursor, /* 145 */ - XCreateGlyphCursor, /* 146 */ + 0, /* 144 */ + 0, /* 145 */ + 0, /* 146 */ XFreeFontSet, /* 147 */ XCloseIM, /* 148 */ XRegisterIMInstantiateCallback, /* 149 */ @@ -1017,8 +919,6 @@ static const TkPlatStubs tkPlatStubs = { Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ Tk_HWNDToWindow, /* 3 */ - Tk_PointerEvent, /* 4 */ - Tk_TranslateWinEvent, /* 5 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ 0, /* 0 */ @@ -1026,7 +926,7 @@ static const TkPlatStubs tkPlatStubs = { 0, /* 2 */ 0, /* 3 */ TkMacOSXInitAppleEvents, /* 4 */ - TkGenWMConfigureEvent_, /* 5 */ + 0, /* 5 */ TkMacOSXInvalClipRgns, /* 6 */ 0, /* 7 */ TkMacOSXGetRootControl, /* 8 */ @@ -1128,7 +1028,7 @@ const TkStubs tkStubs = { Tk_FreeOptions, /* 74 */ Tk_FreePixmap, /* 75 */ Tk_FreeTextLayout, /* 76 */ - Tk_FreeXId, /* 77 */ + 0, /* 77 */ Tk_GCForColor, /* 78 */ Tk_GeometryRequest, /* 79 */ Tk_Get3DBorder, /* 80 */ @@ -1169,7 +1069,7 @@ const TkStubs tkStubs = { Tk_HandleEvent, /* 115 */ Tk_IdToWindow, /* 116 */ Tk_ImageChanged, /* 117 */ - Tk_Init, /* 118 */ + 0, /* 118 */ Tk_InternAtom, /* 119 */ Tk_IntersectTextLayout, /* 120 */ Tk_MaintainGeometry, /* 121 */ @@ -1195,13 +1095,13 @@ const TkStubs tkStubs = { Tk_NameToWindow, /* 141 */ Tk_OwnSelection, /* 142 */ Tk_ParseArgv, /* 143 */ - Tk_PhotoPutBlock_NoComposite, /* 144 */ - Tk_PhotoPutZoomedBlock_NoComposite, /* 145 */ + 0, /* 144 */ + 0, /* 145 */ Tk_PhotoGetImage, /* 146 */ Tk_PhotoBlank, /* 147 */ - Tk_PhotoExpand_Panic, /* 148 */ + 0, /* 148 */ Tk_PhotoGetSize, /* 149 */ - Tk_PhotoSetSize_Panic, /* 150 */ + 0, /* 150 */ Tk_PointToChar, /* 151 */ Tk_PostscriptFontName, /* 152 */ Tk_PreserveColormap, /* 153 */ @@ -1210,7 +1110,7 @@ const TkStubs tkStubs = { Tk_ResizeWindow, /* 156 */ Tk_RestackWindow, /* 157 */ Tk_RestrictEvents, /* 158 */ - Tk_SafeInit, /* 159 */ + 0, /* 159 */ Tk_SetAppName, /* 160 */ Tk_SetBackgroundFromBorder, /* 161 */ Tk_SetClass, /* 162 */ @@ -1263,11 +1163,11 @@ const TkStubs tkStubs = { Tk_GetReliefFromObj, /* 209 */ Tk_GetScrollInfoObj, /* 210 */ Tk_InitOptions, /* 211 */ - Tk_MainEx, /* 212 */ + 0, /* 212 */ Tk_RestoreSavedOptions, /* 213 */ Tk_SetOptions, /* 214 */ Tk_InitConsoleChannels, /* 215 */ - Tk_CreateConsoleWindow, /* 216 */ + 0, /* 216 */ Tk_CreateSmoothMethod, /* 217 */ 0, /* 218 */ 0, /* 219 */ @@ -1297,8 +1197,8 @@ const TkStubs tkStubs = { Tk_SetInternalBorderEx, /* 243 */ Tk_SetMinimumRequestSize, /* 244 */ Tk_SetCaretPos, /* 245 */ - Tk_PhotoPutBlock_Panic, /* 246 */ - Tk_PhotoPutZoomedBlock_Panic, /* 247 */ + 0, /* 246 */ + 0, /* 247 */ Tk_CollapseMotionEvents, /* 248 */ Tk_RegisterStyleEngine, /* 249 */ Tk_GetStyleEngine, /* 250 */ @@ -1309,8 +1209,8 @@ const TkStubs tkStubs = { Tk_FreeStyle, /* 255 */ Tk_NameOfStyle, /* 256 */ Tk_AllocStyleFromObj, /* 257 */ - Tk_GetStyleFromObj, /* 258 */ - Tk_FreeStyleFromObj, /* 259 */ + 0, /* 258 */ + 0, /* 259 */ Tk_GetStyledElement, /* 260 */ Tk_GetElementSize, /* 261 */ Tk_GetElementBox, /* 262 */ @@ -1323,8 +1223,8 @@ const TkStubs tkStubs = { Tk_GetUserInactiveTime, /* 269 */ Tk_ResetUserInactiveTime, /* 270 */ Tk_Interp, /* 271 */ - Tk_CreateOldImageType, /* 272 */ - Tk_CreateOldPhotoImageFormat, /* 273 */ + 0, /* 272 */ + 0, /* 273 */ Tk_AlwaysShowSelection, /* 274 */ Tk_GetButtonMask, /* 275 */ Tk_GetDoublePixelsFromObj, /* 276 */ diff --git a/generic/tkStyle.c b/generic/tkStyle.c index b243674..ea39760 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -1358,7 +1358,7 @@ Tk_GetStyle( if (entryPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "style \"%s\" doesn't exist", name)); + "style \"%s\" does not exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "STYLE", name, (char *)NULL); } return NULL; diff --git a/generic/tkTest.c b/generic/tkTest.c index f0ee30f..71b1791 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -208,7 +208,7 @@ Tktest_Init( { static int initialized = 0; - if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { return TCL_ERROR; } if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { @@ -273,14 +273,6 @@ Tktest_Init( } /* - * Enable testing of legacy interfaces. - */ - - if (TkOldTestInit(interp) != TCL_OK) { - return TCL_ERROR; - } - - /* * And finally add any platform specific test commands. */ diff --git a/generic/tkText.c b/generic/tkText.c index f792c9c..b3406a1 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -27,16 +27,6 @@ #include "tkWinInt.h" #endif -/* - * For compatibility with Tk 4.0 through 8.4.x, we allow tabs to be - * mis-specified with non-increasing values. These are converted into tabs - * which are the equivalent of at least a character width apart. - */ - -#if (TK_MAJOR_VERSION < 9) -#define _TK_ALLOW_DECREASING_TABS -#endif - #include "tkText.h" /* @@ -130,7 +120,7 @@ static const Tk_OptionSpec optionSpecs[] = { "BlockCursor", DEF_TEXT_BLOCK_CURSOR, TCL_INDEX_NONE, offsetof(TkText, insertCursorType), 0, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_TEXT_BORDER_WIDTH, TCL_INDEX_NONE, offsetof(TkText, borderWidth), + DEF_TEXT_BORDER_WIDTH, offsetof(TkText, borderWidthObj), offsetof(TkText, borderWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_TEXT_CURSOR, TCL_INDEX_NONE, offsetof(TkText, cursor), @@ -150,7 +140,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_TEXT_FG, TCL_INDEX_NONE, offsetof(TkText, fgColor), 0, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_TEXT_HEIGHT, TCL_INDEX_NONE, offsetof(TkText, height), 0, 0, 0}, + DEF_TEXT_HEIGHT, offsetof(TkText, heightObj), offsetof(TkText, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_TEXT_HIGHLIGHT_BG, TCL_INDEX_NONE, offsetof(TkText, highlightBgColorPtr), @@ -159,7 +149,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_TEXT_HIGHLIGHT, TCL_INDEX_NONE, offsetof(TkText, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, + "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, offsetof(TkText, highlightWidthObj), offsetof(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_BORDER, "-inactiveselectbackground","inactiveSelectBackground", "Foreground", @@ -171,7 +161,7 @@ static const Tk_OptionSpec optionSpecs[] = { TCL_INDEX_NONE, offsetof(TkText, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", - "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, TCL_INDEX_NONE, + "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, offsetof(TkText, insertBorderWidthObj), offsetof(TkText, insertBorderWidth), 0, DEF_TEXT_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", @@ -185,16 +175,16 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_TEXT_INSERT_UNFOCUSSED, TCL_INDEX_NONE, offsetof(TkText, insertUnfocussed), TK_OPTION_ENUM_VAR, insertUnfocussedStrings, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", - DEF_TEXT_INSERT_WIDTH, TCL_INDEX_NONE, offsetof(TkText, insertWidth), + DEF_TEXT_INSERT_WIDTH, offsetof(TkText, insertWidthObj), offsetof(TkText, insertWidth), 0, 0, 0}, {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo", DEF_TEXT_MAX_UNDO, TCL_INDEX_NONE, offsetof(TkText, maxUndo), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_TEXT_PADX, TCL_INDEX_NONE, offsetof(TkText, padX), 0, 0, + DEF_TEXT_PADX, offsetof(TkText, padXObj), offsetof(TkText, padX), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_TEXT_PADY, TCL_INDEX_NONE, offsetof(TkText, padY), 0, 0, 0}, + DEF_TEXT_PADY, offsetof(TkText, padYObj), offsetof(TkText, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_TEXT_RELIEF, TCL_INDEX_NONE, offsetof(TkText, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", @@ -202,8 +192,7 @@ static const Tk_OptionSpec optionSpecs[] = { 0, DEF_TEXT_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_TEXT_SELECT_BD_COLOR, - offsetof(TkText, selBorderWidthPtr), - offsetof(TkText, selBorderWidth), + offsetof(TkText, selBorderWidthObj), offsetof(TkText, selBorderWidth), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_TEXT_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(TkText, selFgColorPtr), @@ -211,14 +200,14 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", DEF_TEXT_SET_GRID, TCL_INDEX_NONE, offsetof(TkText, setGrid), 0, 0, 0}, {TK_OPTION_PIXELS, "-spacing1", "spacing1", "Spacing", - DEF_TEXT_SPACING1, TCL_INDEX_NONE, offsetof(TkText, spacing1), - 0, 0 , TK_TEXT_LINE_GEOMETRY }, + DEF_TEXT_SPACING1, offsetof(TkText, spacing1Obj), offsetof(TkText, spacing1), + 0, 0, TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_PIXELS, "-spacing2", "spacing2", "Spacing", - DEF_TEXT_SPACING2, TCL_INDEX_NONE, offsetof(TkText, spacing2), - 0, 0 , TK_TEXT_LINE_GEOMETRY }, + DEF_TEXT_SPACING2, offsetof(TkText, spacing2Obj), offsetof(TkText, spacing2), + 0, 0, TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_PIXELS, "-spacing3", "spacing3", "Spacing", - DEF_TEXT_SPACING3, TCL_INDEX_NONE, offsetof(TkText, spacing3), - 0, 0 , TK_TEXT_LINE_GEOMETRY }, + DEF_TEXT_SPACING3, offsetof(TkText, spacing3Obj), offsetof(TkText, spacing3), + 0, 0, TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_CUSTOM, "-startline", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkText, start), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, @@ -232,7 +221,7 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_TEXT_TABSTYLE, TCL_INDEX_NONE, offsetof(TkText, tabStyle), TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_TEXT_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(TkText, takeFocus), + DEF_TEXT_TAKE_FOCUS, offsetof(TkText, takeFocusObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-undo", "undo", "Undo", DEF_TEXT_UNDO, TCL_INDEX_NONE, offsetof(TkText, undo), @@ -244,10 +233,10 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_TEXT_WRAP, TCL_INDEX_NONE, offsetof(TkText, wrapMode), TK_OPTION_ENUM_VAR, tkTextWrapStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - DEF_TEXT_XSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, xScrollCmd), + DEF_TEXT_XSCROLL_COMMAND, offsetof(TkText, xScrollCmdObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", - DEF_TEXT_YSCROLL_COMMAND, TCL_INDEX_NONE, offsetof(TkText, yScrollCmd), + DEF_TEXT_YSCROLL_COMMAND, offsetof(TkText, yScrollCmdObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0} }; @@ -614,7 +603,7 @@ CreateWidget( textPtr->selBorder = NULL; textPtr->inactiveSelBorder = NULL; textPtr->selBorderWidth = 0; - textPtr->selBorderWidthPtr = NULL; + textPtr->selBorderWidthObj = NULL; textPtr->selFgColorPtr = NULL; /* @@ -623,9 +612,6 @@ CreateWidget( */ textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL); - textPtr->selTagPtr->reliefString = (char *) - ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF)); - strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF); Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief); textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &startIndex); textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex); @@ -1461,7 +1447,7 @@ TextWidgetObjCmd( insertLength = 0; for (j = 4; j < objc; j += 2) { - insertLength += TkGetCharLength(objv[j]); + insertLength += Tcl_GetCharLength(objv[j]); } /* @@ -1475,8 +1461,8 @@ TextWidgetObjCmd( deleteInsertOffset = insertLength; } - indexFromLine = TkBTreeLinesTo(textPtr, indexFromPtr->linePtr); - indexFromByteOffset = indexFromPtr->byteIndex; + indexFromLine = TkBTreeLinesTo(textPtr, indexFromPtr->linePtr); + indexFromByteOffset = indexFromPtr->byteIndex; result = TextReplaceCmd(textPtr, interp, indexFromPtr, indexToPtr, objc, objv, 0); @@ -1486,11 +1472,11 @@ TextWidgetObjCmd( * Move the insertion position to the correct place. */ - TkTextIndex indexTmp; + TkTextIndex indexTmp; - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, indexFromLine, - indexFromByteOffset, &indexTmp); - TkTextIndexForwChars(NULL, &indexTmp, + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, indexFromLine, + indexFromByteOffset, &indexTmp); + TkTextIndexForwChars(NULL, &indexTmp, deleteInsertOffset, &index, COUNT_INDICES); TkBTreeUnlinkSegment(textPtr->insertMarkPtr, textPtr->insertMarkPtr->body.mark.linePtr); @@ -2219,12 +2205,27 @@ ConfigureText( if (textPtr->spacing1 < 0) { textPtr->spacing1 = 0; + if (textPtr->spacing1Obj) { + Tcl_DecrRefCount(textPtr->spacing1Obj); + } + textPtr->spacing1Obj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(textPtr->spacing1Obj); } if (textPtr->spacing2 < 0) { textPtr->spacing2 = 0; + if (textPtr->spacing2Obj) { + Tcl_DecrRefCount(textPtr->spacing2Obj); + } + textPtr->spacing2Obj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(textPtr->spacing2Obj); } if (textPtr->spacing3 < 0) { textPtr->spacing3 = 0; + if (textPtr->spacing3Obj) { + Tcl_DecrRefCount(textPtr->spacing3Obj); + } + textPtr->spacing3Obj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(textPtr->spacing3Obj); } /* @@ -2236,7 +2237,7 @@ ConfigureText( textPtr->tabArrayPtr = NULL; } if (textPtr->tabOptionPtr != NULL) { - textPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr, + textPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr->tkwin, textPtr->tabOptionPtr); if (textPtr->tabArrayPtr == NULL) { Tcl_AddErrorInfo(interp,"\n (while processing -tabs option)"); @@ -2257,8 +2258,8 @@ ConfigureText( } else { textPtr->selTagPtr->selBorder = textPtr->selBorder; } - if (textPtr->selTagPtr->borderWidthPtr != textPtr->selBorderWidthPtr) { - textPtr->selTagPtr->borderWidthPtr = textPtr->selBorderWidthPtr; + if (textPtr->selTagPtr->borderWidthObj != textPtr->selBorderWidthObj) { + textPtr->selTagPtr->borderWidthObj = textPtr->selBorderWidthObj; textPtr->selTagPtr->borderWidth = textPtr->selBorderWidth; } if (textPtr->selTagPtr->selFgColor == NULL) { @@ -2489,7 +2490,7 @@ TextEventProc( } } else if (eventPtr->type == DestroyNotify) { /* - * NOTE: we must zero out selBorder, selBorderWidthPtr and + * NOTE: we must zero out selBorder, selBorderWidthObj and * selFgColorPtr: they are duplicates of information in the "sel" tag, * which will be freed up when we delete all tags. Hence we don't want * the automatic config options freeing process to delete them as @@ -2497,7 +2498,7 @@ TextEventProc( */ textPtr->selBorder = NULL; - textPtr->selBorderWidthPtr = NULL; + textPtr->selBorderWidthObj = NULL; textPtr->selBorderWidth = 0; textPtr->selFgColorPtr = NULL; if (textPtr->setGrid) { @@ -2733,9 +2734,9 @@ InsertChars( */ for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { - if (TkBTreeCharTagged(indexPtr, tPtr->selTagPtr)) { - TkTextSelectionEvent(tPtr); - } + if (TkBTreeCharTagged(indexPtr, tPtr->selTagPtr)) { + TkTextSelectionEvent(tPtr); + } tPtr->abortSelections = 1; } @@ -2873,9 +2874,9 @@ TextPushUndoAction( Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, Tcl_NewStringObj(rMarkName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, - Tcl_NewStringObj("left", 4)); + Tcl_NewStringObj("left", 4)); Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, - Tcl_NewStringObj("right", 5)); + Tcl_NewStringObj("right", 5)); /* * Note: we don't wish to use textPtr->widgetCmd in these callbacks @@ -3200,7 +3201,7 @@ DeleteIndexRange( for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { - TkBTreeTag(&index1, &index2, (TkTextTag *)Tcl_GetHashValue(hPtr), 0); + TkBTreeTag(&index1, &index2, (TkTextTag *)Tcl_GetHashValue(hPtr), 0); } /* @@ -3210,7 +3211,7 @@ DeleteIndexRange( for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { - if (TkBTreeTag(&index1, &index2, tPtr->selTagPtr, 0)) { + if (TkBTreeTag(&index1, &index2, tPtr->selTagPtr, 0)) { /* * Send an event that the selection changed. This is * equivalent to: @@ -3219,7 +3220,7 @@ DeleteIndexRange( TkTextSelectionEvent(textPtr); tPtr->abortSelections = 1; - } + } } /* @@ -4093,12 +4094,12 @@ TextSearchIndexInLine( if (searchSpecPtr->exact) { index += leftToScan; } else { - index += TkNumUtfChars(segPtr->body.chars, leftToScan); + index += Tcl_NumUtfChars(segPtr->body.chars, leftToScan); } } else if (searchSpecPtr->exact) { index += segPtr->size; } else { - index += TkNumUtfChars(segPtr->body.chars, -1); + index += Tcl_NumUtfChars(segPtr->body.chars, -1); } } leftToScan -= segPtr->size; @@ -4223,7 +4224,7 @@ TextSearchAddNextLine( Tcl_GetString(theLine); *lenPtr = theLine->length; } else { - *lenPtr = TkGetCharLength(theLine); + *lenPtr = Tcl_GetCharLength(theLine); } } return linePtr; @@ -4293,7 +4294,7 @@ TextSearchFoundMatch( if (searchSpecPtr->exact) { const char *startOfLine = Tcl_GetString(theLine); - numChars = TkNumUtfChars(startOfLine + matchOffset, matchLength); + numChars = Tcl_NumUtfChars(startOfLine + matchOffset, matchLength); } else { numChars = matchLength; } @@ -4352,13 +4353,13 @@ TextSearchFoundMatch( if (searchSpecPtr->exact) { matchOffset += segPtr->size; } else { - matchOffset += TkNumUtfChars(segPtr->body.chars, -1); + matchOffset += Tcl_NumUtfChars(segPtr->body.chars, -1); } } else { if (searchSpecPtr->exact) { leftToScan -= (int)segPtr->size; } else { - leftToScan -= TkNumUtfChars(segPtr->body.chars, -1); + leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1); } } curIndex.byteIndex += segPtr->size; @@ -4443,13 +4444,13 @@ TextSearchFoundMatch( continue; } else if (!searchSpecPtr->searchElide && TkTextIsElided(textPtr, &curIndex, NULL)) { - numChars += TkNumUtfChars(segPtr->body.chars, -1); + numChars += Tcl_NumUtfChars(segPtr->body.chars, -1); continue; } if (searchSpecPtr->exact) { leftToScan -= segPtr->size; } else { - leftToScan -= TkNumUtfChars(segPtr->body.chars, -1); + leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1); } } @@ -4493,7 +4494,7 @@ TextSearchFoundMatch( TkTextTabArray * TkTextGetTabs( Tcl_Interp *interp, /* Used for error reporting. */ - const TkText *textPtr, /* Information about the text widget. */ + Tk_Window tkwin, /* Information about the window. */ Tcl_Obj *stringPtr) /* Description of the tab stops. See the text * manual entry for details. */ { @@ -4544,7 +4545,7 @@ TkTextGetTabs( * downwards, to find the right integer pixel position. */ - if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[i], + if (Tk_GetPixelsFromObj(interp, tkwin, objv[i], &tabPtr->location) != TCL_OK) { goto error; } @@ -4558,7 +4559,7 @@ TkTextGetTabs( } prevStop = lastStop; - if (Tk_GetDoublePixelsFromObj(interp, textPtr->tkwin, objv[i], + if (Tk_GetDoublePixelsFromObj(interp, tkwin, objv[i], &lastStop) != TCL_OK) { goto error; } @@ -4569,27 +4570,12 @@ TkTextGetTabs( * illegal. */ -#ifdef _TK_ALLOW_DECREASING_TABS - /* - * Force the tab to be a typical character width to the right of - * the previous one, and update the 'lastStop' with the changed - * position. - */ - - if (textPtr->charWidth > 0) { - tabPtr->location = (tabPtr-1)->location + textPtr->charWidth; - } else { - tabPtr->location = (tabPtr-1)->location + 8; - } - lastStop = tabPtr->location; -#else Tcl_SetObjResult(interp, Tcl_ObjPrintf( "tabs must be monotonically increasing, but \"%s\" is " "smaller than or equal to the previous tab", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "TAB_STOP", (char *)NULL); goto error; -#endif /* _TK_ALLOW_DECREASING_TABS */ } tabArrayPtr->numTabs++; @@ -4608,7 +4594,7 @@ TkTextGetTabs( * There may be a more efficient way of getting this. */ - TkUtfToUniChar(Tcl_GetString(objv[i+1]), &ch); + Tcl_UtfToUniChar(Tcl_GetString(objv[i+1]), &ch); if (!Tcl_UniCharIsAlpha(ch)) { continue; } @@ -5149,13 +5135,13 @@ TextEditUndo( */ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", - Tk_PathName(textPtr->tkwin)); + Tk_PathName(textPtr->tkwin)); Tcl_IncrRefCount(cmdObj); code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL); if (code != TCL_OK) { - Tcl_AddErrorInfo(textPtr->interp, - "\n (on undoing)"); - Tcl_BackgroundException(textPtr->interp, code); + Tcl_AddErrorInfo(textPtr->interp, + "\n (on undoing)"); + Tcl_BackgroundException(textPtr->interp, code); } Tcl_DecrRefCount(cmdObj); @@ -5215,13 +5201,13 @@ TextEditRedo( */ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", - Tk_PathName(textPtr->tkwin)); + Tk_PathName(textPtr->tkwin)); Tcl_IncrRefCount(cmdObj); code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL); if (code != TCL_OK) { - Tcl_AddErrorInfo(textPtr->interp, - "\n (on undoing)"); - Tcl_BackgroundException(textPtr->interp, code); + Tcl_AddErrorInfo(textPtr->interp, + "\n (on undoing)"); + Tcl_BackgroundException(textPtr->interp, code); } Tcl_DecrRefCount(cmdObj); @@ -6161,13 +6147,13 @@ SearchCore( break; } else { alreadySearchOffset -= (matchLength ? matchLength : 1); - if (alreadySearchOffset < 0) { - break; - } + if (alreadySearchOffset < 0) { + break; + } } } else { - firstOffset = matchLength ? p - startOfLine + matchLength - : p - startOfLine + (Tcl_Size)1; + firstOffset = matchLength ? p - startOfLine + matchLength + : p - startOfLine + (Tcl_Size)1; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find @@ -6195,7 +6181,7 @@ SearchCore( } } else { firstOffset = p - startOfLine + - TkUtfToUniChar(startOfLine+matchOffset,&ch); + Tcl_UtfToUniChar(startOfLine+matchOffset,&ch); } } } while (searchSpecPtr->all); diff --git a/generic/tkText.h b/generic/tkText.h index ca7aa4c..506f7e8 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -116,10 +116,13 @@ typedef struct TkTextEmbWindow { * window. */ char *create; /* Script to create window on-demand. NULL * means no such script. Malloc-ed. */ + Tcl_Obj *padXObj, *padYObj; /* Padding to leave around each side of window. */ +#if TCL_MAJOR_VERSION > 8 TkAlignMode align; /* How to align window in vertical space. See * definitions in tkTextWind.c. */ - int padX, padY; /* Padding to leave around each side of - * window, in pixels. */ +#else + int align; +#endif int stretch; /* Should window stretch to fill vertical * space of line (except for pady)? 0 or 1. */ Tk_OptionTable optionTable; /* Token representing the configuration @@ -127,6 +130,10 @@ typedef struct TkTextEmbWindow { TkTextEmbWindowClient *clients; /* Linked list of peer-widget specific * information for this embedded window. */ +#if defined(BUILD_tk) + int padX, padY; /* Padding to leave around each side of + * window, in pixels. */ +#endif } TkTextEmbWindow; /* @@ -148,14 +155,22 @@ typedef struct TkTextEmbImage { * the image. */ Tk_Image image; /* Image for this segment. NULL means that the * image hasn't been created yet. */ + Tcl_Obj *padXObj, *padYObj; /* Padding to leave around each side of image, + * in pixels. */ +#if TCL_MAJOR_VERSION > 8 TkAlignMode align; /* How to align image in vertical space. See * definitions in tkTextImage.c. */ - int padX, padY; /* Padding to leave around each side of image, - * in pixels. */ +#else + int align; +#endif int chunkCount; /* Number of display chunks that refer to this * image. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ +#if defined(BUILD_tk) + int padX, padY; /* Padding to leave around each side of + * window, in pixels. */ +#endif } TkTextEmbImage; /* @@ -343,10 +358,11 @@ typedef struct TkTextTag { Tk_3DBorder border; /* Used for drawing background. NULL means no * value specified here. */ - int borderWidth; /* Width of 3-D border for background. */ - Tcl_Obj *borderWidthPtr; /* Width of 3-D border for background. */ + Tcl_Obj *borderWidthObj; /* Width of 3-D border for background. */ +#if TK_MAJOR_VERSION < 9 char *reliefString; /* -relief option string (malloc-ed). NULL * means option not specified. */ +#endif int relief; /* 3-D relief for background. */ Pixmap bgStipple; /* Stipple bitmap for background. None means * no value specified here. */ @@ -357,35 +373,57 @@ typedef struct TkTextTag { Pixmap fgStipple; /* Stipple bitmap for text and other * foreground stuff. None means no value * specified here.*/ +#if TK_MAJOR_VERSION < 9 char *justifyString; /* -justify option string (malloc-ed). NULL * means option not specified. */ +#endif Tk_Justify justify; /* How to justify text: TK_JUSTIFY_CENTER, - * TK_JUSTIFY_LEFT, or TK_JUSTIFY_RIGHT. - * Only valid if justifyString is non-NULL. */ + * TK_JUSTIFY_LEFT, or TK_JUSTIFY_RIGHT. */ +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *lMargin1Obj; /* -lmargin1 option object. NULL + * means option not specified. */ +#else char *lMargin1String; /* -lmargin1 option string (malloc-ed). NULL * means option not specified. */ +#endif int lMargin1; /* Left margin for first display line of each * text line, in pixels. INT_MIN means option not specified. */ +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *lMargin2Obj; /* -lmargin2 option object. NULL + * means option not specified. */ +#else char *lMargin2String; /* -lmargin2 option string (malloc-ed). NULL * means option not specified. */ +#endif int lMargin2; /* Left margin for second and later display lines * of each text line, in pixels. INT_MIN means option not specified. */ Tk_3DBorder lMarginColor; /* Used for drawing background in left margins. * This is used for both lmargin1 and lmargin2. * NULL means no value specified here. */ +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *offsetObj; /* -offset option. NULL means option not specified. */ +#else char *offsetString; /* -offset option string (malloc-ed). NULL * means option not specified. */ +#endif int offset; /* Vertical offset of text's baseline from * baseline of line. Used for superscripts and * subscripts. INT_MIN means option not specified. */ +#if TK_MAJOR_VERSION < 9 char *overstrikeString; /* -overstrike option string (malloc-ed). NULL * means option not specified. */ +#endif int overstrike; /* > 0 means draw horizontal line through * middle of text. -1 means not specified. */ XColor *overstrikeColor; /* Color for the overstrike. NULL means same * color as foreground. */ +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *rMarginObj; /* -rmargin option object. NULL + * means option not specified. */ +#else char *rMarginString; /* -rmargin option string (malloc-ed). NULL * means option not specified. */ +#endif int rMargin; /* Right margin for text, in pixels. INT_MIN means option not specified. */ Tk_3DBorder rMarginColor; /* Used for drawing background in right margin. * NULL means no value specified here. */ @@ -393,27 +431,41 @@ typedef struct TkTextTag { * NULL means no value specified here. */ XColor *selFgColor; /* Foreground color for selected text. NULL means * no value specified here. */ +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *spacing1Obj; /* -spacing1 option object. NULL + * means option not specified. */ +#else char *spacing1String; /* -spacing1 option string (malloc-ed). NULL * means option not specified. */ - int spacing1; /* Extra spacing above first display line for - * text line. INT_MIN means option not specified. */ +#endif +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *spacing2Obj; /* -spacing2 option object. NULL + * means option not specified. */ +#else char *spacing2String; /* -spacing2 option string (malloc-ed). NULL * means option not specified. */ - int spacing2; /* Extra spacing between display lines for the - * same text line. INT_MIN means option not specified. */ +#endif +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *spacing3Obj; /* -spacing3 option object. NULL + * means option not specified. */ +#else char *spacing3String; /* -spacing3 option string (malloc-ed). NULL * means option not specified. */ - int spacing3; /* Extra spacing below last display line for - * text line. INT_MIN means option not specified. */ +#endif Tcl_Obj *tabStringPtr; /* -tabs option string. NULL means option not * specified. */ struct TkTextTabArray *tabArrayPtr; /* Info about tabs for tag (malloc-ed) or * NULL. Corresponds to tabString. */ - TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR, TK_TEXT_TABSTYLE_WORDPROCESSOR - * or TK_TEXT_TABSTYLE_NONE. (if not specified)*/ +#if TK_MAJOR_VERSION > 8 + TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR + * or TK_TEXT_TABSTYLE_NULL (if not specified). */ +#else + int tabStyle; /* One of TABULAR or WORDPROCESSOR or NONE (if + * not specified). */ char *underlineString; /* -underline option string (malloc-ed). NULL * means option not specified. */ +#endif int underline; /* > 0 means draw underline underneath * text. -1 means not specified. */ XColor *underlineColor; /* Color for the underline. NULL means same @@ -422,8 +474,10 @@ typedef struct TkTextTag { * Must be TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_WORD, * TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_NULL to * use wrapmode for whole widget. */ +#if TK_MAJOR_VERSION < 9 char *elideString; /* -elide option string (malloc-ed). NULL * means option not specified. */ +#endif int elide; /* > 0 means that data under this tag * should not be displayed. -1 means not specified. */ int affectsDisplay; /* Non-zero means that this tag affects the @@ -435,6 +489,15 @@ typedef struct TkTextTag { * size with which information is displayed on * the screen (so need to recalculate line * dimensions if tag changes). */ +#ifdef BUILD_tk + int spacing1; /* Extra spacing above first display line for + * text line. INT_MIN means option not specified. */ + int spacing2; /* Extra spacing between display lines for the + * same text line. INT_MIN means option not specified. */ + int spacing3; /* Extra spacing below last display line for + * text line. INT_MIN means option not specified. */ + int borderWidth; /* Width of 3-D border for background. */ +#endif } TkTextTag; #define TK_TAG_AFFECTS_DISPLAY 0x1 @@ -663,12 +726,12 @@ typedef struct TkText { Tk_3DBorder border; /* Structure used to draw 3-D border and * default background. */ - int borderWidth; /* Width of 3-D border to draw around entire + Tcl_Obj *borderWidthObj; /* Width of 3-D border to draw around entire * widget. */ - int padX, padY; /* Padding between text and window border. */ + Tcl_Obj *padXObj, *padYObj; /* Padding between text and window border. */ int relief; /* 3-d effect for border around entire widget: * TK_RELIEF_RAISED etc. */ - int highlightWidth; /* Width in pixels of highlight to draw around + Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw around * widget when it has the focus. <= 0 means * don't draw a highlight. */ XColor *highlightBgColorPtr; @@ -682,11 +745,11 @@ typedef struct TkText { * font. */ int charHeight; /* Height of average character in default * font, including line spacing. */ - int spacing1; /* Default extra spacing above first display + Tcl_Obj *spacing1Obj; /* Default extra spacing above first display * line for each text line. */ - int spacing2; /* Default extra spacing between display lines + Tcl_Obj *spacing2Obj; /* Default extra spacing between display lines * for the same text line. */ - int spacing3; /* Default extra spacing below last display + Tcl_Obj *spacing3Obj; /* Default extra spacing below last display * line for each text line. */ Tcl_Obj *tabOptionPtr; /* Value of -tabs option string. */ TkTextTabArray *tabArrayPtr; @@ -703,7 +766,7 @@ typedef struct TkText { * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD, or TEXT_WRAPMODE_NULL to * use wrapmode for whole widget. */ - int width, height; /* Desired dimensions for window, measured in + int width; Tcl_Obj *heightObj; /* Desired dimensions for window, measured in * characters. */ int setGrid; /* Non-zero means pass gridding information to * window manager. */ @@ -727,8 +790,7 @@ typedef struct TkText { /* Border and background for selected * characters when they don't have the * focus. */ - int selBorderWidth; /* Width of border around selection. */ - Tcl_Obj *selBorderWidthPtr; /* Width of border around selection. */ + Tcl_Obj *selBorderWidthObj; /* Width of border around selection. */ XColor *selFgColorPtr; /* Foreground color for selected text. This is * a copy of information in *selTagPtr, so it * shouldn't be explicitly freed. */ @@ -747,8 +809,8 @@ typedef struct TkText { /* Points to segment for "insert" mark. */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. */ - int insertWidth; /* Total width of insert cursor. */ - int insertBorderWidth; /* Width of 3-D border around insert cursor */ + Tcl_Obj *insertWidthObj; /* Total width of insert cursor. */ + Tcl_Obj *insertBorderWidthObj; /* Width of 3-D border around insert cursor */ TkTextInsertUnfocussed insertUnfocussed; /* How to display the insert cursor when the * text widget does not have the focus. */ @@ -779,13 +841,19 @@ typedef struct TkText { * Miscellaneous additional information: */ - char *takeFocus; /* Value of -takeFocus option; not used in the +#if TK_MAJOR_VERSION > 8 + Tcl_Obj *takeFocusObj; /* Value of -takeFocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ - char *xScrollCmd; /* Prefix of command to issue to update + Tcl_Obj *xScrollCmdObj; /* Prefix of command to issue to update * horizontal scrollbar when view changes. */ - char *yScrollCmd; /* Prefix of command to issue to update + Tcl_Obj *yScrollCmdObj; /* Prefix of command to issue to update * vertical scrollbar when view changes. */ +#else + char *takeFocus; + char *xScrollCmd; + char *yScrollCmd; +#endif int flags; /* Miscellaneous flags; see below for * definitions. */ Tk_OptionTable optionTable; /* Token representing the configuration @@ -809,6 +877,16 @@ typedef struct TkText { * inserted automatically. */ Tcl_Obj *afterSyncCmd; /* Command to be executed when lines are up to * date */ +#ifdef BUILD_tk + int padX, padY; + int selBorderWidth; + int highlightWidth; + int borderWidth; + int spacing1, spacing2, spacing3; + int height; + int insertBorderWidth; + int insertWidth; +#endif } TkText; /* @@ -1084,7 +1162,7 @@ MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp, MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *objPtr); MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp, - const TkText *textPtr, Tcl_Obj *stringPtr); + Tk_Window tkwin, Tcl_Obj *stringPtr); MODULE_SCOPE void TkTextFindDisplayLineEnd(TkText *textPtr, TkTextIndex *indexPtr, int end, int *xOffset); MODULE_SCOPE void TkTextIndexBackChars(const TkText *textPtr, diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a432a24..42ff3f2 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -24,7 +24,7 @@ #include "tkMacOSXInt.h" #endif -#define OK_TO_LOG (!TkpWillDrawWidget(textPtr->tkwin)) +#define OK_TO_LOG 1 /* * "Calculations of line pixel heights and the size of the vertical @@ -867,8 +867,8 @@ GetStyle( styleValues.border = border; borderPrio = tagPtr->priority; } - if ((tagPtr->borderWidthPtr != NULL) - && (Tcl_GetString(tagPtr->borderWidthPtr)[0] != '\0') + if ((tagPtr->borderWidthObj != NULL) + && (Tcl_GetString(tagPtr->borderWidthObj)[0] != '\0') && (tagPtr->priority > borderWidthPrio)) { styleValues.borderWidth = tagPtr->borderWidth; borderWidthPrio = tagPtr->priority; @@ -4649,7 +4649,7 @@ DisplayText( doScrollbars: if (textPtr->flags & UPDATE_SCROLLBARS) { textPtr->flags &= ~UPDATE_SCROLLBARS; - if (textPtr->yScrollCmd != NULL) { + if (textPtr->yScrollCmdObj != NULL) { GetYView(textPtr->interp, textPtr, 1); } @@ -4665,7 +4665,7 @@ DisplayText( * Update the horizontal scrollbar, if any. */ - if (textPtr->xScrollCmd != NULL) { + if (textPtr->xScrollCmdObj != NULL) { GetXView(textPtr->interp, textPtr, 1); } } @@ -5256,8 +5256,13 @@ TkTextRelayoutWindow( * it. */ - if (textPtr->highlightWidth < 0) { - textPtr->highlightWidth = 0; + if (textPtr->highlightWidthObj) { + if (textPtr->highlightWidth < 0) { + textPtr->highlightWidth = 0; + Tcl_DecrRefCount(textPtr->highlightWidthObj); + textPtr->highlightWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(textPtr->highlightWidthObj); + } } dInfoPtr->x = textPtr->highlightWidth + textPtr->borderWidth + textPtr->padX; @@ -6530,7 +6535,7 @@ GetXView( } dInfoPtr->xScrollFirst = first; dInfoPtr->xScrollLast = last; - if (textPtr->xScrollCmd != NULL) { + if (textPtr->xScrollCmdObj != NULL) { char buf1[TCL_DOUBLE_SPACE+1]; char buf2[TCL_DOUBLE_SPACE+1]; Tcl_DString buf; @@ -6540,7 +6545,7 @@ GetXView( Tcl_PrintDouble(NULL, first, buf1+1); Tcl_PrintDouble(NULL, last, buf2+1); Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, textPtr->xScrollCmd, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, Tcl_GetString(textPtr->xScrollCmdObj), TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf1, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf2, TCL_INDEX_NONE); code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); @@ -6815,7 +6820,7 @@ GetYView( dInfoPtr->yScrollFirst = first; dInfoPtr->yScrollLast = last; - if (textPtr->yScrollCmd != NULL) { + if (textPtr->yScrollCmdObj != NULL) { char buf1[TCL_DOUBLE_SPACE+1]; char buf2[TCL_DOUBLE_SPACE+1]; Tcl_DString buf; @@ -6825,7 +6830,7 @@ GetYView( Tcl_PrintDouble(NULL, first, buf1+1); Tcl_PrintDouble(NULL, last, buf2+1); Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, textPtr->yScrollCmd, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, Tcl_GetString(textPtr->yScrollCmdObj), TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf1, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf2, TCL_INDEX_NONE); code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); @@ -7703,7 +7708,7 @@ TkTextCharLayoutProc( if (bytesThatFit + 1 <= maxBytes) { if ((bytesThatFit == 0) && noCharsYet) { int ch; - int chLen = TkUtfToUniChar(p, &ch); + int chLen = Tcl_UtfToUniChar(p, &ch); #ifdef TK_LAYOUT_WITH_BASE_CHUNKS bytesThatFit = CharChunkMeasureChars(chunkPtr, line, diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 7f292e8..5e24e09 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -84,11 +84,11 @@ static const char *const alignStrings[] = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", TCL_INDEX_NONE, offsetof(TkTextEmbImage, align), - TK_OPTION_ENUM_VAR, alignStrings, 0}, + (TCL_MAJOR_VERSION > 8) ? TK_OPTION_ENUM_VAR : 0, alignStrings, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padX), 0, 0, 0}, + "0", offsetof(TkTextEmbImage, padXObj), offsetof(TkTextEmbImage, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padY), 0, 0, 0}, + "0", offsetof(TkTextEmbImage, padYObj), offsetof(TkTextEmbImage, padY), 0, 0, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextEmbImage, imageString), TK_OPTION_NULL_OK, 0, 0}, @@ -253,6 +253,7 @@ TkTextImageCmd( eiPtr->body.ei.image = NULL; eiPtr->body.ei.align = TK_ALIGN_CENTER; eiPtr->body.ei.padX = eiPtr->body.ei.padY = 0; + eiPtr->body.ei.padXObj = eiPtr->body.ei.padYObj = NULL; eiPtr->body.ei.chunkCount = 0; eiPtr->body.ei.optionTable = Tk_CreateOptionTable(interp, optionSpecs); diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 5a4115c..a77fd9a 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -48,14 +48,6 @@ static int IndexCountBytesOrdered(const TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2); -#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION < 9) -# undef Tcl_UtfPrev -# define Tcl_UtfPrev (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ - ((const char * (*)(const char *, const char *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[656])) \ - : ((const char * (*)(const char *, const char *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[331]))) -#endif - - /* * The "textindex" Tcl_Obj definition: */ @@ -451,7 +443,7 @@ TkTextMakeByteIndex( start = segPtr->body.chars + (byteIndex - index); p = Tcl_UtfPrev(start, segPtr->body.chars); - p += TkUtfToUniChar(p, &ch); + p += Tcl_UtfToUniChar(p, &ch); indexPtr->byteIndex += p - start; } break; @@ -494,7 +486,7 @@ TkTextMakeCharIndex( TkTextSegment *segPtr; char *p, *start, *end; int index, offset; - int ch = 0; + Tcl_UniChar ch = 0; indexPtr->tree = tree; if (lineIndex < 0) { @@ -541,7 +533,7 @@ TkTextMakeCharIndex( return indexPtr; } charIndex--; - offset = TkUtfToUniChar(p, &ch); + offset = Tcl_UtfToUniChar(p, &ch); index += offset; } } else { @@ -1129,7 +1121,7 @@ TkTextPrintIndex( break; } if (segPtr->typePtr == &tkTextCharType) { - charIndex += TkNumUtfChars(segPtr->body.chars, segPtr->size); + charIndex += Tcl_NumUtfChars(segPtr->body.chars, segPtr->size); } else { charIndex += segPtr->size; } @@ -1137,7 +1129,7 @@ TkTextPrintIndex( } if (segPtr->typePtr == &tkTextCharType) { - charIndex += TkNumUtfChars(segPtr->body.chars, numBytes); + charIndex += Tcl_NumUtfChars(segPtr->body.chars, numBytes); } else { charIndex += numBytes; } @@ -1665,7 +1657,7 @@ TkTextIndexForwChars( if (segPtr->typePtr == &tkTextCharType) { start = segPtr->body.chars + byteOffset; end = segPtr->body.chars + segPtr->size; - for (p = start; p < end; p += TkUtfToUniChar(p, &ch)) { + for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) { if (charCount == 0) { dstPtr->byteIndex += (p - start); goto forwardCharDone; @@ -1948,7 +1940,7 @@ TkTextIndexCount( } count += byteLen - i; if (i) { - count += TkNumUtfChars(segPtr->body.chars + byteOffset + count += Tcl_NumUtfChars(segPtr->body.chars + byteOffset + (byteLen - i), i); } } else { @@ -2210,6 +2202,9 @@ TkTextIndexBackChars( if (p == start) { break; } + if ((sizeof(Tcl_UniChar) == 2) && (unsigned)(UCHAR(*p) - 0xF0) <= 5) { + charCount--; /* Characters > U+FFFF count as 2 here */ + } if (charCount != 0) { charCount--; } @@ -2394,7 +2389,7 @@ StartEnd( if (segPtr->typePtr == &tkTextCharType) { int ch; - chSize = TkUtfToUniChar(segPtr->body.chars + offset, &ch); + chSize = Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } @@ -2439,7 +2434,7 @@ StartEnd( if (segPtr->typePtr == &tkTextCharType) { int ch; - TkUtfToUniChar(segPtr->body.chars + offset, &ch); + Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 4110e8f..32a62ad 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -16,285 +16,63 @@ #include "tkText.h" #include "default.h" -/* This struct can be used for booleans, relief and pixels */ -typedef struct { - char *string; - int value; -} IntStruct; - -typedef struct { - char *string; - Tk_Justify value; -} JustifyStruct; - -static int -ObjectIsEmpty( - Tcl_Obj *objPtr) /* Object to test. May be NULL. */ -{ - if (objPtr == NULL) { - return 1; - } - if (objPtr->bytes == NULL) { - Tcl_GetString(objPtr); - } - return (objPtr->length == 0); -} - -#define OPTION_NONNEG (1 << 10) - -static int -SetPixels( - TCL_UNUSED(void *), - Tcl_Interp *interp, - Tk_Window tkwin, - Tcl_Obj **value, - char *recordPtr, - Tcl_Size internalOffset, - char *oldInternalPtr, - int flags) -{ - IntStruct pixel = {NULL, INT_MIN}; - IntStruct *internalPtr = (IntStruct *)(recordPtr + internalOffset); - int nullOK = (flags & TK_OPTION_NULL_OK); - - if (!nullOK || !ObjectIsEmpty(*value)) { - if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, *value, &pixel.value) != TCL_OK) { - if (nullOK) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "expected screen distance or \"\" but got \"%.50s\"", Tcl_GetString(*value))); - Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", (char *)NULL); - } - return TCL_ERROR; - } - if ((flags & OPTION_NONNEG) && pixel.value < 0) { - pixel.value = 0; - } - pixel.string = (char *)ckalloc((*value)->length + 1); - strcpy(pixel.string, (*value)->bytes); - } - - *((char **)oldInternalPtr) = NULL; - *internalPtr = pixel; - return TCL_OK; -}; - -static int -SetBoolean( - TCL_UNUSED(void *), - Tcl_Interp *interp, - TCL_UNUSED(Tk_Window), - Tcl_Obj **value, - char *recordPtr, - Tcl_Size internalOffset, - char *oldInternalPtr, - int flags) -{ - IntStruct booleanVal = {NULL, -1}; - IntStruct *internalPtr = (IntStruct *)(recordPtr + internalOffset); - int nullOK = (flags & TK_OPTION_NULL_OK); - - if (!nullOK || !ObjectIsEmpty(*value)) { - if (Tcl_GetBooleanFromObj(nullOK ? NULL : interp, *value, &booleanVal.value) != TCL_OK) { - if (nullOK) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "expected boolean value or \"\" but got \"%s\"", Tcl_GetString(*value))); - } - return TCL_ERROR; - } - booleanVal.string = (char *)ckalloc((*value)->length + 1); - strcpy(booleanVal.string, (*value)->bytes); - } - - *((char **)oldInternalPtr) = NULL; - *internalPtr = booleanVal; - return TCL_OK; -}; - -static int -SetRelief( - TCL_UNUSED(void *), - Tcl_Interp *interp, - TCL_UNUSED(Tk_Window), - Tcl_Obj **value, - char *recordPtr, - Tcl_Size internalOffset, - char *oldInternalPtr, - int flags) -{ - IntStruct relief = {NULL, TK_RELIEF_NULL}; - IntStruct *internalPtr = (IntStruct *)(recordPtr + internalOffset); - int nullOK = (flags & TK_OPTION_NULL_OK); - - if (!nullOK || !ObjectIsEmpty(*value)) { - if (Tk_GetReliefFromObj(nullOK ? NULL : interp, *value, &relief.value) != TCL_OK) { - if (nullOK) { - Tcl_AppendResult(interp, "bad relief \"", - Tcl_GetString(*value), "\": must be flat, groove, raised, ridge, solid, sunken, or \"\"", (char *)NULL); - } - return TCL_ERROR; - } - relief.string = (char *)ckalloc((*value)->length + 1); - strcpy(relief.string, (*value)->bytes); - } - - *((char **)oldInternalPtr) = NULL; - *internalPtr = relief; - return TCL_OK; -}; - -static int -SetJustify( - TCL_UNUSED(void *), - Tcl_Interp *interp, - TCL_UNUSED(Tk_Window), - Tcl_Obj **value, - char *recordPtr, - Tcl_Size internalOffset, - char *oldInternalPtr, - int flags) -{ - JustifyStruct justify = {NULL, TK_JUSTIFY_NULL}; - JustifyStruct *internalPtr = (JustifyStruct *)(recordPtr + internalOffset); - int nullOK = (flags & TK_OPTION_NULL_OK); - - if (!nullOK || !ObjectIsEmpty(*value)) { - if (Tk_GetJustifyFromObj(nullOK ? NULL : interp, *value, &justify.value) != TCL_OK) { - if (nullOK) { - Tcl_AppendResult(interp, "bad justification \"", - Tcl_GetString(*value), "\": must be left, right, center, or \"\"", (char *)NULL); - } - return TCL_ERROR; - } - justify.string = (char *)ckalloc((*value)->length + 1); - strcpy(justify.string, (*value)->bytes); - } - - *((char **)oldInternalPtr) = NULL; - *internalPtr = justify; - return TCL_OK; -}; - -static Tcl_Obj *GetStruct( - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - char *recordPtr, - Tcl_Size internalOffset) -{ - char **structPtr = (char **)(recordPtr + internalOffset); - - if (*structPtr == NULL || **structPtr == '\0') { - return Tcl_NewObj(); - } - return Tcl_NewStringObj(*structPtr, TCL_INDEX_NONE); -}; - - -static void -FreeStruct( - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - char *internalPtr) -{ - char **structPtr = (char **)internalPtr; - if (*structPtr) { - ckfree(*structPtr); - *structPtr = NULL; - } -}; - -static const Tk_ObjCustomOption pixelsOption = { - "pixels", /* name */ - SetPixels, /* setProc */ - GetStruct, /* getProc */ - NULL, /* restoreProc */ - FreeStruct, /* freeProc */ - 0 -}; - -static const Tk_ObjCustomOption booleanOption = { - "boolean", /* name */ - SetBoolean, /* setProc */ - GetStruct, /* getProc */ - NULL, /* restoreProc */ - FreeStruct, /* freeProc */ - 0 -}; - -static const Tk_ObjCustomOption justifyOption = { - "justify", /* name */ - SetJustify, /* setProc */ - GetStruct, /* getProc */ - NULL, /* restoreProc */ - FreeStruct, /* freeProc */ - 0 -}; - -static const Tk_ObjCustomOption reliefOption = { - "relief", /* name */ - SetRelief, /* setProc */ - GetStruct, /* getProc */ - NULL, /* restoreProc */ - FreeStruct, /* freeProc */ - 0 -}; - static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL, - NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth), + NULL, offsetof(TkTextTag, borderWidthObj), offsetof(TkTextTag, borderWidth), + TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_BOOLEAN, "-elide", NULL, NULL, + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, elide), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_CUSTOM, "-elide", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, elideString), - TK_OPTION_NULL_OK, &booleanOption, 0}, {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_CUSTOM, "-justify", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justifyString), TK_OPTION_NULL_OK, &justifyOption,0}, - {TK_OPTION_CUSTOM, "-lmargin1", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,&pixelsOption,0}, - {TK_OPTION_CUSTOM, "-lmargin2", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,&pixelsOption,0}, + {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justify), TK_OPTION_NULL_OK, 0,0}, + {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL, + NULL, offsetof(TkTextTag, lMargin1Obj), offsetof(TkTextTag, lMargin1), TK_OPTION_NULL_OK,0,0}, + {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL, + NULL, offsetof(TkTextTag, lMargin2Obj), offsetof(TkTextTag, lMargin2), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_CUSTOM, "-offset", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, &pixelsOption, 0}, - {TK_OPTION_CUSTOM, "-overstrike", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeString), - TK_OPTION_NULL_OK, &booleanOption, 0}, + {TK_OPTION_PIXELS, "-offset", NULL, NULL, + NULL, offsetof(TkTextTag, offsetObj), offsetof(TkTextTag, offset), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL, + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrike), + TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_CUSTOM, "-relief", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, reliefString), TK_OPTION_NULL_OK, &reliefOption, 0}, - {TK_OPTION_CUSTOM, "-rmargin", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginString), TK_OPTION_NULL_OK, &pixelsOption,0}, + {TK_OPTION_RELIEF, "-relief", NULL, NULL, + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, relief), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-rmargin", NULL, NULL, + NULL, offsetof(TkTextTag, rMarginObj), offsetof(TkTextTag, rMargin), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_BORDER, "-rmargincolor", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_CUSTOM, "-spacing1", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing1String), TK_OPTION_NULL_OK|OPTION_NONNEG, &pixelsOption,0}, - {TK_OPTION_CUSTOM, "-spacing2", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing2String), TK_OPTION_NULL_OK|OPTION_NONNEG, &pixelsOption,0}, - {TK_OPTION_CUSTOM, "-spacing3", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, spacing3String), TK_OPTION_NULL_OK|OPTION_NONNEG, &pixelsOption,0}, + {TK_OPTION_PIXELS, "-spacing1", NULL, NULL, + NULL, offsetof(TkTextTag, spacing1Obj), offsetof(TkTextTag, spacing1), TK_OPTION_NULL_OK,0,0}, + {TK_OPTION_PIXELS, "-spacing2", NULL, NULL, + NULL, offsetof(TkTextTag, spacing2Obj), offsetof(TkTextTag, spacing2), TK_OPTION_NULL_OK,0,0}, + {TK_OPTION_PIXELS, "-spacing3", NULL, NULL, + NULL, offsetof(TkTextTag, spacing3Obj), offsetof(TkTextTag, spacing3), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-tabs", NULL, NULL, NULL, offsetof(TkTextTag, tabStringPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tabStyle), TK_OPTION_NULL_OK|TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, 0}, - {TK_OPTION_CUSTOM, "-underline", NULL, NULL, - NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underlineString), - TK_OPTION_NULL_OK, &booleanOption, 0}, + {TK_OPTION_BOOLEAN, "-underline", NULL, NULL, + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underline), + TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-underlinefg", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underlineColor), TK_OPTION_NULL_OK, 0, 0}, @@ -392,12 +170,12 @@ TkTextTagCmd( */ textPtr->sharedTextPtr->stateEpoch++; } - for (i = 4; i < objc; i += 2) { + for (i = 4; i < (Tcl_Size)objc; i += 2) { if (TkTextGetObjIndex(interp, textPtr, objv[i], &index1) != TCL_OK) { return TCL_ERROR; } - if (objc > (i+1)) { + if ((Tcl_Size)objc > (i+1)) { if (TkTextGetObjIndex(interp, textPtr, objv[i+1], &index2) != TCL_OK) { return TCL_ERROR; @@ -503,7 +281,7 @@ TkTextTagCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj( "requested illegal events; only key, button, motion," " enter, leave, and virtual events may be used", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "TEXT", "TAG_BIND_EVENT", (char *)NULL); + Tcl_SetErrorCode(interp, "TK", "TEXT", "TAG_BIND_EVENT",NULL); return TCL_ERROR; } } else if (objc == 5) { @@ -585,8 +363,37 @@ TkTextTagCmd( * from "unspecified"). */ - if (tagPtr->borderWidth < 0) { - tagPtr->borderWidth = 0; + if (tagPtr->borderWidthObj) { + if (tagPtr->borderWidth < 0) { + tagPtr->borderWidth = 0; + Tcl_DecrRefCount(tagPtr->borderWidthObj); + tagPtr->borderWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(tagPtr->borderWidthObj); + } + } + if (tagPtr->spacing1Obj) { + if (tagPtr->spacing1 < 0) { + tagPtr->spacing1 = 0; + Tcl_DecrRefCount(tagPtr->spacing1Obj); + tagPtr->spacing1Obj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(tagPtr->spacing1Obj); + } + } + if (tagPtr->spacing2Obj) { + if (tagPtr->spacing2 < 0) { + tagPtr->spacing2 = 0; + Tcl_DecrRefCount(tagPtr->spacing2Obj); + tagPtr->spacing2Obj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(tagPtr->spacing2Obj); + } + } + if (tagPtr->spacing3Obj) { + if (tagPtr->spacing3 < 0) { + tagPtr->spacing3 = 0; + Tcl_DecrRefCount(tagPtr->spacing3Obj); + tagPtr->spacing3Obj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(tagPtr->spacing3Obj); + } } if (tagPtr->tabArrayPtr != NULL) { ckfree(tagPtr->tabArrayPtr); @@ -594,7 +401,7 @@ TkTextTagCmd( } if (tagPtr->tabStringPtr != NULL) { tagPtr->tabArrayPtr = - TkTextGetTabs(interp, textPtr, tagPtr->tabStringPtr); + TkTextGetTabs(interp, textPtr->tkwin, tagPtr->tabStringPtr); if (tagPtr->tabArrayPtr == NULL) { return TCL_ERROR; } @@ -624,7 +431,7 @@ TkTextTagCmd( textPtr->selBorder = tagPtr->selBorder; } textPtr->selBorderWidth = tagPtr->borderWidth; - textPtr->selBorderWidthPtr = tagPtr->borderWidthPtr; + textPtr->selBorderWidthObj = tagPtr->borderWidthObj; if (tagPtr->selFgColor == NULL) { textPtr->selFgColorPtr = tagPtr->fgColor; } else { @@ -694,7 +501,7 @@ TkTextTagCmd( Tcl_WrongNumArgs(interp, 3, objv, "tagName ?tagName ...?"); return TCL_ERROR; } - for (i = 3; i < objc; i++) { + for (i = 3; i < (Tcl_Size)objc; i++) { hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(objv[i])); if (hPtr == NULL) { @@ -798,7 +605,7 @@ TkTextTagCmd( for (i = 0; i < arraySize; i++) { tagPtr = arrayPtr[i]; Tcl_ListObjAppendElement(interp, listObj, - Tcl_NewStringObj(tagPtr->name, TCL_INDEX_NONE)); + Tcl_NewStringObj(tagPtr->name,-1)); } Tcl_SetObjResult(interp, listObj); ckfree(arrayPtr); @@ -1149,43 +956,38 @@ TkTextCreateTag( tagPtr->priority = textPtr->sharedTextPtr->numTags; tagPtr->border = NULL; tagPtr->borderWidth = 0; - tagPtr->borderWidthPtr = NULL; - tagPtr->reliefString = NULL; + tagPtr->borderWidthObj = NULL; tagPtr->relief = TK_RELIEF_NULL; tagPtr->bgStipple = None; tagPtr->fgColor = NULL; tagPtr->tkfont = NULL; tagPtr->fgStipple = None; - tagPtr->justifyString = NULL; tagPtr->justify = TK_JUSTIFY_NULL; - tagPtr->lMargin1String = NULL; + tagPtr->lMargin1Obj = NULL; tagPtr->lMargin1 = INT_MIN; - tagPtr->lMargin2String = NULL; + tagPtr->lMargin2Obj = NULL; tagPtr->lMargin2 = INT_MIN; tagPtr->lMarginColor = NULL; - tagPtr->offsetString = NULL; + tagPtr->offsetObj = NULL; tagPtr->offset = INT_MIN; - tagPtr->overstrikeString = NULL; tagPtr->overstrike = -1; tagPtr->overstrikeColor = NULL; - tagPtr->rMarginString = NULL; + tagPtr->rMarginObj = NULL; tagPtr->rMargin = INT_MIN; tagPtr->rMarginColor = NULL; tagPtr->selBorder = NULL; tagPtr->selFgColor = NULL; - tagPtr->spacing1String = NULL; + tagPtr->spacing1Obj = NULL; tagPtr->spacing1 = INT_MIN; - tagPtr->spacing2String = NULL; + tagPtr->spacing2Obj = NULL; tagPtr->spacing2 = INT_MIN; - tagPtr->spacing3String = NULL; + tagPtr->spacing3Obj = NULL; tagPtr->spacing3 = INT_MIN; tagPtr->tabStringPtr = NULL; tagPtr->tabArrayPtr = NULL; tagPtr->tabStyle = TK_TEXT_TABSTYLE_NULL; - tagPtr->underlineString = NULL; tagPtr->underline = -1; tagPtr->underlineColor = NULL; - tagPtr->elideString = NULL; tagPtr->elide = -1; tagPtr->wrapMode = TEXT_WRAPMODE_NULL; tagPtr->affectsDisplay = 0; @@ -1247,7 +1049,7 @@ FindTag( "tag \"%s\" isn't defined in text widget", Tcl_GetString(tagName))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TEXT_TAG", - Tcl_GetString(tagName), (char *)NULL); + Tcl_GetString(tagName), NULL); } return NULL; } diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 8c71e48..1ee3f46 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -96,13 +96,13 @@ static const char *const alignStrings[] = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, align), - TK_OPTION_ENUM_VAR, alignStrings, 0}, + (TCL_MAJOR_VERSION > 8) ? TK_OPTION_ENUM_VAR : 0, alignStrings, 0}, {TK_OPTION_STRING, "-create", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, padX), 0, 0, 0}, + "0", offsetof(TkTextEmbWindow, padXObj), offsetof(TkTextEmbWindow, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, padY), 0, 0, 0}, + "0", offsetof(TkTextEmbWindow, padYObj), offsetof(TkTextEmbWindow, padY), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL, "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, stretch), 0, 0, 0}, {TK_OPTION_WINDOW, "-window", NULL, NULL, @@ -293,6 +293,7 @@ TkTextWindowCmd( ewPtr->body.ew.create = NULL; ewPtr->body.ew.align = TK_ALIGN_CENTER; ewPtr->body.ew.padX = ewPtr->body.ew.padY = 0; + ewPtr->body.ew.padXObj = ewPtr->body.ew.padYObj = NULL; ewPtr->body.ew.stretch = 0; ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs); diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 0eaa069..80a6f25 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1310,78 +1310,6 @@ Tk_SendVirtualEvent( Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } -#if TCL_MAJOR_VERSION < 9 -/* - *--------------------------------------------------------------------------- - * - * TkUtfToUniChar -- - * - * Almost the same as Tcl_UtfToUniChar but using int instead of Tcl_UniChar. - * This function is capable of collapsing a upper/lower surrogate pair to a - * single unicode character. So, up to 6 bytes might be consumed. - * - * Results: - * *chPtr is filled with the Tcl_UniChar, and the return value is the - * number of bytes from the UTF-8 string that were consumed. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ - -Tcl_Size -TkUtfToUniChar( - const char *src, /* The UTF-8 string. */ - int *chPtr) /* Filled with the Unicode value represented by - * the UTF-8 string. */ -{ - Tcl_UniChar uniChar = 0; - - Tcl_Size len = Tcl_UtfToUniChar(src, &uniChar); - if ((uniChar & 0xFC00) == 0xD800) { - Tcl_UniChar low = uniChar; - /* This can only happen if src points to a character > U+FFFF */ - Tcl_Size len2 = Tcl_UtfToUniChar(src+len, &low); - if ((low & 0xFC00) == 0xDC00) { - *chPtr = (((uniChar & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000; - return len + len2; - } - } - *chPtr = uniChar; - return len; -} - -/* - *--------------------------------------------------------------------------- - * - * TkUniCharToUtf -- - * - * Almost the same as Tcl_UniCharToUtf but producing 2 x 3-byte UTF-8 - * sequences for out-of-bmp characters when TCL_UTF_MAX==3. - * So, up to 6 bytes might be produced. - * - * Results: - * *buf is filled with the UTF-8 string, and the return value is the - * number of bytes produced. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ - -Tcl_Size TkUniCharToUtf(int ch, char *buf) -{ - if ((unsigned)(ch - 0x10000) <= 0xFFFFF) { - /* Spit out a 4-byte UTF-8 character (Tcl 8.7+) or - * 2 x 3-byte UTF-8 characters (Tcl 8.6) */ - Tcl_Size len = Tcl_UniCharToUtf(0xD800 | ((ch - 0x10000) >> 10), buf); - return len + Tcl_UniCharToUtf(0xDC00 | (ch & 0x7FF), buf + len); - } - return Tcl_UniCharToUtf(ch, buf); -} -#endif /* * Local Variables: * mode: c diff --git a/generic/tkWindow.c b/generic/tkWindow.c index ee0e1b8..9d36e9f 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -215,6 +215,17 @@ static int Initialize(Tcl_Interp *interp); static int NameWindow(Tcl_Interp *interp, TkWindow *winPtr, TkWindow *parentPtr, const char *name); static void UnlinkWindow(TkWindow *winPtr); + +/* + * This static variable only makes sense for macOS and Windows, which never + * have more than one display. It is set by TkCloseDisplay, and when set + * prevents sending Enter and Leave events when all of the windows in the + * display are being destroyed. Tk does not send those events on X11; that + * job is handled by the X server. + */ + +static int displayBeingClosed = 0; + /* *---------------------------------------------------------------------- @@ -239,6 +250,7 @@ static void TkCloseDisplay( TkDisplay *dispPtr) { + displayBeingClosed = 1; TkClipCleanup(dispPtr); if (dispPtr->name != NULL) { @@ -888,7 +900,7 @@ TkCreateMainWindow( #if TCL_MAJOR_VERSION > 8 mainPtr->tclUpdateObjProc2 = NULL; #endif - if (Tcl_LinkVar(interp, "tk_strictMotif", (char *)&mainPtr->strictMotif, + if (Tcl_LinkVar(interp, "tk_strictMotif", &mainPtr->strictMotif, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } @@ -896,7 +908,7 @@ TkCreateMainWindow( Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::AlwaysShowSelection", - (char *)&mainPtr->alwaysShowSelection, + &mainPtr->alwaysShowSelection, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } @@ -1334,6 +1346,39 @@ Tk_CreateWindowFromPath( *-------------------------------------------------------------- */ +#if defined(MAC_OSX_TK) || defined(_WIN32) +static void SendEnterLeaveForDestroy( + Tk_Window tkwin) +{ + int x, y; + unsigned int state; + Tk_Window pointerWin; + TkWindow *containerPtr; + + if (displayBeingClosed) { + return; + } + XQueryPointer(Tk_Display(tkwin), None, NULL, NULL, &x, &y, + NULL, NULL, &state); + pointerWin = Tk_CoordsToWindow(x, y, tkwin); + if (pointerWin == tkwin) { + if (!Tk_IsTopLevel(tkwin)) { + containerPtr = TkGetContainer((TkWindow *)pointerWin); + Tk_UpdatePointer((Tk_Window) containerPtr, x, y, state); + } + } + + if (pointerWin && (tkwin == Tk_Parent(pointerWin))) { + Tk_UpdatePointer(Tk_Parent(tkwin), x, y, state); + } +} +#else +static void SendEnterLeaveForDestroy( + TCL_UNUSED(Tk_Window)) +{ +} +#endif + void Tk_DestroyWindow( Tk_Window tkwin) /* Window to destroy. */ @@ -1353,6 +1398,10 @@ Tk_DestroyWindow( return; } + if ((winPtr->flags & TK_DONT_DESTROY_WINDOW) == 0) { + SendEnterLeaveForDestroy(tkwin); + } + winPtr->flags |= TK_ALREADY_DEAD; /* @@ -1523,7 +1572,7 @@ Tk_DestroyWindow( * Cleanup the data structures associated with this window. */ - if (winPtr->flags & TK_WIN_MANAGED) { + if (winPtr->wmInfoPtr && (winPtr->flags & TK_WIN_MANAGED)) { TkWmDeadWindow(winPtr); } else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) { TkWmRemoveFromColormapWindows(winPtr); @@ -2612,7 +2661,7 @@ Tk_RestackWindow( TkWindow *otherPtr = (TkWindow *) other; /* - * Special case: if winPtr is a top-level window then just find the + * Special case: if winPtr is a toplevel window then just find the * top-level ancestor of otherPtr and restack winPtr above otherPtr * without changing any of Tk's childLists. */ @@ -2948,9 +2997,9 @@ DeleteWindowsExitProc( static HMODULE tkcygwindll = NULL; /* - * Run Tk_MainEx from libtk8.?.dll + * Run Tk_MainEx from libtcl9tk9.?.dll * - * This function is only ever called from wish8.?.exe, the cygwin port of Tcl. + * This function is only ever called from wish9.?.exe, the cygwin port of Tcl. * This means that the system encoding is utf-8, so we don't have to do any * encoding conversions. */ @@ -2969,15 +3018,15 @@ TkCygwinMainEx( size_t len; void (*tkmainex)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); - /* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */ + /* construct "<path>/libtcl9tk9.?.dll", from "<path>/tcl9tk9?.dll" */ len = GetModuleFileNameW((HINSTANCE)Tk_GetHINSTANCE(), name, MAX_PATH); name[len-2] = '.'; name[len-1] = name[len-5]; wcscpy(name+len, L".dll"); #if TCL_MAJOR_VERSION > 8 - memcpy(name+len-12, L"libtcl9tk8", 10 * sizeof(WCHAR)); + memcpy(name+len-12, L"libtcl9tk9", 10 * sizeof(WCHAR)); #else - memcpy(name+len-8, L"libtk8", 6 * sizeof(WCHAR)); + memcpy(name+len-8, L"libtk9", 6 * sizeof(WCHAR)); #endif tkcygwindll = LoadLibraryW(name); @@ -3177,7 +3226,7 @@ Initialize( * Ensure that we are getting a compatible version of Tcl. */ - if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { return TCL_ERROR; } @@ -3377,7 +3426,14 @@ Initialize( visualObj = NULL; } - code = TkListCreateFrame(NULL, interp, cmd, 1, nameObj); + Tcl_Size objc; + Tcl_Obj **objv; + + if (TCL_OK != Tcl_ListObjGetElements(interp, cmd, &objc, &objv)) { + return TCL_ERROR; + } + code = TkCreateFrame(NULL, interp, objc, objv, + 1, nameObj ? Tcl_GetString(nameObj) : NULL); Tcl_DecrRefCount(cmd); diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls index 1c98b23..7826c99 100644 --- a/generic/ttk/ttk.decls +++ b/generic/ttk/ttk.decls @@ -143,8 +143,8 @@ declare 35 { # # Utilities. # -declare 40 {deprecated {}} { - int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient) +declare 40 { + int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient) } diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index ea717ff..be63496 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -549,7 +549,7 @@ static const Ttk_ElementSpec IndicatorElementSpec = { typedef struct { Tcl_Obj *lightColorObj; Tcl_Obj *borderColorObj; - Tcl_Obj *gripCountObj; + Tcl_Obj *gripSizeObj; } GripElement; static const Ttk_ElementOptionSpec GripElementOptions[] = { @@ -557,8 +557,8 @@ static const Ttk_ElementOptionSpec GripElementOptions[] = { offsetof(GripElement,lightColorObj), LIGHT_COLOR }, { "-bordercolor", TK_OPTION_COLOR, offsetof(GripElement,borderColorObj), DARKEST_COLOR }, - { "-gripcount", TK_OPTION_PIXELS, - offsetof(GripElement,gripCountObj), "5" }, + { "-gripsize", TK_OPTION_PIXELS, + offsetof(GripElement,gripSizeObj), "7.5p" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; @@ -571,8 +571,7 @@ static void GripElementSize( GripElement *grip = (GripElement *)elementRecord; int gripSize = 0; - Tk_GetPixelsFromObj(NULL, tkwin, grip->gripCountObj, &gripSize); - gripSize *= 2; + Tk_GetPixelsFromObj(NULL, tkwin, grip->gripSizeObj, &gripSize); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = gripSize; } else { @@ -593,8 +592,7 @@ static void GripElementDraw( int gripPad = 1, gripSize = 0; int i; - Tk_GetPixelsFromObj(NULL, tkwin, grip->gripCountObj, &gripSize); - gripSize *= 2; + Tk_GetPixelsFromObj(NULL, tkwin, grip->gripSizeObj, &gripSize); if (orient == TTK_ORIENT_HORIZONTAL) { int x = b.x + (b.width - gripSize) / 2; @@ -637,7 +635,7 @@ typedef struct { /* Common element record for scrollbar elements */ Tcl_Obj *darkColorObj; Tcl_Obj *arrowColorObj; Tcl_Obj *arrowSizeObj; - Tcl_Obj *gripCountObj; + Tcl_Obj *gripSizeObj; Tcl_Obj *sliderlengthObj; } ScrollbarElement; @@ -658,8 +656,8 @@ static const Ttk_ElementOptionSpec ScrollbarElementOptions[] = { offsetof(ScrollbarElement,arrowColorObj), "#000000" }, { "-arrowsize", TK_OPTION_PIXELS, offsetof(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) }, - { "-gripcount", TK_OPTION_PIXELS, - offsetof(ScrollbarElement,gripCountObj), "5" }, + { "-gripsize", TK_OPTION_PIXELS, + offsetof(ScrollbarElement,gripSizeObj), "7.5p" }, { "-sliderlength", TK_OPTION_PIXELS, offsetof(ScrollbarElement,sliderlengthObj), "30" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } @@ -728,9 +726,8 @@ static void ThumbElementDraw( /* * Draw grip: */ - TtkGetOrientFromObj(NULL, sb->orientObj, &orient); - Tk_GetPixelsFromObj(NULL, tkwin, sb->gripCountObj, &gripSize); - gripSize *= 2; + Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); + Tk_GetPixelsFromObj(NULL, tkwin, sb->gripSizeObj, &gripSize); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); @@ -777,7 +774,7 @@ static void SliderElementSize( Ttk_Orient orient; length = thickness = SCROLLBAR_THICKNESS; - TtkGetOrientFromObj(NULL, sb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, sb->arrowSizeObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, sb->sliderlengthObj, &length); if (orient == TTK_ORIENT_VERTICAL) { diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 758324a..87897f7 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -234,7 +234,7 @@ static const Ttk_ElementOptionSpec IndicatorElementOptions[] = { offsetof(IndicatorElement,colorObj), DEFAULT_BACKGROUND }, { "-indicatorrelief", TK_OPTION_RELIEF, offsetof(IndicatorElement,reliefObj), "raised" }, - { "-indicatordiameter", TK_OPTION_PIXELS, + { "-indicatorsize", TK_OPTION_PIXELS, offsetof(IndicatorElement,sizeObj), "9p" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, @@ -594,7 +594,7 @@ static void SliderElementSize( Ttk_Orient orient; int length, thickness; - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); @@ -627,7 +627,7 @@ static void SliderElementDraw( border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 2b074ac..9c40904 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -13,11 +13,7 @@ extern const char *TtkInitializeStubs( interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION) #else -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL) -#else -# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) -#endif +#define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) #endif @@ -143,9 +139,8 @@ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box); /* Slot 38 is reserved */ /* Slot 39 is reserved */ /* 40 */ -TTK_DEPRECATED("") -int Ttk_GetOrientFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, int *orient); +TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, Ttk_Orient *orient); typedef struct TtkStubs { int magic; @@ -193,7 +188,7 @@ typedef struct TtkStubs { void (*reserved37)(void); void (*reserved38)(void); void (*reserved39)(void); - TCL_DEPRECATED_API("") int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */ + int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient); /* 40 */ } TtkStubs; extern const TtkStubs *ttkStubsPtr; diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index f3bc771..5c72773 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1063,7 +1063,7 @@ static void ThumbElementSize( int size; Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size); - TtkGetOrientFromObj(NULL, thumb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = size; @@ -1158,7 +1158,7 @@ static void SliderElementSize( Ttk_Orient orient; int thickness, borderWidth; - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); @@ -1217,7 +1217,7 @@ typedef struct { static const Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, - { "-diameter", TK_OPTION_PIXELS, + { "-size", TK_OPTION_PIXELS, offsetof(TreeitemIndicator,sizeObj), "6.75p" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginObj), "2 2 4 2" }, @@ -1233,13 +1233,13 @@ static void TreeitemIndicatorSize( TCL_UNUSED(Ttk_Padding *)) { TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; - int diameter = 0; + int size = 0; Ttk_Padding margins; - Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &diameter); + Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); - *widthPtr = diameter + Ttk_PaddingWidth(margins); - *heightPtr = diameter + Ttk_PaddingHeight(margins); + *widthPtr = size + Ttk_PaddingWidth(margins); + *heightPtr = size + Ttk_PaddingHeight(margins); } static void TreeitemIndicatorDraw( diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index c3c65c1..e232882 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -85,7 +85,7 @@ static void FillElementDraw( TCL_UNUSED(Ttk_State)) { BackgroundElement *bg = (BackgroundElement *)elementRecord; - Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin, bg->backgroundObj); + Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,bg->backgroundObj); XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), @@ -341,7 +341,7 @@ static void PaddingElementSize( Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, padding->shiftreliefObj, &shiftRelief); - Ttk_GetPaddingFromObj(NULL, tkwin, padding->paddingObj, &pad); + Ttk_GetPaddingFromObj(NULL,tkwin,padding->paddingObj,&pad); *paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief); } @@ -525,7 +525,7 @@ static void GeneralSeparatorElementDraw( SeparatorElement *separator = (SeparatorElement *)elementRecord; Ttk_Orient orient; - TtkGetOrientFromObj(NULL, separator->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: HorizontalSeparatorElementDraw( @@ -576,7 +576,7 @@ static const Ttk_ElementOptionSpec SizegripOptions[] = { offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, { "-gripsize", TK_OPTION_PIXELS, offsetof(SizegripElement,gripSizeObj), "11.25p" }, - {0, TK_OPTION_BOOLEAN, 0, 0} + {0,TK_OPTION_BOOLEAN,0,0} }; static void SizegripSize( @@ -616,9 +616,9 @@ static void SizegripDraw( while (gripCount--) { x1 -= gripSpace; y2 -= gripSpace; for (int i = 1; i < gripThickness; i++) { - XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2; + XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2; } - XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y1, x2,y2); --x1; --y2; + XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y1, x2,y2); --x1; --y2; } } @@ -928,7 +928,7 @@ static const Ttk_ElementOptionSpec ArrowElementOptions[] = { { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; -static const Ttk_Padding ArrowPadding = { 3, 3, 3, 3 }; +static const Ttk_Padding ArrowPadding = { 3,3,3,3 }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, @@ -1235,7 +1235,7 @@ static void TroughElementDraw( Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief); - TtkGetOrientFromObj(NULL, troughPtr->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient); if (grooveWidth > 0 && grooveWidth < b.height && grooveWidth < b.width) { if (orient == TTK_ORIENT_HORIZONTAL) { @@ -1309,7 +1309,7 @@ static void ThumbElementSize( int thickness; Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness); - TtkGetOrientFromObj(NULL, thumb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = thickness; @@ -1440,7 +1440,7 @@ static void SliderElementDraw( * slider's center with the inner color */ if (mainInfoPtr != NULL) { - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: XFillRectangle(disp, d, gc, @@ -1579,7 +1579,7 @@ static void PbarElementSize( Ttk_Orient orient; int thickness = 15, length = 30, borderWidth = 2; - TtkGetOrientFromObj(NULL, pbar->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, pbar->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); @@ -1642,7 +1642,7 @@ static const Ttk_ElementOptionSpec TabElementOptions[] = { offsetof(TabElement,highlightObj), "0" }, { "-highlightcolor", TK_OPTION_COLOR, offsetof(TabElement,highlightColorObj), "#4a6984" }, - {0, TK_OPTION_BOOLEAN, 0, 0} + {0,TK_OPTION_BOOLEAN,0,0} }; static void TabElementSize( @@ -1877,7 +1877,7 @@ static void ClientElementDraw( Tk_GetPixelsFromObj(NULL, tkwin, ce->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, - b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_RAISED); + b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_RAISED); } static const Ttk_ElementSpec ClientElementSpec = { @@ -1902,7 +1902,7 @@ TtkElements_Init(Tcl_Interp *interp) * Elements: */ Ttk_RegisterElement(interp, theme, "background", - &BackgroundElementSpec, NULL); + &BackgroundElementSpec,NULL); Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL); Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index a43e3f0..a9489ac 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -300,8 +300,8 @@ static char *EntryDisplayString(const char *showChar, int numChars) int ch; char buf[6]; - TkUtfToUniChar(showChar, &ch); - size = TkUniCharToUtf(ch, buf); + Tcl_UtfToUniChar(showChar, &ch); + size = Tcl_UniCharToUtf(ch, buf); p = displayString = (char *)ckalloc(numChars * size + 1); while (numChars--) { @@ -369,8 +369,8 @@ EntryFetchSelection( } string = entryPtr->entry.displayString; - selStart = TkUtfAtIndex(string, entryPtr->entry.selectFirst); - selEnd = TkUtfAtIndex(selStart, + selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst); + selEnd = Tcl_UtfAtIndex(selStart, entryPtr->entry.selectLast - entryPtr->entry.selectFirst); if (selEnd <= selStart + offset) { return 0; @@ -458,7 +458,7 @@ ExpandPercents( */ ++templ; /* skip over % */ if (*templ != '\0') { - templ += TkUtfToUniChar(templ, &ch); + templ += Tcl_UtfToUniChar(templ, &ch); } else { ch = '%'; } @@ -488,11 +488,11 @@ ExpandPercents( break; case 'S': /* string to be inserted/deleted, if any */ if (reason == VALIDATE_INSERT) { - string = TkUtfAtIndex(newValue, index); - stringLength = TkUtfAtIndex(string, count) - string; + string = Tcl_UtfAtIndex(newValue, index); + stringLength = Tcl_UtfAtIndex(string, count) - string; } else if (reason == VALIDATE_DELETE) { - string = TkUtfAtIndex(entryPtr->entry.string, index); - stringLength = TkUtfAtIndex(string, count) - string; + string = Tcl_UtfAtIndex(entryPtr->entry.string, index); + stringLength = Tcl_UtfAtIndex(string, count) - string; } else { string = ""; stringLength = 0; @@ -508,7 +508,7 @@ ExpandPercents( string = Tk_PathName(entryPtr->core.tkwin); break; default: - length = TkUniCharToUtf(ch, numStorage); + length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; @@ -740,7 +740,7 @@ static void EntryStoreValue(Entry *entryPtr, const char *value) { size_t numBytes = strlen(value); - Tcl_Size numChars = TkNumUtfChars(value, numBytes); + Tcl_Size numChars = Tcl_NumUtfChars(value, numBytes); if (entryPtr->core.flags & VALIDATING) entryPtr->core.flags |= VALIDATION_SET_VALUE; @@ -845,9 +845,9 @@ InsertChars( const char *value) /* New characters to add */ { char *string = entryPtr->entry.string; - size_t byteIndex = TkUtfAtIndex(string, index) - string; + size_t byteIndex = Tcl_UtfAtIndex(string, index) - string; size_t byteCount = strlen(value); - int charsAdded = TkNumUtfChars(value, byteCount); + int charsAdded = Tcl_NumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; char *newBytes; int code; @@ -899,8 +899,8 @@ DeleteChars( return TCL_OK; } - byteIndex = TkUtfAtIndex(string, index) - string; - byteCount = TkUtfAtIndex(string+byteIndex, count) - (string+byteIndex); + byteIndex = Tcl_UtfAtIndex(string, index) - string; + byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->entry.numBytes + 1 - byteCount; newBytes = (char *)ckalloc(newByteCount); @@ -1319,7 +1319,7 @@ static void EntryDisplay(void *clientData, Drawable d) if ((*(entryPtr->entry.displayString) == '\0') && (entryPtr->entry.placeholderObj != NULL)) { /* No text displayed, but -placeholder is given */ - if (TkGetCharLength(es.placeholderForegroundObj) > 0) { + if (Tcl_GetCharLength(es.placeholderForegroundObj) > 0) { foregroundObj = es.placeholderForegroundObj; } else { foregroundObj = es.foregroundObj; diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 716c477..fcc069b 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -55,17 +55,7 @@ const char *const ttkOrientStrings[] = { "horizontal", "vertical", NULL }; -#if !defined(TK_NO_DEPRECATED) && TK_MAJOR_VERSION < 9 int Ttk_GetOrientFromObj( - Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) -{ - *resultPtr = TTK_ORIENT_HORIZONTAL; - return Tcl_GetIndexFromObj(interp, objPtr, ttkOrientStrings, - "orientation", 0, resultPtr); -} -#endif - -int TtkGetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr) { int orient = (int)TTK_ORIENT_HORIZONTAL; diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 2104a2e..c71bf8f 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -54,11 +54,7 @@ static const Ttk_ElementOptionSpec TextElementOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(TextElement,foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) - offsetof(TextElement,underlineObj), "-1"}, -#else offsetof(TextElement,underlineObj), NULL}, -#endif { "-width", TK_OPTION_INT, offsetof(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, @@ -529,11 +525,7 @@ static const Ttk_ElementOptionSpec LabelElementOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) offsetof(LabelElement,text.underlineObj), "-1"}, -#else - offsetof(LabelElement,text.underlineObj), NULL}, -#endif { "-width", TK_OPTION_INT, offsetof(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 966f727..7c7e6a5 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1126,10 +1126,9 @@ static int NotebookIdentifyCommand( } break; case IDENTIFY_TAB: -#if !defined TK_NO_DEPRECATED && (TCL_MAJOR_VERSION < 9) - if (tabIndex >= 0) -#endif - Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); + if (tabIndex >= 0) { + Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); + } break; } return TCL_OK; @@ -1154,10 +1153,9 @@ static int NotebookIndexCommand( status = FindTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK) { -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) - if (index >= 0) -#endif - Tcl_SetObjResult(interp, TkNewIndexObj(index)); + if (index >= 0) { + Tcl_SetObjResult(interp, TkNewIndexObj(index)); + } } return status; diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index ff32306..09202c7 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -303,7 +303,7 @@ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr) /* Override requested width (height) based on -length and -orient */ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length); - TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient); + Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = length; @@ -376,7 +376,7 @@ static void ProgressbarDoLayout(void *recordPtr) Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); - TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient); + Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (pbar) { double fraction = value / maximum; diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c index 51acf3a..9d7d4fc 100644 --- a/generic/ttk/ttkStubInit.c +++ b/generic/ttk/ttkStubInit.c @@ -8,10 +8,6 @@ MODULE_SCOPE const TtkStubs ttkStubs; -#if defined(TK_NO_DEPRECATED) || TK_MAJOR_VERSION > 8 -#define Ttk_GetOrientFromObj 0 -#endif - #ifdef __GNUC__ /* * The rest of this file shouldn't warn about deprecated functions; they're diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 54c640e..bf8a5b7 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -367,9 +367,6 @@ typedef enum { /* -orient option values */ TTK_ORIENT_VERTICAL } Ttk_Orient; -MODULE_SCOPE int TtkGetOrientFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, Ttk_Orient *orient); - /*------------------------------------------------------------------------ * +++ Utilities. */ diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h index 37e9c83..79848d0 100644 --- a/generic/ttk/ttkThemeInt.h +++ b/generic/ttk/ttkThemeInt.h @@ -52,10 +52,6 @@ MODULE_SCOPE void TtkSetBlinkCursorTimes(Tcl_Interp* interp); MODULE_SCOPE int TtkBoxEqual(Ttk_Box, Ttk_Box); -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) -# define TTK_OPTION_UNDERLINE_DEF(type, field) "-1", offsetof(type, field), TCL_INDEX_NONE, 0, NULL -#else -# define TTK_OPTION_UNDERLINE_DEF(type, field) NULL, offsetof(type, field), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL -#endif +#define TTK_OPTION_UNDERLINE_DEF(type, field) NULL, offsetof(type, field), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL #endif /* _TTKTHEMEINT */ diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 884c1f3..5106909 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -3253,6 +3253,50 @@ static int TreeviewDetachCommand( return TCL_OK; } +/* Is an item detached? The root is never detached. */ +static int IsDetached(Treeview *tv, TreeItem *item) +{ + return item->next == NULL && item->prev == NULL && + item->parent == NULL && item != tv->tree.root; +} + +/* + $tv detached ?$item? -- + * List detached items (in arbitrary order) or query the detached state of + * $item. + */ +static int TreeviewDetachedCommand( + void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) +{ + Treeview *tv = (Treeview *)recordPtr; + TreeItem *item; + + if (objc == 2) { + /* List detached items */ + Tcl_HashSearch search; + Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(&tv->tree.items, &search); + Tcl_Obj *objPtr = Tcl_NewObj(); + + while (entryPtr != NULL) { + item = (TreeItem *)Tcl_GetHashValue(entryPtr); + entryPtr = Tcl_NextHashEntry(&search); + if (IsDetached(tv, item)) { + Tcl_ListObjAppendElement(NULL, objPtr, ItemID(tv, item)); + } + } + Tcl_SetObjResult(interp, objPtr); + return TCL_OK; + } else if (objc == 3) { + /* Query; the root is never reported as detached */ + if (!(item = FindItem(interp, tv, objv[2]))) { + return TCL_ERROR; + } + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(IsDetached(tv, item))); + return TCL_OK; + } else { + Tcl_WrongNumArgs(interp, 2, objv, "?item?"); + return TCL_ERROR; + } +} /* + $tv delete $items -- * Delete each item in $items. * @@ -4363,6 +4407,7 @@ static const Ttk_Ensemble TreeviewCommands[] = { { "configure", TtkWidgetConfigureCommand,0 }, { "delete", TreeviewDeleteCommand,0 }, { "detach", TreeviewDetachCommand,0 }, + { "detached", TreeviewDetachedCommand,0 }, { "drag", TreeviewDragCommand,0 }, { "drop", TreeviewDropCommand,0 }, { "exists", TreeviewExistsCommand,0 }, diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index e07f133..242ada3 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -482,7 +482,7 @@ Ttk_Layout TtkWidgetGetOrientedLayout( /* Prefix: */ - TtkGetOrientFromObj(NULL, orientObj, &orient); + Ttk_GetOrientFromObj(NULL, orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) Tcl_DStringAppend(&styleName, "Horizontal.", TCL_INDEX_NONE); else |