diff options
Diffstat (limited to 'generic')
35 files changed, 205 insertions, 272 deletions
diff --git a/generic/tk.h b/generic/tk.h index 9403f31..29c6fb9 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_MINOR_VERSION < 6) +# error Tk 8.6 must be compiled with tcl.h from Tcl 8.6 or better #endif #ifndef CONST84 @@ -59,8 +59,8 @@ extern "C" { * and update the version numbers: * * library/tk.tcl (1 LOC patch) - * unix/configure.ac (2 LOC Major, 2 LOC minor, 1 LOC patch) - * win/configure.ac (as above) + * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) + * win/configure.in (as above) * README (sections 0 and 1) * macosx/Tk-Common.xcconfig (not patchlevel) 1 LOC * win/README (not patchlevel) @@ -73,12 +73,12 @@ extern "C" { */ #define TK_MAJOR_VERSION 8 -#define TK_MINOR_VERSION 7 -#define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TK_RELEASE_SERIAL 0 +#define TK_MINOR_VERSION 6 +#define TK_RELEASE_LEVEL TCL_FINAL_RELEASE +#define TK_RELEASE_SERIAL 6 -#define TK_VERSION "8.7" -#define TK_PATCH_LEVEL "8.7a0" +#define TK_VERSION "8.6" +#define TK_PATCH_LEVEL "8.6.6" /* * A special definition used to allow this header file to be included from @@ -814,6 +814,9 @@ typedef struct Tk_FakeWin { int minReqWidth; int minReqHeight; char *dummy20; /* geometryMaster */ +#ifdef TK_USE_INPUT_METHODS + int dummy21; +#endif /* TK_USE_INPUT_METHODS */ } Tk_FakeWin; /* diff --git a/generic/tkBind.c b/generic/tkBind.c index bb95fa9..567c51f 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -1260,6 +1260,16 @@ Tk_BindEvent( } } + /* + * Ignore event types which are not in flagArray and all zeroes there. + * Most notably, NoExpose events can fill the ring buffer and disturb + * (thus masking out) event sequences of interest. + */ + + if ((eventPtr->type >= TK_LASTEVENT) || !flagArray[eventPtr->type]) { + return; + } + dispPtr = ((TkWindow *) tkwin)->dispPtr; bindInfoPtr = winPtr->mainPtr->bindInfo; @@ -2868,7 +2878,7 @@ GetAllVirtualEvents( * Any other fields in eventPtr which are not specified by the pattern * string or the optional arguments, are set to 0. * - * The event may be handled synchronously or asynchronously, depending on + * The event may be handled sychronously or asynchronously, depending on * the value specified by the optional "-when" option. The default * setting is synchronous. * @@ -3949,7 +3959,7 @@ ParseEventDescription( p = GetField(p, field, FIELD_SIZE); } if (*field != '\0') { - if ((*field >= '1') && (*field <= '9') && (field[1] == '\0')) { + if ((*field >= '1') && (*field <= '5') && (field[1] == '\0')) { if (eventFlags == 0) { patPtr->eventType = ButtonPress; eventMask = ButtonPressMask; diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index cbbc2b4..09ce98c 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -1136,7 +1136,9 @@ Tk_ConfigOutlineGC( if (mask && (dash->number != 0)) { gcValues->line_style = LineOnOffDash; gcValues->dash_offset = outline->offset; - if (dash->number > 0) { + if ((unsigned int)ABS(dash->number) > sizeof(char *)) { + gcValues->dashes = dash->pattern.pt[0]; + } else if (dash->number != 0) { gcValues->dashes = dash->pattern.array[0]; } else { gcValues->dashes = (char) (4 * width + 0.5); @@ -1340,7 +1342,9 @@ Tk_ResetOutlineGC( if ((dash->number > 2) || (dash->number < -1) || (dash->number==2 && (dash->pattern.array[0] != dash->pattern.array[1])) || ((dash->number == -1) && (dash->pattern.array[0] != ','))) { - if (dash->number > 0) { + if ((unsigned int)ABS(dash->number) > sizeof(char *)) { + dashList = dash->pattern.pt[0]; + } else if (dash->number != 0) { dashList = dash->pattern.array[0]; } else { dashList = (char) (4 * width + 0.5); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 093bd35..9c159e6 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -91,7 +91,7 @@ typedef struct TkOption { */ typedef struct OptionTable { - size_t refCount; /* Counts the number of uses of this table + int refCount; /* Counts the number of uses of this table * (the number of times Tk_CreateOptionTable * has returned it). This can be greater than * 1 if it is shared along several option @@ -103,7 +103,7 @@ typedef struct OptionTable { * templates, this points to the table * corresponding to the next template in the * chain. */ - size_t numOptions; /* The number of items in the options array + int numOptions; /* The number of items in the options array * below. */ Option options[1]; /* Information about the individual options in * the table. This must be the last field in @@ -177,7 +177,7 @@ Tk_CreateOptionTable( OptionTable *tablePtr; const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; - size_t numOptions, i; + int numOptions, i; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -330,9 +330,10 @@ Tk_DeleteOptionTable( { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; - size_t count; + int count; - if (tablePtr->refCount-- > 1) { + tablePtr->refCount--; + if (tablePtr->refCount > 0) { return; } @@ -977,7 +978,7 @@ GetOption( Option *bestPtr, *optionPtr; OptionTable *tablePtr2; const char *p1, *p2; - size_t count; + int count; /* * Search through all of the option tables in the chain to find the best @@ -1538,7 +1539,7 @@ Tk_FreeConfigOptions( { OptionTable *tablePtr; Option *optionPtr; - size_t count; + int count; Tcl_Obj **oldPtrPtr, *oldPtr; char *oldInternalPtr; const Tk_OptionSpec *specPtr; @@ -1732,7 +1733,7 @@ Tk_GetOptionInfo( Tcl_Obj *resultPtr; OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; - size_t count; + int count; /* * If information is only wanted for a single configuration spec, then @@ -2095,9 +2096,9 @@ TkDebugConfig( if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) { for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(tablePtr->refCount)); + Tcl_NewIntObj(tablePtr->refCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(tablePtr->numOptions)); + Tcl_NewIntObj(tablePtr->numOptions)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj( tablePtr->options[0].specPtr->optionName, -1)); } diff --git a/generic/tkConsole.c b/generic/tkConsole.c index fc60d5f..8bfbe9b 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -24,7 +24,7 @@ typedef struct ConsoleInfo { Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */ Tcl_Interp *interp; /* Interpreter controlled by console. */ - size_t refCount; + int refCount; } ConsoleInfo; /* @@ -452,7 +452,7 @@ Tk_CreateConsoleWindow( if (mainWindow) { Tk_DeleteEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); - if (info->refCount-- <= 1) { + if (--info->refCount <= 0) { ckfree(info); } } @@ -592,7 +592,7 @@ ConsoleClose( ConsoleInfo *info = data->info; if (info) { - if (info->refCount-- <= 1) { + if (--info->refCount <= 0) { /* * Assuming the Tcl_Interp * fields must already be NULL. */ @@ -881,7 +881,7 @@ InterpDeleteProc( Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); info->consoleInterp = NULL; } - if (info->refCount-- <= 1) { + if (--info->refCount <= 0) { ckfree(info); } } @@ -912,7 +912,7 @@ ConsoleDeleteProc( if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); } - if (info->refCount-- <= 1) { + if (--info->refCount <= 0) { ckfree(info); } } @@ -949,7 +949,7 @@ ConsoleEventProc( Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); } - if (info->refCount-- <= 1) { + if (--info->refCount <= 0) { ckfree(info); } } diff --git a/generic/tkDecls.h b/generic/tkDecls.h index eaaaf6c..64c32cd 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -1721,9 +1721,6 @@ extern const TkStubs *tkStubsPtr; #undef Tk_SafeInit #undef Tk_CreateConsoleWindow -#undef Tk_FreeXId -#define Tk_FreeXId(display,xid) - #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(int argc, wchar_t **argv, diff --git a/generic/tkEntry.c b/generic/tkEntry.c index acfdd31..9e25bed 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1176,15 +1176,13 @@ ConfigureEntry( if (entryPtr->type == TK_SPINBOX) { if (sbPtr->fromValue > sbPtr->toValue) { - /* - * Swap -from and -to values. - */ - - double tmpFromTo = sbPtr->fromValue; - - sbPtr->fromValue = sbPtr->toValue; - sbPtr->toValue = tmpFromTo; - } + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "-to value must be greater than -from value", + -1)); + Tcl_SetErrorCode(interp, "TK", "SPINBOX", "RANGE_SANITY", + NULL); + continue; + } if (sbPtr->reqFormat && (oldFormat != sbPtr->reqFormat)) { /* diff --git a/generic/tkFont.c b/generic/tkFont.c index a00c627..bec8807 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -41,7 +41,7 @@ typedef struct TkFontInfo { */ typedef struct NamedFont { - size_t refCount; /* Number of users of named font. */ + int refCount; /* Number of users of named font. */ int deletePending; /* Non-zero if font should be deleted when * last reference goes away. */ TkFontAttributes fa; /* Desired attributes for named font. */ @@ -1434,7 +1434,8 @@ Tk_FreeFont( */ nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr); - if ((nfPtr->refCount-- <= 1) && nfPtr->deletePending) { + nfPtr->refCount--; + if ((nfPtr->refCount == 0) && nfPtr->deletePending) { Tcl_DeleteHashEntry(fontPtr->namedHashPtr); ckfree(nfPtr); } @@ -1714,11 +1715,15 @@ Tk_PostscriptFontName( upper = 1; } src += TkUtfToUniChar(src, &ch); - if (upper) { - ch = Tcl_UniCharToUpper(ch); - upper = 0; + if (ch <= 0xffff) { + if (upper) { + ch = Tcl_UniCharToUpper(ch); + upper = 0; + } else { + ch = Tcl_UniCharToLower(ch); + } } else { - ch = Tcl_UniCharToLower(ch); + upper = 0; } dest += TkUniCharToUtf(ch, dest); } diff --git a/generic/tkGC.c b/generic/tkGC.c index c424e30..5663ede 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -314,6 +314,7 @@ Tk_FreeGC( gcPtr = Tcl_GetHashValue(idHashPtr); gcPtr->refCount--; if (gcPtr->refCount == 0) { + Tk_FreeXId(gcPtr->display, (XID) XGContextFromGC(gcPtr->gc)); XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); Tcl_DeleteHashEntry(idHashPtr); @@ -350,6 +351,12 @@ TkGCCleanup( entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { gcPtr = Tcl_GetHashValue(entryPtr); + /* + * This call is not needed, as it is only used on Unix to restore the + * Id to the stack pool, and we don't want to use them anymore. + * Tk_FreeXId(gcPtr->display, (XID) XGContextFromGC(gcPtr->gc)); + */ + XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); Tcl_DeleteHashEntry(entryPtr); diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index bd152f2..98aaeab 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -721,8 +721,7 @@ TkImgPhotoFree( PhotoInstance *instancePtr = clientData; ColorTable *colorPtr; - instancePtr->refCount -= 1; - if (instancePtr->refCount > 0) { + if (instancePtr->refCount-- > 1) { return; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 3e03f3d..1bd0142 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -409,7 +409,8 @@ ImgPhotoCmd( Tk_PhotoImageBlock block; Tk_Window tkwin; Tk_PhotoImageFormat *imageFormat; - int imageWidth, imageHeight, matched, length, oldformat = 0; + size_t length; + int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; ThreadSpecificData *tsdPtr = @@ -446,12 +447,13 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } - arg = Tcl_GetStringFromObj(objv[2], &length); - if (strncmp(arg,"-data", (unsigned) length) == 0) { + arg = Tcl_GetString(objv[2]); + length = objv[2]->length; + if (strncmp(arg,"-data", length) == 0) { if (masterPtr->dataString) { Tcl_SetObjResult(interp, masterPtr->dataString); } - } else if (strncmp(arg,"-format", (unsigned) length) == 0) { + } else if (strncmp(arg,"-format", length) == 0) { if (masterPtr->format) { Tcl_SetObjResult(interp, masterPtr->format); } @@ -495,9 +497,10 @@ ImgPhotoCmd( return TCL_OK; } else if (objc == 3) { - const char *arg = Tcl_GetStringFromObj(objv[2], &length); + const char *arg = Tcl_GetString(objv[2]); - if (length > 1 && !strncmp(arg, "-data", (unsigned) length)) { + length = objv[2]->length; + if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); if (masterPtr->dataString) { /* @@ -511,7 +514,7 @@ ImgPhotoCmd( } return TCL_OK; } else if (length > 1 && - !strncmp(arg, "-format", (unsigned) length)) { + !strncmp(arg, "-format", length)) { Tcl_AppendResult(interp, "-format {} {} {}", NULL); if (masterPtr->format) { /* @@ -1489,7 +1492,8 @@ ParseSubcommandOptions( * TK_PHOTO_COMPOSITE_* constants. */ NULL }; - int index, c, bit, currentBit, length; + size_t length; + int index, c, bit, currentBit; int values[4], numValues, maxValues, argIndex; const char *option, *expandedOption, *needed; const char *const *listPtr; @@ -1501,7 +1505,8 @@ ParseSubcommandOptions( * optPtr->name. */ - expandedOption = option = Tcl_GetStringFromObj(objv[index], &length); + expandedOption = option = Tcl_GetString(objv[index]); + length = objv[index]->length; if (option[0] != '-') { if (optPtr->name == NULL) { optPtr->name = objv[index]; @@ -1519,7 +1524,7 @@ ParseSubcommandOptions( currentBit = 1; for (listPtr = optionNames; *listPtr != NULL; ++listPtr) { if ((c == *listPtr[0]) - && (strncmp(option, *listPtr, (size_t) length) == 0)) { + && (strncmp(option, *listPtr, length) == 0)) { expandedOption = *listPtr; if (bit != 0) { goto unknownOrAmbiguousOption; @@ -1535,7 +1540,11 @@ ParseSubcommandOptions( */ if (!(allowedOptions & bit)) { - goto unknownOrAmbiguousOption; + if (optPtr->name != NULL) { + goto unknownOrAmbiguousOption; + } + optPtr->name = objv[index]; + continue; } /* @@ -1765,7 +1774,8 @@ ImgPhotoConfigureMaster( const char *oldFileString, *oldPaletteString; Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL; Tcl_Obj *tempdata, *tempformat; - int length, i, j, result, imageWidth, imageHeight, oldformat; + size_t length; + int i, j, result, imageWidth, imageHeight, oldformat; double oldGamma; Tcl_Channel chan; Tk_PhotoImageFormat *imageFormat; @@ -1773,10 +1783,11 @@ ImgPhotoConfigureMaster( args = ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { - args[j] = Tcl_GetStringFromObj(objv[i], &length); + args[j] = Tcl_GetString(objv[i]); + length = objv[i]->length; if ((length > 1) && (args[j][0] == '-')) { if ((args[j][1] == 'd') && - !strncmp(args[j], "-data", (size_t) length)) { + !strncmp(args[j], "-data", length)) { if (++i < objc) { data = objv[i]; j--; @@ -1789,7 +1800,7 @@ ImgPhotoConfigureMaster( return TCL_ERROR; } } else if ((args[j][1] == 'f') && - !strncmp(args[j], "-format", (size_t) length)) { + !strncmp(args[j], "-format", length)) { if (++i < objc) { format = objv[i]; j--; @@ -1852,9 +1863,10 @@ ImgPhotoConfigureMaster( * Force into ByteArray format, which most (all) image handlers will * use anyway. Empty length means ignore the -data option. */ + int bytesize; - (void) Tcl_GetByteArrayFromObj(data, &length); - if (length) { + (void) Tcl_GetByteArrayFromObj(data, &bytesize); + if (bytesize) { Tcl_IncrRefCount(data); } else { data = NULL; @@ -1870,8 +1882,8 @@ ImgPhotoConfigureMaster( * object. */ - (void) Tcl_GetStringFromObj(format, &length); - if (length) { + (void) Tcl_GetString(format); + if (format->length) { Tcl_IncrRefCount(format); } else { format = NULL; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 7f5389c..d24516f 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -38,7 +38,7 @@ * implemented using menu clones. Menu clones are full menus in their own * right; they have a Tk window and pathname associated with them; they have a * TkMenu structure and array of entries. However, they are linked with the - * original menu that they were cloned from. They reflect the attributes of the + * original menu that they were cloned from. The reflect the attributes of the * original, or "master", menu. So if an item is added to a menu, and that * menu has clones, then the item must be added to all of its clones also. * Menus are cloned when a menu is torn-off or when a menu is assigned as a diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 74b3964..ab9018a 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -26,7 +26,7 @@ typedef struct { int charOffset; /* The offset of the next char to retrieve. */ int byteOffset; /* The expected byte offset of the next * chunk. */ - char buffer[4]; /* A buffer to hold part of a UTF character + char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character * that is split across chunks. */ char command[1]; /* Command to invoke. Actual space is * allocated as large as necessary. This must diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index ffe7b75..9411c26 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -38,15 +38,6 @@ MODULE_SCOPE const TkStubs tkStubs; */ #undef Tk_MainEx -#undef Tk_FreeXId - -static void -doNothing(void) -{ - /* dummy implementation, no need to do anything */ -} - -#define Tk_FreeXId ((void (*)(Display *, XID)) doNothing) #ifdef _WIN32 diff --git a/generic/tkTest.c b/generic/tkTest.c index faba89d..fa9e073 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -227,7 +227,7 @@ Tktest_Init( { static int initialized = 0; - if (Tcl_InitStubs(interp, "8.6", 0) == NULL) { + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; } if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { @@ -239,7 +239,7 @@ Tktest_Init( */ if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) { - return TCL_ERROR; + return TCL_ERROR; } Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL); diff --git a/generic/tkText.c b/generic/tkText.c index 8ae17a5..6ff1db9 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1570,8 +1570,7 @@ TextWidgetObjCmd( } done: - textPtr->refCount--; - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } return result; @@ -1964,9 +1963,7 @@ DestroyText( * portion of the text widget. */ - sharedTextPtr->refCount--; - - if (sharedTextPtr->refCount > 0) { + if (sharedTextPtr->refCount-- > 1) { TkBTreeRemoveClient(sharedTextPtr->tree, textPtr); /* @@ -2042,13 +2039,12 @@ DestroyText( } textPtr->tkwin = NULL; - textPtr->refCount--; Tcl_DeleteCommandFromToken(textPtr->interp, textPtr->widgetCmd); if (textPtr->afterSyncCmd){ Tcl_DecrRefCount(textPtr->afterSyncCmd); textPtr->afterSyncCmd = NULL; } - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } } @@ -2774,9 +2770,6 @@ TextPushUndoAction( { TkUndoSubAtom *iAtom, *dAtom; int canUndo, canRedo; - char lMarkName[20] = "tk::undoMarkL"; - char rMarkName[20] = "tk::undoMarkR"; - char stringUndoMarkId[7] = ""; /* * Create the helpers. @@ -2787,10 +2780,6 @@ TextPushUndoAction( Tcl_Obj *markSet2InsertObj = NULL; Tcl_Obj *insertCmdObj = Tcl_NewObj(); Tcl_Obj *deleteCmdObj = Tcl_NewObj(); - Tcl_Obj *markSetLUndoMarkCmdObj = Tcl_NewObj(); - Tcl_Obj *markSetRUndoMarkCmdObj = NULL; - Tcl_Obj *markGravityLUndoMarkCmdObj = Tcl_NewObj(); - Tcl_Obj *markGravityRUndoMarkCmdObj = NULL; /* * Get the index positions. @@ -2840,40 +2829,6 @@ TextPushUndoAction( Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj); - Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, - Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1)); - Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, - Tcl_NewStringObj("mark", 4)); - Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, - Tcl_NewStringObj("set", 3)); - markSetRUndoMarkCmdObj = Tcl_DuplicateObj(markSetLUndoMarkCmdObj); - textPtr->sharedTextPtr->undoMarkId++; - sprintf(stringUndoMarkId, "%d", textPtr->sharedTextPtr->undoMarkId); - strcat(lMarkName, stringUndoMarkId); - strcat(rMarkName, stringUndoMarkId); - Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, - Tcl_NewStringObj(lMarkName, -1)); - Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, - Tcl_NewStringObj(rMarkName, -1)); - Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, index1Obj); - Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, index2Obj); - - Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, - Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1)); - Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, - Tcl_NewStringObj("mark", 4)); - Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, - Tcl_NewStringObj("gravity", 7)); - markGravityRUndoMarkCmdObj = Tcl_DuplicateObj(markGravityLUndoMarkCmdObj); - Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, - Tcl_NewStringObj(lMarkName, -1)); - Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, - Tcl_NewStringObj(rMarkName, -1)); - Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, - Tcl_NewStringObj("left", 4)); - Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, - Tcl_NewStringObj("right", 5)); - /* * Note: we don't wish to use textPtr->widgetCmd in these callbacks * because if we delete the textPtr, but peers still exist, we will then @@ -2891,19 +2846,11 @@ TextPushUndoAction( insertCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom); - TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, iAtom); - TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, iAtom); - TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, iAtom); - TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, iAtom); dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, deleteCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom); - TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, dAtom); - TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, dAtom); - TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, dAtom); - TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, dAtom); Tcl_DecrRefCount(seeInsertObj); Tcl_DecrRefCount(index1Obj); @@ -5118,8 +5065,6 @@ TextEditUndo( TkText *textPtr) /* Overall information about text widget. */ { int status; - Tcl_Obj *cmdObj; - int code; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; @@ -5143,22 +5088,6 @@ TextEditUndo( } textPtr->sharedTextPtr->undo = 1; - /* - * Convert undo/redo temporary marks set by TkUndoRevert() into - * indices left in the interp result. - */ - - cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", - 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_DecrRefCount(cmdObj); - return status; } @@ -5184,8 +5113,6 @@ TextEditRedo( TkText *textPtr) /* Overall information about text widget. */ { int status; - Tcl_Obj *cmdObj; - int code; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; @@ -5208,23 +5135,6 @@ TextEditRedo( textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; - - /* - * Convert undo/redo temporary marks set by TkUndoApply() into - * indices left in the interp result. - */ - - cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", - 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_DecrRefCount(cmdObj); - return status; } @@ -5612,7 +5522,7 @@ RunAfterSyncCmd( * The widget has been deleted. Don't do anything. */ - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree((char *) textPtr); } return; diff --git a/generic/tkText.h b/generic/tkText.h index 430c96b..5d88784 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -580,8 +580,6 @@ typedef struct TkSharedText { * statements. */ int autoSeparators; /* Non-zero means the separators will be * inserted automatically. */ - int undoMarkId; /* Counts undo marks temporarily used during - undo and redo operations. */ int isDirty; /* Flag indicating the 'dirtyness' of the * text widget. If the flag is not zero, * unsaved modifications have been applied to diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 1c4925d..371e910 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -610,7 +610,7 @@ static void AsyncUpdateLineMetrics(ClientData clientData); static void GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync); static void AsyncUpdateYScrollbar(ClientData clientData); static int IsStartOfNotMergedLine(TkText *textPtr, - const TkTextIndex *indexPtr); + CONST TkTextIndex *indexPtr); /* * Result values returned by TextGetScrollInfoObj: @@ -3005,7 +3005,7 @@ AsyncUpdateLineMetrics( * The widget has been deleted, or is not mapped. Don't do anything. */ - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } return; @@ -3080,8 +3080,7 @@ AsyncUpdateLineMetrics( GenerateWidgetViewSyncEvent(textPtr, 1); - textPtr->refCount--; - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } return; @@ -4163,7 +4162,7 @@ DisplayText( textPtr->refCount++; dInfoPtr->flags &= ~REPICK_NEEDED; TkTextPickCurrent(textPtr, &textPtr->pickEvent); - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); goto end; } @@ -4299,8 +4298,9 @@ DisplayText( if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x, oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY, damageRgn)) { +#ifndef MAC_OSX_TK TextInvalidateRegion(textPtr, damageRgn); - +#endif } numCopies++; TkDestroyRegion(damageRgn); @@ -6752,7 +6752,7 @@ AsyncUpdateYScrollbar( GetYView(textPtr->interp, textPtr, 1); } - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } } @@ -6890,7 +6890,7 @@ FindDLine( static int IsStartOfNotMergedLine( TkText *textPtr, /* Widget record for text widget. */ - const TkTextIndex *indexPtr) /* Index to check. */ + CONST TkTextIndex *indexPtr) /* Index to check. */ { TkTextIndex indexPtr2; @@ -7819,7 +7819,7 @@ CharChunkMeasureChars( MeasureChars(tkfont, chars, charsLen, 0, bstart, 0, -1, 0, &widthUntilStart); - xDisplacement = startX - widthUntilStart - chunkPtr->x; + xDisplacement = startX - widthUntilStart - ciPtr->baseChunkPtr->x; } fit = MeasureChars(tkfont, chars, charsLen, 0, bend, @@ -8793,7 +8793,7 @@ FinalizeBaseChunk( #if TK_DRAW_IN_CONTEXT newwidth = 0; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth); - if (newwidth != chunkPtr->width) { + if (newwidth < chunkPtr->width) { widthAdjust += newwidth - chunkPtr->width; chunkPtr->width = newwidth; } @@ -8981,13 +8981,13 @@ RemoveFromBaseChunk( bciPtr = baseCharChunkPtr->clientData; -#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS if ((ciPtr->baseOffset + ciPtr->numBytes) != Tcl_DStringLength(&bciPtr->baseChars)) { +#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS fprintf(stderr,"RemoveFromBaseChunk called with wrong chunk " "(not last)\n"); - } #endif + } Tcl_DStringSetLength(&bciPtr->baseChars, ciPtr->baseOffset); diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 7aebc84..faa1afd 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -40,9 +40,9 @@ static const char * StartEnd(TkText *textPtr, const char *string, static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); -static int IndexCountBytesOrdered(const TkText *textPtr, - const TkTextIndex *indexPtr1, - const TkTextIndex *indexPtr2); +static int IndexCountBytesOrdered(CONST TkText *textPtr, + CONST TkTextIndex *indexPtr1, + CONST TkTextIndex *indexPtr2); /* * The "textindex" Tcl_Obj definition: @@ -87,7 +87,7 @@ FreeTextIndexInternalRep( TkTextIndex *indexPtr = GET_TEXTINDEX(indexObjPtr); if (indexPtr->textPtr != NULL) { - if (--indexPtr->textPtr->refCount == 0) { + if (indexPtr->textPtr->refCount-- <= 1) { /* * The text widget has been deleted and we need to free it now. */ @@ -1636,9 +1636,9 @@ TkTextIndexForwChars( int TkTextIndexCountBytes( - const TkText *textPtr, - const TkTextIndex *indexPtr1, /* Index describing one location. */ - const TkTextIndex *indexPtr2) /* Index describing second location. */ + CONST TkText *textPtr, + CONST TkTextIndex *indexPtr1, /* Index describing one location. */ + CONST TkTextIndex *indexPtr2) /* Index describing second location. */ { int compare = TkTextIndexCmp(indexPtr1, indexPtr2); @@ -1653,11 +1653,11 @@ TkTextIndexCountBytes( static int IndexCountBytesOrdered( - const TkText *textPtr, - const TkTextIndex *indexPtr1, + CONST TkText *textPtr, + CONST TkTextIndex *indexPtr1, /* Index describing location of character from * which to count. */ - const TkTextIndex *indexPtr2) + CONST TkTextIndex *indexPtr2) /* Index describing location of last character * at which to stop the count. */ { diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index dd3127d..d9329f5 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1258,8 +1258,7 @@ TkTextFreeTag( if (textPtr != tagPtr->textPtr) { Tcl_Panic("Tag being deleted from wrong widget"); } - textPtr->refCount--; - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } tagPtr->textPtr = NULL; @@ -1522,7 +1521,7 @@ TkTextBindProc( } done: - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } } diff --git a/generic/tkUtil.c b/generic/tkUtil.c index d89282f..e686826 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1187,7 +1187,7 @@ TkSendVirtualEvent( event.general.xany.display = Tk_Display(target); event.virtual.name = Tk_GetUid(eventName); if (detail != NULL) { - event.virtual.user_data = detail; + event.virtual.user_data = detail; } Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 85c5590..e4d696b 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1486,8 +1486,7 @@ Tk_DestroyWindow( winPtr->mainPtr->deletionEpoch++; } - winPtr->mainPtr->refCount--; - if (winPtr->mainPtr->refCount == 0) { + if (winPtr->mainPtr->refCount-- <= 1) { register const TkCmd *cmdPtr; /* diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index b44eeb5..15ebcb7 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -7,8 +7,8 @@ #include <tk.h> #include "ttkTheme.h" -/* - * Under windows, the Tk-provided XDrawLine and XDrawArc have an +/* + * Under windows, the Tk-provided XDrawLine and XDrawArc have an * off-by-one error in the end point. This is especially apparent with this * theme. Defining this macro as true handles this case. */ @@ -123,8 +123,8 @@ static Ttk_ElementOptionSpec BorderElementOptions[] = { /* * <<NOTE-BORDERWIDTH>>: -borderwidth is only partially supported: * in this theme, borders are always exactly 2 pixels thick. - * With -borderwidth 0, border is not drawn at all; - * otherwise a 2-pixel border is used. For -borderwidth > 2, + * With -borderwidth 0, border is not drawn at all; + * otherwise a 2-pixel border is used. For -borderwidth > 2, * the excess is used as padding. */ @@ -402,7 +402,7 @@ typedef struct { static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, - Tk_Offset(MenuIndicatorElement,sizeObj), + Tk_Offset(MenuIndicatorElement,sizeObj), STR(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, Tk_Offset(MenuIndicatorElement,colorObj), @@ -630,7 +630,7 @@ static void ThumbElementDraw( Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); - + if (orient == TTK_ORIENT_HORIZONTAL) { dx = 1; dy = 0; x1 = x2 = b.x + b.width / 2 - gripCount; @@ -710,12 +710,12 @@ static void PbarElementDraw( Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; - + b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); - XFillRectangle(Tk_Display(tkwin), d, + XFillRectangle(Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); } @@ -780,8 +780,8 @@ static Ttk_ElementSpec ArrowElementSpec = { /*------------------------------------------------------------------------ * +++ Notebook elements. - * - * Note: Tabs, except for the rightmost, overlap the neighbor to + * + * Note: Tabs, except for the rightmost, overlap the neighbor to * their right by one pixel. */ diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index d16cb85..2fbcd76 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -68,7 +68,7 @@ static Ttk_ElementSpec HighlightElementSpec = /*------------------------------------------------------------------------ * +++ Button Border element: - * + * * The Motif-style button border on X11 consists of (from outside-in): * * + focus indicator (controlled by -highlightcolor and -highlightthickness), @@ -85,13 +85,13 @@ typedef struct { static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { - { "-background", TK_OPTION_BORDER, + { "-background", TK_OPTION_BORDER, Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND }, - { "-borderwidth", TK_OPTION_PIXELS, + { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { "-relief", TK_OPTION_RELIEF, + { "-relief", TK_OPTION_RELIEF, Tk_Offset(ButtonBorderElement,reliefObj), "flat" }, - { "-default", TK_OPTION_ANY, + { "-default", TK_OPTION_ANY, Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" }, { NULL, 0, 0, NULL } }; @@ -115,7 +115,7 @@ static void ButtonBorderElementSize( /* * (@@@ Note: ButtonBorderElement still still still buggy: - * padding for default ring is drawn in the wrong color + * padding for default ring is drawn in the wrong color * when the button is active.) */ static void ButtonBorderElementDraw( @@ -281,19 +281,19 @@ static Ttk_ElementSpec ArrowElementSpec = /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * - * NOTES: + * NOTES: * * panedwindows with -orient horizontal use vertical sashes, and vice versa. * * Interpretation of -sashrelief 'groove' and 'ridge' are * swapped wrt. the core panedwindow, which (I think) has them backwards. * - * Default -sashrelief is sunken; the core panedwindow has default + * Default -sashrelief is sunken; the core panedwindow has default * -sashrelief raised, but that looks wrong to me. */ static Ttk_Orient SashClientData[] = { - TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL + TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL }; typedef struct { @@ -306,13 +306,13 @@ typedef struct { } SashElement; static Ttk_ElementOptionSpec SashOptions[] = { - { "-background", TK_OPTION_BORDER, + { "-background", TK_OPTION_BORDER, Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND }, - { "-sashrelief", TK_OPTION_RELIEF, + { "-sashrelief", TK_OPTION_RELIEF, Tk_Offset(SashElement,sashReliefObj), "sunken" }, { "-sashthickness", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashThicknessObj), "6" }, - { "-sashpad", TK_OPTION_PIXELS, + { "-sashpad", TK_OPTION_PIXELS, Tk_Offset(SashElement,sashPadObj), "2" }, { "-handlesize", TK_OPTION_PIXELS, Tk_Offset(SashElement,handleSizeObj), "8" }, @@ -367,10 +367,10 @@ static void SashElementDraw( gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); break; - case TK_RELIEF_SOLID: + case TK_RELIEF_SOLID: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; - case TK_RELIEF_FLAT: + case TK_RELIEF_FLAT: default: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); break; @@ -398,7 +398,7 @@ static void SashElementDraw( hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N); hb.y += handlePad; } - Tk_Fill3DRectangle(tkwin, d, border, + Tk_Fill3DRectangle(tkwin, d, border, hb.x, hb.y, hb.width, hb.height, 1, TK_RELIEF_RAISED); } } @@ -495,7 +495,7 @@ MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); - Ttk_RegisterElement(interp, theme, "hsash", + Ttk_RegisterElement(interp, theme, "hsash", &SashElementSpec, &SashClientData[0]); Ttk_RegisterElement(interp, theme, "vsash", &SashElementSpec, &SashClientData[1]); diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index b8b7f29..1037840 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -139,7 +139,7 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); - /* + /* * Place text according to -anchor: */ Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor); @@ -342,15 +342,15 @@ static void ImageDraw( Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y); - /* If we're disabled there's no state-specific 'disabled' image, + /* If we're disabled there's no state-specific 'disabled' image, * stipple the image. * @@@ Possibly: Don't do disabled-stippling at all; * @@@ it's ugly and out of fashion. - * Do not stipple at all under Aqua, just draw the image: it shows up + * Do not stipple at all under Aqua, just draw the image: it shows up * as a white rectangle otherwise. */ - + if (state & TTK_STATE_DISABLED) { if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) { #ifndef MAC_OSX_TK @@ -577,7 +577,7 @@ static void LabelElementSize( if (label->compound != TTK_COMPOUND_IMAGE) textReqWidth = TextReqWidth(&label->text); - switch (label->compound) + switch (label->compound) { case TTK_COMPOUND_TEXT: *widthPtr = textReqWidth; @@ -588,11 +588,11 @@ static void LabelElementSize( case TTK_COMPOUND_TOP: case TTK_COMPOUND_BOTTOM: case TTK_COMPOUND_CENTER: - *widthPtr = MAX(label->image.width, textReqWidth); + *widthPtr = MAX(label->image.width, textReqWidth); break; case TTK_COMPOUND_LEFT: case TTK_COMPOUND_RIGHT: - *widthPtr = label->image.width + textReqWidth + label->space; + *widthPtr = label->image.width + textReqWidth + label->space; break; case TTK_COMPOUND_NONE: break; /* Can't happen */ diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index 031fdec..24a0fb1 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -320,7 +320,7 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( - mgr->managerData, slaveIndex, reqWidth, reqHeight)) + mgr->managerData, slaveIndex, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index 07fcea1..d22ff98 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -22,7 +22,7 @@ typedef struct TtkManager_ Ttk_Manager; * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this * routine is called. - * + * * SlaveRequest() is called when a slave requests a size change. * It should return 1 if the request should propagate, 0 otherwise. */ diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index eed90ec..4dc50a2 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -398,7 +398,7 @@ static int ProgressbarStepCommand( { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; - Tcl_Obj *newValueObj; + Tcl_Obj *newValueObj; if (objc == 3) { if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) { @@ -424,7 +424,7 @@ static int ProgressbarStepCommand( TtkRedisplayWidget(&pb->core); - /* Update value by setting the linked -variable, if there is one: + /* Update value by setting the linked -variable, if there is one: */ if (pb->progress.variableTrace) { return Tcl_ObjSetVar2( @@ -444,7 +444,7 @@ static int ProgressbarStepCommand( } /* $sb start|stop ?args? -- - * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] + * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] * and pass to interpreter. */ static int ProgressbarStartStopCommand( diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 95824af..69753d1 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -46,14 +46,14 @@ typedef struct static Tk_OptionSpec ScaleOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", - Tk_Offset(Scale,scale.commandObj), -1, + Tk_Offset(Scale,scale.commandObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", - Tk_Offset(Scale,scale.variableObj), -1, + Tk_Offset(Scale,scale.variableObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Scale,scale.orientObj), - Tk_Offset(Scale,scale.orient), 0, + Tk_Offset(Scale,scale.orient), 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", @@ -63,7 +63,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] = {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", - DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, + DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, @@ -76,7 +76,7 @@ static double PointToValue(Scale *scalePtr, int x, int y); /* ScaleVariableChanged -- * Variable trace procedure for scale -variable; * Updates the scale's value. - * If the linked variable is not a valid double, + * If the linked variable is not a valid double, * sets the 'invalid' state. */ static void ScaleVariableChanged(void *recordPtr, const char *value) @@ -172,7 +172,7 @@ static int ScalePostConfigure( /* ScaleGetLayout -- * getLayout hook. */ -static Ttk_Layout +static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scale *scalePtr = recordPtr; @@ -236,7 +236,7 @@ static double ScaleFraction(Scale *scalePtr, double value) } /* $scale get ?x y? -- - * Returns the current value of the scale widget, or if $x and + * Returns the current value of the scale widget, or if $x and * $y are specified, the value represented by point @x,y. */ static int diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 9d99ea5..5b0c212 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -22,7 +22,7 @@ typedef struct double first; /* top fraction */ double last; /* bottom fraction */ - Ttk_Box troughBox; /* trough parcel */ + Ttk_Box troughBox; /* trough parcel */ int minSize; /* minimum size of thumb */ } ScrollbarPart; @@ -50,7 +50,7 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] = * +++ Widget hooks. */ -static void +static void ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) { Scrollbar *sb = recordPtr; @@ -241,7 +241,7 @@ ScrollbarDeltaCommand( /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the - * point given by x and y lies in the trough area of the scrollbar. + * point given by x and y lies in the trough area of the scrollbar. */ static int ScrollbarFractionCommand( diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index 7837310..d002f2f 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -56,24 +56,24 @@ static Tk_OptionSpec SquareOptionSpecs[] = {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj), -1, 0, 0, 0}, - + {TK_OPTION_PIXELS, "-width", "width", "Width", "50", Tk_Offset(Square,square.widthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_PIXELS, "-height", "height", "Height", "50", Tk_Offset(Square,square.heightObj), -1, 0, 0, GEOMETRY_CHANGED}, - + {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, - Tk_Offset(Square,square.paddingObj), -1, + Tk_Offset(Square,square.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, - + {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, - + {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, - + WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; @@ -138,7 +138,7 @@ static const Ttk_Ensemble SquareCommands[] = { }; /* - * The Widget specification structure holds all the implementation + * The Widget specification structure holds all the implementation * information about this widget and this is what must be registered * with Tk in the package initialization code (see bottom). */ @@ -159,7 +159,7 @@ static WidgetSpec SquareWidgetSpec = TtkWidgetDisplay /* displayProc */ }; -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- * Square element * * In this section we demonstrate what is required to create a new themed @@ -176,7 +176,7 @@ typedef struct Tcl_Obj *heightObj; } SquareElement; -static Ttk_ElementOptionSpec SquareElementOptions[] = +static Ttk_ElementOptionSpec SquareElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj), DEFAULT_BACKGROUND }, @@ -248,7 +248,7 @@ static Ttk_ElementSpec SquareElementSpec = * engine is similar to the Tk pack geometry manager. Read the documentation * for the details. In this example we just need to have the square element * that has been defined for this widget placed on a background. We will - * also need some padding to keep it away from the edges. + * also need some padding to keep it away from the edges. */ TTK_BEGIN_LAYOUT(SquareLayout) @@ -257,12 +257,12 @@ TTK_BEGIN_LAYOUT(SquareLayout) TTK_NODE("Square.square", 0)) TTK_END_LAYOUT -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- * * Widget initialization. * * This file defines a new element and a new widget. We need to register - * the element with the themes that will need it. In this case we will + * the element with the themes that will need it. In this case we will * register with the default theme that is the root of the theme inheritance * tree. This means all themes will find this element. * We then need to register the widget class style. This is the layout @@ -287,10 +287,10 @@ TtkSquareWidget_Init(Tcl_Interp *interp) /* register the new elements for this theme engine */ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL); - + /* register the layout for this theme */ Ttk_RegisterLayout(theme, "TSquare", SquareLayout); - + /* register the widget */ RegisterWidget(interp, "ttk::square", &SquareWidgetSpec); diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c index c17f1e9..2c07b9d 100644 --- a/generic/ttk/ttkStubLib.c +++ b/generic/ttk/ttkStubLib.c @@ -67,7 +67,7 @@ error: "Error loading ", packageName, " package", " (requested version '", version, "', loaded version '", actualVersion, "'): ", - errMsg, + errMsg, NULL); return NULL; } diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index 31798ea..f2108b9 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -188,7 +188,7 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) return 0; } } - tagset->tags = ckrealloc(tagset->tags, + tagset->tags = ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index c0f17cf..ba66db4 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -3,7 +3,7 @@ * * Simplified interface to Tcl_TraceVariable. * - * PROBLEM: Can't distinguish "variable does not exist" (which is OK) + * PROBLEM: Can't distinguish "variable does not exist" (which is OK) * from other errors (which are not). */ diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 798bcce..e4dd712 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -111,8 +111,8 @@ MODULE_SCOPE int TtkWidgetConstructorObjCmd( /* WIDGET_TAKEFOCUS_TRUE -- * WIDGET_TAKEFOCUS_FALSE -- - * Add one or the other of these to each OptionSpecs table - * to indicate whether the widget should take focus + * Add one or the other of these to each OptionSpecs table + * to indicate whether the widget should take focus * during keyboard traversal. */ #define WIDGET_TAKEFOCUS_TRUE \ |