From d9aeb17bc875cb8fc6d1575fd094c619385526e7 Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 5 Mar 2021 16:15:21 +0000 Subject: Fix [58222c42b3]: ttk::entry has wrong default background/fieldbackground --- library/ttk/aquaTheme.tcl | 4 ++++ macosx/tkMacOSXDefault.h | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 3ccdd70..bba1aae 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -42,6 +42,10 @@ namespace eval ttk::theme::aqua { # so we only need to specify !focus.) # Entry + ttk::style configure TEntry \ + -foreground systemTextColor \ + -background systemTextBackgroundColor \ + -fieldbackground systemTextBackgroundColor ttk::style map TEntry \ -foreground { disabled systemDisabledControlTextColor diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index af0a06b..334fa0a 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -173,17 +173,17 @@ #define DEF_ENTRY_EXPORT_SELECTION "1" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG -#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG +#define DEF_ENTRY_HIGHLIGHT_BG TEXT_BG #define DEF_ENTRY_HIGHLIGHT BLACK #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" -#define DEF_ENTRY_INSERT_BG NORMAL_FG +#define DEF_ENTRY_INSERT_BG TEXT_BG #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "1" #define DEF_ENTRY_JUSTIFY "left" -#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG +#define DEF_ENTRY_READONLY_BG_COLOR TEXT_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" @@ -500,8 +500,8 @@ #define DEF_TEXT_EXPORT_SELECTION "1" #define DEF_TEXT_FONT "TkFixedFont" #define DEF_TEXT_HEIGHT "24" -#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG -#define DEF_TEXT_HIGHLIGHT BLACK +#define DEF_TEXT_HIGHLIGHT_BG TEXT_BG +#define DEF_TEXT_HIGHLIGHT NORMAL_FG #define DEF_TEXT_HIGHLIGHT_WIDTH "3" #define DEF_TEXT_INSERT_BG NORMAL_FG #define DEF_TEXT_INSERT_BD_COLOR "0" -- cgit v0.12 From cb689d388a07704cc34424caf91ff48bf6a3953b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Mar 2021 13:52:05 +0000 Subject: Eliminate "register" keyword. Use more TCL_UNUSED() --- generic/tkArgv.c | 6 +-- generic/tkButton.c | 10 ++--- generic/tkCanvUtil.c | 10 ++--- generic/tkColor.c | 2 +- generic/tkConfig.c | 2 +- generic/tkCursor.c | 4 +- generic/tkEntry.c | 24 +++++------ generic/tkFileFilter.c | 2 +- generic/tkFocus.c | 2 +- generic/tkFrame.c | 20 ++++----- generic/tkGC.c | 8 ++-- generic/tkImgGIF.c | 12 +++--- generic/tkImgPNG.c | 4 +- generic/tkListbox.c | 44 +++++++++---------- generic/tkMacWinMenu.c | 2 +- generic/tkMenu.c | 16 +++---- generic/tkMenuDraw.c | 18 ++++---- generic/tkMenubutton.c | 12 +++--- generic/tkMessage.c | 16 +++---- generic/tkObj.c | 6 +-- generic/tkScale.c | 20 ++++----- generic/tkSquare.c | 2 +- generic/tkTrig.c | 16 +++---- generic/tkWindow.c | 58 ++++++++++++------------- win/tkWinButton.c | 22 +++++----- win/tkWinScrlbr.c | 20 ++++----- win/tkWinWm.c | 113 +++++++++++++++++-------------------------------- 27 files changed, 218 insertions(+), 253 deletions(-) diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 6c2c5c5..8fe8514 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -67,12 +67,12 @@ Tk_ParseArgv( int flags) /* Or'ed combination of various flag bits, * such as TK_ARGV_NO_DEFAULTS. */ { - register const Tk_ArgvInfo *infoPtr; + const Tk_ArgvInfo *infoPtr; /* Pointer to the current entry in the table * of argument descriptions. */ const Tk_ArgvInfo *matchPtr;/* Descriptor that matches current argument. */ const char *curArg; /* Current argument */ - register char c; /* Second character of current arg (used for + char c; /* Second character of current arg (used for * quick check for matching; use 2nd char. * because first char. will almost always be * '-'). */ @@ -338,7 +338,7 @@ PrintUsage( * this word, then don't generate information * for default options. */ { - register const Tk_ArgvInfo *infoPtr; + const Tk_ArgvInfo *infoPtr; size_t width, i, numSpaces; Tcl_Obj *message; diff --git a/generic/tkButton.c b/generic/tkButton.c index 3c15bf6..4b04e9f 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -1036,7 +1036,7 @@ DestroyButton( static int ConfigureButton( Tcl_Interp *interp, /* Used for error reporting. */ - register TkButton *butPtr, /* Information about widget; may or may + TkButton *butPtr, /* Information about widget; may or may * not already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -1612,7 +1612,7 @@ ButtonVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = clientData; const char *value; Tcl_Obj *valuePtr; @@ -1817,7 +1817,7 @@ ButtonImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = clientData; if (butPtr->tkwin != NULL) { TkpComputeButtonGeometry(butPtr); @@ -1855,7 +1855,7 @@ ButtonSelectImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = clientData; #ifdef MAC_OSX_TK if (butPtr->tkwin != NULL) { @@ -1902,7 +1902,7 @@ ButtonTristateImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = clientData; #ifdef MAC_OSX_TK if (butPtr->tkwin != NULL) { diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index 1feef73..65af3da 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -332,7 +332,7 @@ Tk_CanvasSetOffset( * redisplaying the canvas. */ Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/ { - register TkCanvas *canvasPtr = Canvas(canvas); + TkCanvas *canvasPtr = Canvas(canvas); int flags = 0; int x = - canvasPtr->drawableXOrigin; int y = - canvasPtr->drawableYOrigin; @@ -406,7 +406,7 @@ Tk_CanvasTagsParseProc( char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item (ignored). */ { - register Tk_Item *itemPtr = (Tk_Item *) widgRec; + Tk_Item *itemPtr = (Tk_Item *) widgRec; int argc, i; const char **argv; Tk_Uid *newPtr; @@ -474,7 +474,7 @@ Tk_CanvasTagsPrintProc( * information about how to reclaim storage * for return string. */ { - register Tk_Item *itemPtr = (Tk_Item *) widgRec; + Tk_Item *itemPtr = (Tk_Item *) widgRec; if (itemPtr->numTags == 0) { *freeProcPtr = NULL; @@ -733,7 +733,7 @@ TkSmoothParseProc( char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { - register const Tk_SmoothMethod **smoothPtr = + const Tk_SmoothMethod **smoothPtr = (const Tk_SmoothMethod **) (widgRec + offset); const Tk_SmoothMethod *smooth = NULL; int b; @@ -826,7 +826,7 @@ TkSmoothPrintProc( * information about how to reclaim storage * for return string. */ { - register const Tk_SmoothMethod *smoothPtr = + const Tk_SmoothMethod *smoothPtr = * (Tk_SmoothMethod **) (widgRec + offset); return smoothPtr ? smoothPtr->name : "0"; diff --git a/generic/tkColor.c b/generic/tkColor.c index f6650f9..48d17ac 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -363,7 +363,7 @@ const char * Tk_NameOfColor( XColor *colorPtr) /* Color whose name is desired. */ { - register TkColor *tkColPtr = (TkColor *) colorPtr; + TkColor *tkColPtr = (TkColor *) colorPtr; if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 65e28a6..8381a0a 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1400,7 +1400,7 @@ Tk_RestoreSavedOptions( = savePtr->items[i].valuePtr; } if (specPtr->internalOffset >= 0) { - register char *ptr = (char *) &savePtr->items[i].internalForm; + char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 21c713a..1e49c64 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -229,7 +229,7 @@ TkcGetCursor( * details on legal syntax. */ { Tcl_HashEntry *nameHashPtr; - register TkCursor *cursorPtr; + TkCursor *cursorPtr; TkCursor *existingCursorPtr = NULL; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -320,7 +320,7 @@ Tk_GetCursorFromData( { DataKey dataKey; Tcl_HashEntry *dataHashPtr; - register TkCursor *cursorPtr; + TkCursor *cursorPtr; int isNew; XColor fgColor, bgColor; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 4ffb48b..a6684c7 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -477,7 +477,7 @@ Tk_EntryObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Entry *entryPtr; + Entry *entryPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; @@ -3234,11 +3234,11 @@ EntryTextVarProc( static int EntryValidate( - register Entry *entryPtr, /* Entry that needs validation. */ - register char *cmd) /* Validation command (NULL-terminated + Entry *entryPtr, /* Entry that needs validation. */ + char *cmd) /* Validation command (NULL-terminated * string). */ { - register Tcl_Interp *interp = entryPtr->interp; + Tcl_Interp *interp = entryPtr->interp; int code, isOK; code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); @@ -3294,7 +3294,7 @@ EntryValidate( static int EntryValidateChange( - register Entry *entryPtr, /* Entry that needs validation. */ + Entry *entryPtr, /* Entry that needs validation. */ const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ @@ -3437,8 +3437,8 @@ EntryValidateChange( static void ExpandPercents( - register Entry *entryPtr, /* Entry that needs validation. */ - register const char *before, + Entry *entryPtr, /* Entry that needs validation. */ + const char *before, /* Command containing percent expressions to * be replaced. */ const char *change, /* Characters to added/deleted (NUL-terminated @@ -3452,7 +3452,7 @@ ExpandPercents( int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, length; - register const char *string; + const char *string; int ch; char numStorage[2*TCL_INTEGER_SPACE]; @@ -3607,8 +3607,8 @@ Tk_SpinboxObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Entry *entryPtr; - register Spinbox *sbPtr; + Entry *entryPtr; + Spinbox *sbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; @@ -4285,8 +4285,8 @@ GetSpinboxElement( static int SpinboxInvoke( - register Tcl_Interp *interp,/* Current interpreter. */ - register Spinbox *sbPtr, /* Spinbox to invoke. */ + Tcl_Interp *interp,/* Current interpreter. */ + Spinbox *sbPtr, /* Spinbox to invoke. */ int element) /* Element to invoke, either the "up" or * "down" button. */ { diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 8588d70..c8dbc52 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -164,7 +164,7 @@ TkFreeFileFilters( FileFilterClause *clausePtr; GlobPattern *globPtr; MacFileType *mfPtr; - register void *toFree; /* A pointer that we are about to free. */ + void *toFree; /* A pointer that we are about to free. */ for (filterPtr = flistPtr->filters; filterPtr != NULL; ) { for (clausePtr = filterPtr->clauses; clausePtr != NULL; ) { diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 4d46e4b..42ac6bf 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -807,7 +807,7 @@ TkFocusKeyEvent( void TkFocusDeadWindow( - register TkWindow *winPtr) /* Information about the window that is being + TkWindow *winPtr) /* Information about the window that is being * deleted. */ { ToplevelFocusInfo *tlFocusPtr, *prevPtr; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 54ba8e8..b5c20e8 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -741,7 +741,7 @@ FrameWidgetObjCmd( enum options { FRAME_CGET, FRAME_CONFIGURE }; - register Frame *framePtr = clientData; + Frame *framePtr = clientData; int result = TCL_OK, index; int c, i, length; Tcl_Obj *objPtr; @@ -859,8 +859,8 @@ static void DestroyFrame( void *memPtr) /* Info about frame widget. */ { - register Frame *framePtr = memPtr; - register Labelframe *labelframePtr = memPtr; + Frame *framePtr = memPtr; + Labelframe *labelframePtr = memPtr; if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); @@ -896,7 +896,7 @@ static void DestroyFramePartly( Frame *framePtr) /* Info about frame widget. */ { - register Labelframe *labelframePtr = (Labelframe *) framePtr; + Labelframe *labelframePtr = (Labelframe *) framePtr; if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) { Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask, @@ -936,7 +936,7 @@ DestroyFramePartly( static int ConfigureFrame( Tcl_Interp *interp, /* Used for error reporting. */ - register Frame *framePtr, /* Information about widget; may or may not + Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1263,7 +1263,7 @@ FrameWorldChanged( static void ComputeFrameGeometry( - register Frame *framePtr) /* Information about widget. */ + Frame *framePtr) /* Information about widget. */ { int otherWidth, otherHeight, otherWidthT, otherHeightT, padding; int maxWidth, maxHeight; @@ -1412,8 +1412,8 @@ static void DisplayFrame( ClientData clientData) /* Information about widget. */ { - register Frame *framePtr = clientData; - register Tk_Window tkwin = framePtr->tkwin; + Frame *framePtr = clientData; + Tk_Window tkwin = framePtr->tkwin; int bdX1, bdY1, bdX2, bdY2, hlWidth; Pixmap pixmap; TkRegion clipRegion = NULL; @@ -1635,9 +1635,9 @@ DisplayFrame( static void FrameEventProc( ClientData clientData, /* Information about window. */ - register XEvent *eventPtr) /* Information about event. */ + XEvent *eventPtr) /* Information about event. */ { - register Frame *framePtr = clientData; + Frame *framePtr = clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; diff --git a/generic/tkGC.c b/generic/tkGC.c index c424e30..a03c156 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -66,17 +66,17 @@ static void GCInit(TkDisplay *dispPtr); GC Tk_GetGC( Tk_Window tkwin, /* Window in which GC will be used. */ - register unsigned long valueMask, + unsigned long valueMask, /* 1 bits correspond to values specified in * *valuesPtr; other values are set from * defaults. */ - register XGCValues *valuePtr) + XGCValues *valuePtr) /* Values are specified here for bits set in * valueMask. */ { ValueKey valueKey; Tcl_HashEntry *valueHashPtr, *idHashPtr; - register TkGC *gcPtr; + TkGC *gcPtr; int isNew; Drawable d, freeDrawable; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -291,7 +291,7 @@ Tk_FreeGC( GC gc) /* Graphics context to be released. */ { Tcl_HashEntry *idHashPtr; - register TkGC *gcPtr; + TkGC *gcPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->gcInit) { diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 76e48d4..ab4bc37 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -1035,13 +1035,13 @@ ReadImage( { unsigned char initialCodeSize; int xpos = 0, ypos = 0, pass = 0, i, count; - register unsigned char *pixelPtr; + unsigned char *pixelPtr; static const int interlaceStep[] = { 8, 8, 4, 2 }; static const int interlaceStart[] = { 0, 4, 2, 1 }; unsigned short prefix[(1 << MAX_LWZ_BITS)]; unsigned char append[(1 << MAX_LWZ_BITS)]; unsigned char stack[(1 << MAX_LWZ_BITS)*2]; - register unsigned char *top; + unsigned char *top; int codeSize, clearCode, inCode, endCode, oldCode, maxCode; int code, firstCode, v; @@ -1425,7 +1425,7 @@ Mread( size_t numChunks, /* number of chunks */ MFile *handle) /* mmdecode "file" handle */ { - register int i, c; + int i, c; int count = chunkSize * numChunks; for (i=0; ihashTable + hSize; - register long i; - register long m1 = -1; + int *hashTablePtr = statePtr->hashTable + hSize; + long i; + long m1 = -1; i = hSize - 16; do { /* might use Sys V memset(3) here */ diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 7e22f26..03bb4f8 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -2237,14 +2237,14 @@ ApplyAlpha( PNGImage *pngPtr) { if (pngPtr->alpha != 1.0) { - register unsigned char *p = pngPtr->block.pixelPtr; + unsigned char *p = pngPtr->block.pixelPtr; unsigned char *endPtr = p + pngPtr->blockLen; int offset = pngPtr->block.offset[3]; p += offset; if (16 == pngPtr->bitDepth) { - register unsigned int channel; + unsigned int channel; while (p < endPtr) { channel = (unsigned int) diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 514b349..cba8954 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -478,7 +478,7 @@ Tk_ListboxObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Listbox *listPtr; + Listbox *listPtr; Tk_Window tkwin; ListboxOptionTables *optionTables; @@ -607,7 +607,7 @@ ListboxWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = clientData; int cmdIndex, index; int result = TCL_OK; Tcl_Obj *objPtr; @@ -1082,7 +1082,7 @@ ListboxBboxSubCmd( Listbox *listPtr, /* Information about the listbox */ int index) /* Index of the element to get bbox info on */ { - register Tk_Window tkwin = listPtr->tkwin; + Tk_Window tkwin = listPtr->tkwin; int lastVisibleIndex; /* @@ -1446,7 +1446,7 @@ static void DestroyListbox( void *memPtr) /* Info about listbox widget. */ { - register Listbox *listPtr = memPtr; + Listbox *listPtr = memPtr; Tcl_HashEntry *entry; Tcl_HashSearch search; @@ -1555,7 +1555,7 @@ DestroyListboxOptionTables( static int ConfigureListbox( Tcl_Interp *interp, /* Used for error reporting. */ - register Listbox *listPtr, /* Information about widget; may or may not + Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1715,7 +1715,7 @@ ConfigureListbox( static int ConfigureListboxItem( Tcl_Interp *interp, /* Used for error reporting. */ - register Listbox *listPtr, /* Information about widget; may or may not + Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ ItemAttr *attrs, /* Information about the item to configure */ int objc, /* Number of valid entries in argv. */ @@ -1837,8 +1837,8 @@ static void DisplayListbox( ClientData clientData) /* Information about window. */ { - register Listbox *listPtr = clientData; - register Tk_Window tkwin = listPtr->tkwin; + Listbox *listPtr = clientData; + Tk_Window tkwin = listPtr->tkwin; GC gc; int i, limit, x, y, prevSelected, freeGC, stringLen; Tk_FontMetrics fm; @@ -2317,7 +2317,7 @@ ListboxComputeGeometry( static int ListboxInsertSubCmd( - register Listbox *listPtr, /* Listbox that is to get the new elements. */ + Listbox *listPtr, /* Listbox that is to get the new elements. */ int index, /* Add the new elements before this * element. */ int objc, /* Number of new elements to add. */ @@ -2433,7 +2433,7 @@ ListboxInsertSubCmd( static int ListboxDeleteSubCmd( - register Listbox *listPtr, /* Listbox widget to modify. */ + Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { @@ -2828,7 +2828,7 @@ GetListboxIndex( static void ChangeListboxView( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int index) /* Index of element in listPtr that should now * appear at the top of the listbox. */ { @@ -2863,7 +2863,7 @@ ChangeListboxView( static void ChangeListboxOffset( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int offset) /* Desired new "xOffset" for listbox. */ { int maxOffset; @@ -2911,7 +2911,7 @@ ChangeListboxOffset( static void ListboxScanTo( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int x, /* X-coordinate to use for scan operation. */ int y) /* Y-coordinate to use for scan operation. */ { @@ -2978,7 +2978,7 @@ ListboxScanTo( static int NearestListboxElement( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int y) /* Y-coordinate in listPtr's window. */ { int index; @@ -3019,7 +3019,7 @@ NearestListboxElement( static int ListboxSelect( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int first, /* Index of first element to select or * deselect. */ int last, /* Index of last element to select or @@ -3120,7 +3120,7 @@ ListboxFetchSelection( * not including terminating NULL * character. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = clientData; Tcl_DString selection; int length, count, needNewline, stringLen, i; Tcl_Obj *curElement; @@ -3196,7 +3196,7 @@ static void ListboxLostSelection( ClientData clientData) /* Information about listbox widget. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = clientData; if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->nElements > 0)) { @@ -3248,7 +3248,7 @@ GenerateListboxSelectEvent( static void EventuallyRedrawRange( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int first, /* Index of first element in list that needs * to be redrawn. */ int last) /* Index of last element in list that needs to @@ -3256,7 +3256,7 @@ EventuallyRedrawRange( * just bracket a range. */ { /* - * We don't have to register a redraw callback if one is already pending, + * We don't have to a redraw callback if one is already pending, * or if the window doesn't exist, or if the window isn't mapped. */ @@ -3291,7 +3291,7 @@ EventuallyRedrawRange( static void ListboxUpdateVScrollbar( - register Listbox *listPtr) /* Information about widget. */ + Listbox *listPtr) /* Information about widget. */ { char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE]; double first, last; @@ -3361,7 +3361,7 @@ ListboxUpdateVScrollbar( static void ListboxUpdateHScrollbar( - register Listbox *listPtr) /* Information about widget. */ + Listbox *listPtr) /* Information about widget. */ { char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE]; int result, windowWidth; @@ -3642,7 +3642,7 @@ MigrateHashEntries( *---------------------------------------------------------------------- */ static int GetMaxOffset( - register Listbox *listPtr) + Listbox *listPtr) { int maxOffset; diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c index ab92fec..7749c6d 100644 --- a/generic/tkMacWinMenu.c +++ b/generic/tkMacWinMenu.c @@ -67,7 +67,7 @@ PreprocessMenu( do { finished = 1; for (index = 0; index < menuPtr->numEntries; index++) { - register TkMenuEntry *entryPtr = menuPtr->entries[index]; + TkMenuEntry *entryPtr = menuPtr->entries[index]; if ((entryPtr->type == CASCADE_ENTRY) && (entryPtr->namePtr != NULL) diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 1cd7a16..18f59a8 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -406,7 +406,7 @@ Tk_MenuObjCmd( { Tk_Window tkwin = clientData; Tk_Window newWin; - register TkMenu *menuPtr; + TkMenu *menuPtr; TkMenuReferences *menuRefPtr; int i, index, toplevel; const char *windowName; @@ -617,8 +617,8 @@ MenuWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkMenu *menuPtr = clientData; - register TkMenuEntry *mePtr; + TkMenu *menuPtr = clientData; + TkMenuEntry *mePtr; int result = TCL_OK; int option; ThreadSpecificData *tsdPtr = @@ -1385,7 +1385,7 @@ static void DestroyMenuEntry( void *memPtr) /* Pointer to entry to be freed. */ { - register TkMenuEntry *mePtr = memPtr; + TkMenuEntry *mePtr = memPtr; TkMenu *menuPtr = mePtr->menuPtr; if (menuPtr->postedCascade == mePtr) { @@ -1519,7 +1519,7 @@ MenuWorldChanged( static int ConfigureMenu( Tcl_Interp *interp, /* Used for error reporting. */ - register TkMenu *menuPtr, /* Information about widget; may or may not + TkMenu *menuPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1901,7 +1901,7 @@ PostProcessEntry( static int ConfigureMenuEntry( - register TkMenuEntry *mePtr,/* Information about menu entry; may or may + TkMenuEntry *mePtr,/* Information about menu entry; may or may * not already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -2589,11 +2589,11 @@ MenuVarProc( int TkActivateMenuEntry( - register TkMenu *menuPtr, /* Menu in which to activate. */ + TkMenu *menuPtr, /* Menu in which to activate. */ int index) /* Index of entry to activate, or -1 to * deactivate all entries. */ { - register TkMenuEntry *mePtr; + TkMenuEntry *mePtr; int result = TCL_OK; if (menuPtr->active >= 0) { diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 89f4a2b..3851a06 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -483,8 +483,8 @@ TkRecomputeMenu( void TkEventuallyRedrawMenu( - register TkMenu *menuPtr, /* Information about menu to redraw. */ - register TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the + TkMenu *menuPtr, /* Information about menu to redraw. */ + TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the * entries in the menu. */ { int i; @@ -586,7 +586,7 @@ TkMenuSelectImageProc( * <=0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuEntry *mePtr = clientData; + TkMenuEntry *mePtr = clientData; if ((mePtr->entryFlags & ENTRY_SELECTED) && !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) { @@ -615,9 +615,9 @@ static void DisplayMenu( ClientData clientData) /* Information about widget. */ { - register TkMenu *menuPtr = clientData; - register TkMenuEntry *mePtr; - register Tk_Window tkwin = menuPtr->tkwin; + TkMenu *menuPtr = clientData; + TkMenuEntry *mePtr; + Tk_Window tkwin = menuPtr->tkwin; int index, strictMotif; Tk_Font tkfont; Tk_FontMetrics menuMetrics; @@ -824,7 +824,7 @@ TkMenuImageProc( * <=0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr; + TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr; if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) { menuPtr->menuFlags |= RESIZE_PENDING; @@ -882,8 +882,8 @@ int TkPostSubmenu( Tcl_Interp *interp, /* Used for invoking sub-commands and * reporting errors. */ - register TkMenu *menuPtr, /* Information about menu as a whole. */ - register TkMenuEntry *mePtr)/* Info about submenu that is to be posted. + TkMenu *menuPtr, /* Information about menu as a whole. */ + TkMenuEntry *mePtr)/* Info about submenu that is to be posted. * NULL means make sure that no submenu is * posted. */ { diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 2228a2e..5f4f40f 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -217,7 +217,7 @@ Tk_MenubuttonObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr; + TkMenuButton *mbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; @@ -347,7 +347,7 @@ MenuButtonWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = clientData; int result, index; Tcl_Obj *objPtr; @@ -422,7 +422,7 @@ static void DestroyMenuButton( char *memPtr) /* Info about button widget. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) memPtr; + TkMenuButton *mbPtr = (TkMenuButton *) memPtr; TkpDestroyMenuButton(mbPtr); if (mbPtr->flags & REDRAW_PENDING) { @@ -490,7 +490,7 @@ DestroyMenuButton( static int ConfigureMenuButton( Tcl_Interp *interp, /* Used for error reporting. */ - register TkMenuButton *mbPtr, + TkMenuButton *mbPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ @@ -877,7 +877,7 @@ MenuButtonTextVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = clientData; const char *value; unsigned len; @@ -964,7 +964,7 @@ MenuButtonImageProc( * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = clientData; if (mbPtr->tkwin != NULL) { TkpComputeMenuButtonGeometry(mbPtr); diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 1a3c6de..cc67b46 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -219,7 +219,7 @@ Tk_MessageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr; + Message *msgPtr; Tk_OptionTable optionTable; Tk_Window tkwin; @@ -306,7 +306,7 @@ MessageWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr = clientData; + Message *msgPtr = clientData; static const char *const optionStrings[] = { "cget", "configure", NULL }; enum options { MESSAGE_CGET, MESSAGE_CONFIGURE }; int index; @@ -384,7 +384,7 @@ static void DestroyMessage( char *memPtr) /* Info about message widget. */ { - register Message *msgPtr = (Message *) memPtr; + Message *msgPtr = (Message *) memPtr; msgPtr->flags |= MESSAGE_DELETED; @@ -437,7 +437,7 @@ DestroyMessage( static int ConfigureMessage( Tcl_Interp *interp, /* Used for error reporting. */ - register Message *msgPtr, /* Information about widget; may or may not + Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ @@ -582,7 +582,7 @@ MessageWorldChanged( static void ComputeMessageGeometry( - register Message *msgPtr) /* Information about window. */ + Message *msgPtr) /* Information about window. */ { int width, inc, height; int thisWidth, thisHeight, maxWidth; @@ -666,8 +666,8 @@ static void DisplayMessage( ClientData clientData) /* Information about window. */ { - register Message *msgPtr = clientData; - register Tk_Window tkwin = msgPtr->tkwin; + Message *msgPtr = clientData; + Tk_Window tkwin = msgPtr->tkwin; int x, y; int borderWidth = msgPtr->highlightWidth; @@ -835,7 +835,7 @@ MessageTextVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register Message *msgPtr = clientData; + Message *msgPtr = clientData; const char *value; /* diff --git a/generic/tkObj.c b/generic/tkObj.c index 716c7e1..db2e501 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -929,10 +929,10 @@ SetWindowFromAny( static void DupWindowInternalRep( - register Tcl_Obj *srcPtr, - register Tcl_Obj *copyPtr) + Tcl_Obj *srcPtr, + Tcl_Obj *copyPtr) { - register WindowRep *oldPtr, *newPtr; + WindowRep *oldPtr, *newPtr; oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; newPtr = ckalloc(sizeof(WindowRep)); diff --git a/generic/tkScale.c b/generic/tkScale.c index 825f661..fa2a5d5 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -253,7 +253,7 @@ Tk_ScaleObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - register TkScale *scalePtr; + TkScale *scalePtr; Tk_OptionTable optionTable; Tk_Window tkwin; @@ -542,7 +542,7 @@ static void DestroyScale( char *memPtr) /* Info about scale widget. */ { - register TkScale *scalePtr = (TkScale *) memPtr; + TkScale *scalePtr = (TkScale *) memPtr; scalePtr->flags |= SCALE_DELETED; @@ -599,7 +599,7 @@ DestroyScale( static int ConfigureScale( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScale *scalePtr, /* Information about widget; may or may not + TkScale *scalePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -1017,7 +1017,7 @@ ComputeFormat( static void ComputeScaleGeometry( - register TkScale *scalePtr) /* Information about widget. */ + TkScale *scalePtr) /* Information about widget. */ { char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, tickPixels, x, y, extraSpace; @@ -1246,7 +1246,7 @@ ScaleCmdDeletedProc( void TkEventuallyRedrawScale( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ int what) /* What to redraw: REDRAW_SLIDER or * REDRAW_ALL. */ { @@ -1344,7 +1344,7 @@ ScaleVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkScale *scalePtr = clientData; + TkScale *scalePtr = clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; @@ -1439,7 +1439,7 @@ ScaleVarProc( void TkScaleSetValue( - register TkScale *scalePtr, /* Info about widget. */ + TkScale *scalePtr, /* Info about widget. */ double value, /* New value for scale. Gets adjusted if it's * off the scale. */ int setVar, /* Non-zero means reflect new value through to @@ -1497,7 +1497,7 @@ TkScaleSetValue( static void ScaleSetVariable( - register TkScale *scalePtr) /* Info about widget. */ + TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; @@ -1533,7 +1533,7 @@ ScaleSetVariable( double TkScalePixelToValue( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ int x, int y) /* Coordinates of point within window. */ { double value, pixelRange; @@ -1591,7 +1591,7 @@ TkScalePixelToValue( int TkScaleValueToPixel( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ double value) /* Reading of the widget. */ { int y, pixelRange; diff --git a/generic/tkSquare.c b/generic/tkSquare.c index e92c03c..61f86c5 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -581,7 +581,7 @@ SquareDestroy( static void KeepInWindow( - register Square *squarePtr) /* Pointer to widget record. */ + Square *squarePtr) /* Pointer to widget record. */ { int i, bd, relief; int borderWidth, size; diff --git a/generic/tkTrig.c b/generic/tkTrig.c index a2bf456..101f09b 100644 --- a/generic/tkTrig.c +++ b/generic/tkTrig.c @@ -440,7 +440,7 @@ TkPolygonToPoint( * intersect a ray extending vertically * upwards from the point to infinity. */ int count; - register double *pPtr; + double *pPtr; /* * Iterate through all of the edges in the polygon, updating bestDist and @@ -588,7 +588,7 @@ TkPolygonToArea( * polygon: x0, y0, x1, y1, ... The polygon * may be self-intersecting. */ int numPoints, /* Total number of points at *polyPtr. */ - register double *rectPtr) /* Points to coords for rectangle, in the + double *rectPtr) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 and y1 must be * lower-left corner. */ { @@ -596,7 +596,7 @@ TkPolygonToArea( * outside, 1 means inside, won't ever be * 0). */ int count; - register double *pPtr; + double *pPtr; /* * Iterate over all of the edges of the polygon and test them against the @@ -751,11 +751,11 @@ TkOvalToPoint( int TkOvalToArea( - register double *ovalPtr, /* Points to coordinates defining the + double *ovalPtr, /* Points to coordinates defining the * bounding rectangle for the oval: x1, y1, * x2, y2. X1 must be less than x2 and y1 less * than y2. */ - register double *rectPtr) /* Points to coords for rectangle, in the + double *rectPtr) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 and y1 must be * lower-left corner. */ { @@ -870,7 +870,7 @@ TkOvalToArea( /* ARGSUSED */ void TkIncludePoint( - register Tk_Item *itemPtr, /* Item whose bounding box is being + Tk_Item *itemPtr, /* Item whose bounding box is being * calculated. */ double *pointPtr) /* Address of two doubles giving x and y * coordinates of point. */ @@ -919,7 +919,7 @@ TkBezierScreenPoints( double control[], /* Array of coordinates for four control * points: x0, y0, x1, y1, ... x3 y3. */ int numSteps, /* Number of curve points to generate. */ - register XPoint *xPointPtr) /* Where to put new points. */ + XPoint *xPointPtr) /* Where to put new points. */ { int i; double u, u2, u3, t, t2, t3; @@ -965,7 +965,7 @@ TkBezierPoints( double control[], /* Array of coordinates for four control * points: x0, y0, x1, y1, ... x3 y3. */ int numSteps, /* Number of curve points to generate. */ - register double *coordPtr) /* Where to put new points. */ + double *coordPtr) /* Where to put new points. */ { int i; double u, u2, u3, t, t2, t3; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index c2f6eaa..d4072f1 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -317,8 +317,8 @@ CreateTopLevelWindow( * parent. */ unsigned int flags) /* Additional flags to set on the window. */ { - register TkWindow *winPtr; - register TkDisplay *dispPtr; + TkWindow *winPtr; + TkDisplay *dispPtr; int screenId; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -420,7 +420,7 @@ GetScreen( * DISPLAY envariable. */ int *screenPtr) /* Where to store screen number. */ { - register TkDisplay *dispPtr; + TkDisplay *dispPtr; const char *p; int screenId; size_t length; @@ -621,7 +621,7 @@ TkAllocWindow( * inherit visual information. NULL means use * screen defaults instead of inheriting. */ { - register TkWindow *winPtr = ckalloc(sizeof(TkWindow)); + TkWindow *winPtr = ckalloc(sizeof(TkWindow)); winPtr->display = dispPtr->display; winPtr->dispPtr = dispPtr; @@ -702,7 +702,7 @@ TkAllocWindow( static int NameWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - register TkWindow *winPtr, /* Window that is to be named and inserted. */ + TkWindow *winPtr, /* Window that is to be named and inserted. */ TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used * for naming, options, etc.). */ const char *name) /* Name for winPtr; must be unique among @@ -833,9 +833,9 @@ TkCreateMainWindow( Tk_Window tkwin; int dummy, isSafe; Tcl_HashEntry *hPtr; - register TkMainInfo *mainPtr; - register TkWindow *winPtr; - register const TkCmd *cmdPtr; + TkMainInfo *mainPtr; + TkWindow *winPtr; + const TkCmd *cmdPtr; ClientData clientData; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -922,7 +922,7 @@ TkCreateMainWindow( isSafe = Tcl_IsSafe(interp); for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { Tcl_CmdInfo cmdInfo; - + if (cmdPtr->objProc == NULL) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } @@ -1497,7 +1497,7 @@ Tk_DestroyWindow( winPtr->mainPtr->deletionEpoch++; } if (winPtr->mainPtr->refCount-- <= 1) { - register const TkCmd *cmdPtr; + const TkCmd *cmdPtr; /* * We just deleted the last window in the application. Delete the @@ -1694,7 +1694,7 @@ void Tk_MakeWindowExist( Tk_Window tkwin) /* Token for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *winPtr2; Window parent; Tcl_HashEntry *hPtr; @@ -1803,7 +1803,7 @@ void Tk_UnmapWindow( Tk_Window tkwin) /* Token for window to unmap. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (!(winPtr->flags & TK_MAPPED) || (winPtr->flags & TK_ALREADY_DEAD)) { return; @@ -1840,7 +1840,7 @@ Tk_ConfigureWindow( * are to be used. */ XWindowChanges *valuePtr) /* New values. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (valueMask & CWX) { winPtr->changes.x = valuePtr->x; @@ -1876,7 +1876,7 @@ Tk_MoveWindow( Tk_Window tkwin, /* Window to move. */ int x, int y) /* New location for window (within parent). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; @@ -1894,7 +1894,7 @@ Tk_ResizeWindow( Tk_Window tkwin, /* Window to resize. */ int width, int height) /* New dimensions for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; @@ -1914,7 +1914,7 @@ Tk_MoveResizeWindow( int x, int y, /* New location for window (within parent). */ int width, int height) /* New dimensions for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; @@ -1935,7 +1935,7 @@ Tk_SetWindowBorderWidth( Tk_Window tkwin, /* Window to modify. */ int width) /* New border width for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.border_width = width; if (winPtr->window != None) { @@ -1953,10 +1953,10 @@ Tk_ChangeWindowAttributes( Tk_Window tkwin, /* Window to manipulate. */ unsigned long valueMask, /* OR'ed combination of bits, indicating which * fields of *attsPtr are to be used. */ - register XSetWindowAttributes *attsPtr) + XSetWindowAttributes *attsPtr) /* New values for some attributes. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (valueMask & CWBackPixmap) { winPtr->atts.background_pixmap = attsPtr->background_pixmap; @@ -2019,7 +2019,7 @@ Tk_SetWindowBackground( unsigned long pixel) /* Pixel value to use for window's * background. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.background_pixel = pixel; @@ -2036,7 +2036,7 @@ Tk_SetWindowBackgroundPixmap( Tk_Window tkwin, /* Window to manipulate. */ Pixmap pixmap) /* Pixmap to use for window's background. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.background_pixmap = pixmap; @@ -2054,7 +2054,7 @@ Tk_SetWindowBorder( Tk_Window tkwin, /* Window to manipulate. */ unsigned long pixel) /* Pixel value to use for window's border. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.border_pixel = pixel; @@ -2071,7 +2071,7 @@ Tk_SetWindowBorderPixmap( Tk_Window tkwin, /* Window to manipulate. */ Pixmap pixmap) /* Pixmap to use for window's border. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.border_pixmap = pixmap; @@ -2089,7 +2089,7 @@ Tk_DefineCursor( Tk_Window tkwin, /* Window to manipulate. */ Tk_Cursor cursor) /* Cursor to use for window (may be None). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; #if defined(MAC_OSX_TK) winPtr->atts.cursor = (XCursor) cursor; @@ -2116,7 +2116,7 @@ Tk_SetWindowColormap( Tk_Window tkwin, /* Window to manipulate. */ Colormap colormap) /* Colormap to use for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.colormap = colormap; @@ -2158,7 +2158,7 @@ Tk_SetWindowVisual( int depth, /* New depth for window. */ Colormap colormap) /* An appropriate colormap for the visual. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->window != None) { /* Too late! */ @@ -2201,7 +2201,7 @@ Tk_SetWindowVisual( void TkDoConfigureNotify( - register TkWindow *winPtr) /* Window whose configuration was just + TkWindow *winPtr) /* Window whose configuration was just * changed. */ { XEvent event; @@ -2247,7 +2247,7 @@ Tk_SetClass( Tk_Window tkwin, /* Token for window to assign class. */ const char *className) /* New class for tkwin. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classUid = Tk_GetUid(className); if (winPtr->flags & TK_WIN_MANAGED) { @@ -2280,7 +2280,7 @@ Tk_SetClassProcs( const Tk_ClassProcs *procs, /* Class procs structure. */ ClientData instanceData) /* Data to be passed to class functions. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classProcsPtr = procs; winPtr->instanceData = instanceData; diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 7332c93..4e965c2 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -149,7 +149,7 @@ InitBoxes(void) size = tsdPtr->boxesPtr->biSize + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount) + tsdPtr->boxesPtr->biSizeImage; - newBitmap = ckalloc(size); + newBitmap = (LPBITMAPINFOHEADER)ckalloc(size); memcpy(newBitmap, tsdPtr->boxesPtr, size); tsdPtr->boxesPtr = newBitmap; tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4; @@ -182,7 +182,7 @@ InitBoxes(void) */ void -TkpButtonSetDefaults() +TkpButtonSetDefaults(void) { int width = GetSystemMetrics(SM_CXEDGE); if (width > 0) { @@ -208,11 +208,11 @@ TkpButtonSetDefaults() TkButton * TkpCreateButton( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { WinButton *butPtr; - butPtr = ckalloc(sizeof(WinButton)); + butPtr = (WinButton *)ckalloc(sizeof(WinButton)); butPtr->hwnd = NULL; return (TkButton *) butPtr; } @@ -316,14 +316,14 @@ TkpDisplayButton( { TkWinDCState state; HDC dc; - register TkButton *butPtr = (TkButton *) clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization only needed to stop compiler * warning. */ int y, relief; - register Tk_Window tkwin = butPtr->tkwin; + Tk_Window tkwin = butPtr->tkwin; int width = 0, height = 0, haveImage = 0, haveText = 0, drawRing = 0; RECT rect; int defaultWidth; /* Width of default ring. */ @@ -818,7 +818,7 @@ TkpDisplayButton( void TkpComputeButtonGeometry( - register TkButton *butPtr) /* Button whose geometry may have changed. */ + TkButton *butPtr) /* Button whose geometry may have changed. */ { int txtWidth, txtHeight; /* Width and height of text */ int imgWidth, imgHeight; /* Width and height of image */ @@ -1264,7 +1264,7 @@ ButtonProc( PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); - TkpDisplayButton((ClientData)butPtr); + TkpDisplayButton(butPtr); /* * Special note: must cancel any existing idle handler for @@ -1272,7 +1272,7 @@ ButtonProc( * cleared the REDRAW_PENDING flag. */ - Tcl_CancelIdleCall(TkpDisplayButton, (ClientData)butPtr); + Tcl_CancelIdleCall(TkpDisplayButton, butPtr); return 0; } case BN_CLICKED: { @@ -1287,14 +1287,14 @@ ButtonProc( Tcl_Interp *interp = butPtr->info.interp; if (butPtr->info.state != STATE_DISABLED) { - Tcl_Preserve((ClientData)interp); + Tcl_Preserve(interp); code = TkInvokeButton((TkButton*)butPtr); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (button invoke)"); Tcl_BackgroundException(interp, code); } - Tcl_Release((ClientData)interp); + Tcl_Release(interp); } Tcl_ServiceAll(); return 0; diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index a633dc2..409a6db 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -4,7 +4,7 @@ * This file implements the Windows specific portion of the scrollbar * widget. * - * Copyright (c) 1996 by Sun Microsystems, Inc. + * Copyright (c) 1996 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -82,7 +82,7 @@ const Tk_ClassProcs tkpScrollbarProcs = { static void WinScrollbarEventProc(ClientData clientData, XEvent *eventPtr) { - WinScrollbar *scrollPtr = clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; if (eventPtr->type == ButtonPress) { ModalLoop(scrollPtr, eventPtr); @@ -121,7 +121,7 @@ TkpCreateScrollbar( Tcl_MutexUnlock(&winScrlbrMutex); } - scrollPtr = ckalloc(sizeof(WinScrollbar)); + scrollPtr = (WinScrollbar *)ckalloc(sizeof(WinScrollbar)); scrollPtr->winFlags = 0; scrollPtr->hwnd = NULL; @@ -275,7 +275,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - WinScrollbar *scrollPtr = (WinScrollbar *) clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; @@ -295,7 +295,7 @@ TkpDisplayScrollbar( DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), - (ClientData) scrollPtr); + scrollPtr); } else { UpdateScrollbar(scrollPtr); } @@ -383,7 +383,7 @@ UpdateScrollbarMetrics(void) void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -591,7 +591,7 @@ ScrollbarProc( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TCL_UNUSED(TkScrollbar *)) /* Information about widget; may or may not * already have values for some fields. */ { @@ -617,7 +617,7 @@ ModalLoop( int oldMode; if (scrollPtr->hwnd) { - Tcl_Preserve((ClientData)scrollPtr); + Tcl_Preserve(scrollPtr); scrollPtr->winFlags |= IN_MODAL_LOOP; oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); TkWinResendEvent(scrollPtr->oldProc, scrollPtr->hwnd, eventPtr); @@ -626,7 +626,7 @@ ModalLoop( if (scrollPtr->hwnd && scrollPtr->winFlags & ALREADY_DEAD) { DestroyWindow(scrollPtr->hwnd); } - Tcl_Release((ClientData)scrollPtr); + Tcl_Release(scrollPtr); } } @@ -650,7 +650,7 @@ ModalLoop( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { diff --git a/win/tkWinWm.c b/win/tkWinWm.c index ff83ad2..414df3e 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -358,7 +358,7 @@ typedef struct TkWmInfo { * of top-level windows. */ -static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin); +static void TopLevelReqProc(void *, Tk_Window); static void RemapWindows(TkWindow *winPtr, HWND parentHWND); static const Tk_GeomMgr wmMgrType = { @@ -436,9 +436,9 @@ static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp *interp, Tcl_Obj* fileName, BOOL isIcon); static WinIconPtr ReadIconFromFile(Tcl_Interp *interp, Tcl_Obj *fileName); +static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static WinIconPtr GetIconFromPixmap(Display *dsPtr, Pixmap pixmap); static int ReadICOHeader(Tcl_Channel channel); -static BOOL AdjustIconImagePointers(LPICONIMAGE lpImage); static HICON MakeIconOrCursorFromResource(LPICONIMAGE lpIcon, BOOL isIcon); static HICON GetIcon(WinIconPtr titlebaricon, int icon_size); @@ -2740,10 +2740,8 @@ TkWmDeadWindow( void TkWmSetClass( - TkWindow *winPtr) /* Newly-created top-level window. */ + TCL_UNUSED(TkWindow *)) /* Newly-created top-level window. */ { - (void)winPtr; - /* Do nothing */ return; } @@ -2946,7 +2944,7 @@ Tk_WmObjCmd( static int WmAspectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2954,7 +2952,6 @@ WmAspectCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; - (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3313,7 +3310,7 @@ WmAttributesCmd( static int WmClientCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3322,7 +3319,6 @@ WmClientCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -3478,7 +3474,7 @@ WmColormapwindowsCmd( static int WmCommandCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3488,7 +3484,6 @@ WmCommandCmd( const char *argv3; int cmdArgc; const char **cmdArgv; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -3548,14 +3543,13 @@ WmCommandCmd( static int WmDeiconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3601,7 +3595,7 @@ WmDeiconifyCmd( static int WmFocusmodelCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3615,7 +3609,6 @@ WmFocusmodelCmd( OPT_ACTIVE, OPT_PASSIVE }; int index; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -3658,17 +3651,13 @@ WmFocusmodelCmd( static int WmForgetCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *dummy, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + Tcl_Interp *interp, /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; - (void)tkwin; - (void)dummy; - (void)objc; - (void)objv; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -3676,10 +3665,10 @@ WmForgetCmd( Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr); RemapWindows(winPtr, Tk_GetHWND(winPtr->parentPtr->window)); - /* - * Make sure wm no longer manages this window - */ - Tk_ManageGeometry(frameWin, NULL, NULL); + /* + * Make sure wm no longer manages this window + */ + Tk_ManageGeometry(frameWin, NULL, NULL); TkWmDeadWindow(winPtr); /* flags (above) must be cleared before calling */ @@ -3710,7 +3699,7 @@ WmForgetCmd( static int WmFrameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3719,7 +3708,6 @@ WmFrameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; char buf[TCL_INTEGER_SPACE]; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3756,7 +3744,7 @@ WmFrameCmd( static int WmGeometryCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3766,7 +3754,6 @@ WmGeometryCmd( char xSign, ySign; int width, height; const char *argv3; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -3825,7 +3812,7 @@ WmGeometryCmd( static int WmGridCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3833,7 +3820,6 @@ WmGridCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; - (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3987,7 +3973,7 @@ WmGroupCmd( static int WmIconbitmapCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3996,7 +3982,6 @@ WmIconbitmapCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; - (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?"); @@ -4124,14 +4109,13 @@ WmIconbitmapCmd( static int WmIconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -4249,7 +4233,7 @@ WmIconmaskCmd( static int WmIconnameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4258,7 +4242,6 @@ WmIconnameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; - (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -4301,7 +4284,7 @@ WmIconnameCmd( static int WmIconphotoCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4319,7 +4302,6 @@ WmIconphotoCmd( unsigned size; BITMAPINFO bmInfo; ICONINFO iconInfo; - (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -4495,7 +4477,7 @@ WmIconphotoCmd( static int WmIconpositionCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4503,7 +4485,6 @@ WmIconpositionCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -4662,17 +4643,14 @@ WmIconwindowCmd( static int WmManageCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; - (void)objc; - (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -4719,7 +4697,7 @@ WmManageCmd( static int WmMaxsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4727,7 +4705,6 @@ WmMaxsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4771,7 +4748,7 @@ WmMaxsizeCmd( static int WmMinsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4779,7 +4756,6 @@ WmMinsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4823,7 +4799,7 @@ WmMinsizeCmd( static int WmOverrideredirectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4832,7 +4808,6 @@ WmOverrideredirectCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -4896,7 +4871,7 @@ WmOverrideredirectCmd( static int WmPositionfromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4910,7 +4885,6 @@ WmPositionfromCmd( OPT_PROGRAM, OPT_USER }; int index; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -4965,7 +4939,7 @@ WmPositionfromCmd( static int WmProtocolCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -4977,7 +4951,6 @@ WmProtocolCmd( const char *cmd; int cmdLength; Tcl_Obj *resultObj; - (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -5062,7 +5035,7 @@ WmProtocolCmd( static int WmResizableCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5070,7 +5043,6 @@ WmResizableCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; - (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -5125,7 +5097,7 @@ WmResizableCmd( static int WmSizefromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5139,7 +5111,6 @@ WmSizefromCmd( OPT_PROGRAM, OPT_USER }; int index; - (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -5323,7 +5294,7 @@ WmStackorderCmd( static int WmStateCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5337,7 +5308,6 @@ WmStateCmd( OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED }; int index; - (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -5464,7 +5434,7 @@ WmStateCmd( static int WmTitleCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -5474,7 +5444,6 @@ WmTitleCmd( const char *argv3; int length; HWND wrapper; - (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -5670,14 +5639,13 @@ WmTransientCmd( static int WmWithdrawCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5986,12 +5954,11 @@ TopLevelEventProc( static void TopLevelReqProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(void *), Tk_Window tkwin) /* Information about window. */ { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr; - (void)dummy; wmPtr = winPtr->wmInfoPtr; if (wmPtr) { @@ -6538,15 +6505,13 @@ Tk_CoordsToWindow( void Tk_GetVRootGeometry( - Tk_Window tkwin, /* Window whose virtual root is to be + TCL_UNUSED(Tk_Window), /* Window whose virtual root is to be * queried. */ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root * here. */ int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { - (void)tkwin; - *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); -- cgit v0.12 From 811f1574bb3980d57f05b8334bd6d1aecdf4e32e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Mar 2021 16:33:25 +0000 Subject: Fix 3 places where Tcl_UtfToUniChar must be used and not TkUtfToUniChar: numChars/charIndex is counting character indexes here; surrogate-pairs count as 2. This can cause a miscount when Emoji are pasted in a Text widget. --- generic/tkSelect.c | 4 ++-- generic/tkTextIndex.c | 4 ++-- win/tkWinMenu.c | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 9584be4..55fa473 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1399,12 +1399,12 @@ HandleTclCommand( cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1); cmdInfoPtr->buffer[0] = '\0'; } else { - int ch; + 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/tkTextIndex.c b/generic/tkTextIndex.c index 1628389..84bdbee 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -480,7 +480,7 @@ TkTextMakeCharIndex( TkTextSegment *segPtr; char *p, *start, *end; int index, offset; - int ch; + Tcl_UniChar ch = 0; indexPtr->tree = tree; if (lineIndex < 0) { @@ -527,7 +527,7 @@ TkTextMakeCharIndex( return indexPtr; } charIndex--; - offset = TkUtfToUniChar(p, &ch); + offset = Tcl_UtfToUniChar(p, &ch); index += offset; } } else { diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 67894c7..22e84cb 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -511,7 +511,7 @@ GetEntryText( : Tcl_GetString(mePtr->accelPtr); const char *p, *next; Tcl_DString itemString; - int ch; + Tcl_UniChar ch = 0; /* * We have to construct the string with an ampersand preceeding the @@ -528,16 +528,17 @@ GetEntryText( if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } + ch = 0; if (mePtr->accelLength > 0) { Tcl_DStringAppend(&itemString, "\t", 1); for (p = accel, i = 0; *p != '\0'; i++, p = next) { if (*p == '&') { Tcl_DStringAppend(&itemString, "&", 1); } - next = p + TkUtfToUniChar(p, &ch); + next = p + Tcl_UtfToUniChar(p, &ch); Tcl_DStringAppend(&itemString, p, (int) (next - p)); } } -- cgit v0.12 From 336f34228cb6b288f45ccb32c482898749f4b967 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 25 Mar 2021 22:45:43 +0000 Subject: Use "tkwait visibility" to stabilize the testcase --- tests/event.test | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/event.test b/tests/event.test index 24d6caf..ea190de 100644 --- a/tests/event.test +++ b/tests/event.test @@ -874,10 +874,7 @@ test event-9 {no event is generated for the container window when its pack propagate .top 0 bind .top {lappend res %W} pack [frame .top.f -bg green -width 50 -height 50] -anchor se -side bottom - # stabilize the test by giving some time to the OS before the upcoming update, - # so that -warp below finds the frame - after 50 - update + tkwait visibility .top.f event generate .top.f -warp 1 -x 25 -y 25 ; # sent to .top and .top.f after 50 ; # Win specific - wait for SendInput to be executed update ; # idletasks not enough -- cgit v0.12 From 31c1ceca4b6eb7866fd4a62c08e93717e51a7131 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 29 Mar 2021 06:29:00 +0000 Subject: Follow-up to [9b6065d1fd]. Only save "update" command if there is no clientData and no deleteProc. Otherwise it cannot be restored. --- generic/tkWindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkWindow.c b/generic/tkWindow.c index d4072f1..f48e469 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -944,7 +944,7 @@ TkCreateMainWindow( } if ((cmdPtr->flags & SAVEUPDATECMD) && Tcl_GetCommandInfo(interp, cmdPtr->name, &cmdInfo) && - cmdInfo.isNativeObjectProc) { + cmdInfo.isNativeObjectProc && !cmdInfo.objClientData && !cmdInfo.deleteProc) { mainPtr->tclUpdateObjProc = cmdInfo.objProc; } if (cmdPtr->flags & USEINITPROC) { -- cgit v0.12 From 41b261aae5f9f726006673e5ecd3cf162eb37c27 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 4 Apr 2021 14:53:28 +0000 Subject: Tcl_StaticPackage -> Tcl_StaticLibrary --- unix/tkAppInit.c | 13 ++++++++----- win/winMain.c | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c index 6cf3d42..1a2421c 100644 --- a/unix/tkAppInit.c +++ b/unix/tkAppInit.c @@ -16,12 +16,16 @@ #undef STATIC_BUILD #include "tk.h" #include "tkPort.h" +#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 +# define Tcl_LibraryInitProc Tcl_PackageInitProc +# define Tcl_StaticLibrary Tcl_StaticPackage +#endif #ifdef TK_TEST #ifdef __cplusplus extern "C" { #endif -extern Tcl_PackageInitProc Tktest_Init; +extern Tcl_LibraryInitProc Tktest_Init; #ifdef __cplusplus } #endif @@ -120,12 +124,11 @@ Tcl_AppInit( if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); + Tcl_StaticLibrary(interp, "Tk", Tk_Init, Tk_SafeInit); #if defined(USE_CUSTOM_EXIT_PROC) if (TkpWantsExitProc()) { - /* The cast below avoids warnings from old gcc compilers. */ - Tcl_SetExitProc((void *)TkpExitProc); + Tcl_SetExitProc(TkpExitProc); } #endif @@ -133,7 +136,7 @@ Tcl_AppInit( if (Tktest_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Tktest", Tktest_Init, 0); + Tcl_StaticLibrary(interp, "Tktest", Tktest_Init, 0); #endif /* TK_TEST */ /* diff --git a/win/winMain.c b/win/winMain.c index f072f78..3920801 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -19,6 +19,10 @@ #include #include #include +#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 +# define Tcl_LibraryInitProc Tcl_PackageInitProc +# define Tcl_StaticLibrary Tcl_StaticPackage +#endif #if defined(__GNUC__) int _CRT_glob = 0; @@ -28,7 +32,7 @@ int _CRT_glob = 0; #ifdef __cplusplus extern "C" { #endif -extern Tcl_PackageInitProc Tktest_Init; +extern Tcl_LibraryInitProc Tktest_Init; #endif /* TK_TEST */ #if !defined(TCL_USE_STATIC_PACKAGES) @@ -40,9 +44,9 @@ extern Tcl_PackageInitProc Tktest_Init; #endif #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES -extern Tcl_PackageInitProc Registry_Init; -extern Tcl_PackageInitProc Dde_Init; -extern Tcl_PackageInitProc Dde_SafeInit; +extern Tcl_LibraryInitProc Registry_Init; +extern Tcl_LibraryInitProc Dde_Init; +extern Tcl_LibraryInitProc Dde_SafeInit; #endif #ifdef __cplusplus @@ -202,7 +206,7 @@ Tcl_AppInit( if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); + Tcl_StaticLibrary(interp, "Tk", Tk_Init, Tk_SafeInit); /* * Initialize the console only if we are running as an interactive @@ -218,19 +222,19 @@ Tcl_AppInit( if (Registry_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Registry", Registry_Init, 0); + Tcl_StaticLibrary(interp, "Registry", Registry_Init, 0); if (Dde_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Dde", Dde_Init, Dde_SafeInit); + Tcl_StaticLibrary(interp, "Dde", Dde_Init, Dde_SafeInit); #endif #ifdef TK_TEST if (Tktest_Init(interp) == TCL_ERROR) { return TCL_ERROR; } - Tcl_StaticPackage(interp, "Tktest", Tktest_Init, 0); + Tcl_StaticLibrary(interp, "Tktest", Tktest_Init, 0); #endif /* TK_TEST */ /* -- cgit v0.12 From 77c7015f5d5b6a979514730a4fe527c2447e1cbf Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 7 Apr 2021 15:34:29 +0000 Subject: Fix the background for ttk::spinbox too. --- library/ttk/aquaTheme.tcl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index bba1aae..9896021 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -64,6 +64,10 @@ namespace eval ttk::theme::aqua { } # Spinbox + ttk::style configure TSpinbox \ + -foreground systemTextColor \ + -background systemTextBackgroundColor \ + -fieldbackground systemTextBackgroundColor ttk::style map TSpinbox \ -foreground { disabled systemDisabledControlTextColor -- cgit v0.12 From a8e3d2a05ad6310f0da1dc08fde580cc9b31d8c6 Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 7 Apr 2021 16:04:18 +0000 Subject: Adjustment to the subframework build; deal with systems that report the OS version as 10.16 even though 10.16 was never released. --- macosx/GNUmakefile | 10 ++-------- macosx/tkMacOSXColor.c | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index ff028b5..dd4c025 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -46,12 +46,6 @@ TK_X11 ?= # Checks and overrides for subframework builds ifeq (${SUBFRAMEWORK}_${TK_X11},1_) -ifeq (${DYLIB_INSTALL_DIR},) - @echo "Cannot install subframework with empty DYLIB_INSTALL_DIR !" && false -endif -ifeq (${DESTDIR},) - @echo "Cannot install subframework with empty DESTDIR !" && false -endif override BUILD_DIR = ${DESTDIR}/build override INSTALL_PATH = /Frameworks endif @@ -145,9 +139,9 @@ wish := ${wish}-X11 override EMBEDDED_BUILD := endif -INSTALL_TARGETS = install-binaries install-libraries +INSTALL_TARGETS = install-binaries install-libraries install-headers ifeq (${EMBEDDED_BUILD},) -INSTALL_TARGETS += install-private-headers install-headers install-demos +INSTALL_TARGETS += install-private-headers install-demos endif ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment) INSTALL_TARGETS += html-tk diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index edcd5d3..f82305e 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -326,7 +326,7 @@ GetRGBA( #endif } else if (entry->index == selectedTabTextIndex) { int OSVersion = [NSApp macOSVersion]; - if (OSVersion > 100600 && OSVersion < 110000) { + if (OSVersion > 100600 && OSVersion < 101600) { color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; } else { color = [[NSColor textColor] colorUsingColorSpace:sRGB]; -- cgit v0.12 From 97c35ad5876e4dc39dacca443da95464e2049e3d Mon Sep 17 00:00:00 2001 From: culler Date: Thu, 8 Apr 2021 16:01:37 +0000 Subject: Finish fix for [58222c42b3]: revert defaults for entry and text highlight bg, entry insert bg, entry readonly bg; change default text highlight to make text highlight visible in dark mode. Thanks to Christopher Chavez. --- macosx/tkMacOSXDefault.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 334fa0a..096e6b1 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -173,17 +173,17 @@ #define DEF_ENTRY_EXPORT_SELECTION "1" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG -#define DEF_ENTRY_HIGHLIGHT_BG TEXT_BG +#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG #define DEF_ENTRY_HIGHLIGHT BLACK #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" -#define DEF_ENTRY_INSERT_BG TEXT_BG +#define DEF_ENTRY_INSERT_BG NORMAL_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "1" #define DEF_ENTRY_JUSTIFY "left" -#define DEF_ENTRY_READONLY_BG_COLOR TEXT_BG +#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" @@ -500,7 +500,7 @@ #define DEF_TEXT_EXPORT_SELECTION "1" #define DEF_TEXT_FONT "TkFixedFont" #define DEF_TEXT_HEIGHT "24" -#define DEF_TEXT_HIGHLIGHT_BG TEXT_BG +#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG #define DEF_TEXT_HIGHLIGHT NORMAL_FG #define DEF_TEXT_HIGHLIGHT_WIDTH "3" #define DEF_TEXT_INSERT_BG NORMAL_FG -- cgit v0.12 From 4cac2bd3c4263102da89d22992df435f7ff410a6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 9 Apr 2021 09:29:59 +0000 Subject: sync rules.vc with Tcl --- win/rules.vc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 2ec5292..85c37f2 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1203,9 +1203,16 @@ TCLSH_NATIVE = $(TCLSH) !if $(DOING_TK) || $(NEED_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe -TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) -TKSTUBLIBNAME = tkstub$(TK_VERSION).lib +TKLIBNAME8 = tk$(TK_VERSION)$(SUFX).$(EXT) +TKLIBNAME9 = tcl9tk$(TK_VERSION)$(SUFX).$(EXT) +!if $(TCL_MAJOR_VERSION) == 8 +TKLIBNAME = tk$(TK_VERSION)$(SUFX).$(EXT) TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib +!else +TKLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).$(EXT) +TKIMPLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).lib +!endif +TKSTUBLIBNAME = tkstub$(TK_VERSION).lib !if $(DOING_TK) WISH = $(OUT_DIR)\$(WISHNAME) -- cgit v0.12 From ef3aaf6a85ae1d5f9fabfe4372535b9df454cd9b Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 10 Apr 2021 08:48:02 +0000 Subject: Fix [34db75c0ac]: Text peer widget error on Down arrow key when passed -endline line. Patch from dzach --- library/text.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/text.tcl b/library/text.tcl index ec8f3d3..0be99f9 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -768,7 +768,7 @@ proc ::tk::TextAutoScan {w} { # pos - The desired new position for the cursor in the window. proc ::tk::TextSetCursor {w pos} { - if {[$w compare $pos == end]} { + if {[$w compare $pos >= end]} { set pos {end - 1 chars} } $w mark set insert $pos -- cgit v0.12 From 1225fcb36c1772b3d91b8ae8f65086eb518cee25 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 10 Apr 2021 09:25:06 +0000 Subject: Add non-regression test textMark-6.6 (failing before the fix, passing with the fix) --- tests/textMark.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/textMark.test b/tests/textMark.test index 043ff82..1335464 100644 --- a/tests/textMark.test +++ b/tests/textMark.test @@ -182,6 +182,18 @@ test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -bod } -cleanup { .t configure -startline {} -endline {} } -result {1.0} +test textMark-6.6 {attempt to move the insert mark beyond peer -endline - bug 34db75c0ac} -body { + .t peer create .p -startline 1 -endline 2 + pack .p + update + .p mark set insert 1.0 + focus -force .p + event generate .p <> + event generate .p <> ; # shall not error out + set res [.p index insert] +} -cleanup { + destroy .p +} -result {1.9} test textMark-7.1 {MarkFindNext - invalid mark name} -body { .t mark next bogus -- cgit v0.12 From a3ea56136eebaeb8b37cd87b3b5f7c7142cd22d8 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 11 Apr 2021 18:40:01 +0000 Subject: Backout dzach's patch, and propose a better patch that restricts the index returned by GetIndex() to -startline/-endline thresholds. --- generic/tkTextIndex.c | 31 +++++++++++++++++++++++++++++++ library/text.tcl | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 84bdbee..264890e 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -997,6 +997,37 @@ GetIndex( if (indexPtr->linePtr == NULL) { Tcl_Panic("Bad index created"); } + + /* + * Restrict indexPtr to -startline/-endline thresholds. + */ + + if (textPtr) { + if (textPtr->start != NULL) { + int start; + TkTextIndex indexStart; + + start = TkBTreeLinesTo(NULL, textPtr->start); + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0, + &indexStart); + if (TkTextIndexCmp(indexPtr, &indexStart) < 0) { + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0, + indexPtr); + } + } + if (textPtr->end != NULL) { + int end; + TkTextIndex indexEnd; + + end = TkBTreeLinesTo(NULL, textPtr->end); + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0, + &indexEnd); + if (TkTextIndexCmp(indexPtr, &indexEnd) > 0) { + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0, + indexPtr); + } + } + } return TCL_OK; error: diff --git a/library/text.tcl b/library/text.tcl index 0be99f9..ec8f3d3 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -768,7 +768,7 @@ proc ::tk::TextAutoScan {w} { # pos - The desired new position for the cursor in the window. proc ::tk::TextSetCursor {w pos} { - if {[$w compare $pos >= end]} { + if {[$w compare $pos == end]} { set pos {end - 1 chars} } $w mark set insert $pos -- cgit v0.12 From 3bd12138e37a4369aa0f615c7e75e5a9f8fef5cd Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 11 Apr 2021 18:56:21 +0000 Subject: Add non-regression test textIndex-26.1 --- tests/textIndex.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/textIndex.test b/tests/textIndex.test index bd4e955..a6efd88 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -964,6 +964,19 @@ test textIndex-25.1 {IndexCountBytesOrdered, bug [3f1f79abcf]} { destroy .t2 } {} +test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline in peers, bug [34db75c0ac]} { + set res {} + pack [text .t2] + .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n" + pack [.t2 peer create .p2 -startline 2 -endline 3] + lappend res [.p2 index "end"] + lappend res [.p2 index "end lineend"] + lappend res [.p2 index "end display lineend"] + destroy .t2 .p2 + set res +} {2.0 2.0 2.0} + + # cleanup rename textimage {} catch {destroy .t} -- cgit v0.12 From 09f629e99dedf758b646eb290a64ec7fc80addef Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 12 Apr 2021 21:09:09 +0000 Subject: Let the newly introduced test textIndex-26.1 also test the -startline condition. --- tests/textIndex.test | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/textIndex.test b/tests/textIndex.test index a6efd88..4d509c9 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -972,9 +972,14 @@ test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline lappend res [.p2 index "end"] lappend res [.p2 index "end lineend"] lappend res [.p2 index "end display lineend"] + .p2 configure -startline 3 -endline {} + image create photo redsquare -width 5 -height 5 + redsquare put red -to 0 0 4 4 + .t2 image create 1.0 -image redsquare + lappend res [.p2 index redsquare] destroy .t2 .p2 set res -} {2.0 2.0 2.0} +} {2.0 2.0 2.0 1.0} # cleanup -- cgit v0.12 From e144aa168478bfcc1a5e9167dbf05fde91f0b965 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 19:54:48 +0000 Subject: Factor out two places where the -startline/-endline range is checked. --- generic/tkText.h | 2 ++ generic/tkTextIndex.c | 91 ++++++++++++++++++++++++++++++++++----------------- generic/tkTextMark.c | 20 ++--------- 3 files changed, 66 insertions(+), 47 deletions(-) diff --git a/generic/tkText.h b/generic/tkText.h index 9a9495a..a71a31e 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -1160,6 +1160,8 @@ MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData); +MODULE_SCOPE int TkTextIndexAdjustToStartEnd(TkText* textPtr, + TkTextIndex* indexPtr, int err); #endif /* _TKTEXT */ /* diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 264890e..9320db8 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -997,44 +997,75 @@ GetIndex( if (indexPtr->linePtr == NULL) { Tcl_Panic("Bad index created"); } + TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 0); + return TCL_OK; - /* - * Restrict indexPtr to -startline/-endline thresholds. - */ + error: + Tcl_DStringFree(©); + Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad text index \"%s\"", string)); + Tcl_SetErrorCode(interp, "TK", "TEXT", "BAD_INDEX", NULL); + return TCL_ERROR; +} + +/* + *--------------------------------------------------------------------------- + * + * TkTextIndexAdjustToStartEnd -- + * + * Adjust indexPtr to the -startline/-endline range, or just check + * if indexPtr is out of this range. + * + * Results: + * The return value is a standard Tcl return result. If check is true, + * return TCL_ERROR if indexPtr is outside the -startline/-endline + * range (indexPtr is not modified). + * If check is false, adjust indexPtr to -startline/-endline. + * + * Side effects: + * None. + * + *--------------------------------------------------------------------------- + */ - if (textPtr) { - if (textPtr->start != NULL) { - int start; - TkTextIndex indexStart; - - start = TkBTreeLinesTo(NULL, textPtr->start); - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0, - &indexStart); - if (TkTextIndexCmp(indexPtr, &indexStart) < 0) { - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0, - indexPtr); +int +TkTextIndexAdjustToStartEnd( + TkText* textPtr, + TkTextIndex* indexPtr, /* Pointer to index. */ + int check) /* 1 means only check indexPtr against + * the -startline/-endline range + * 0 means adjust to this range */ +{ + int bound; + TkTextIndex indexBound; + + if (!textPtr) { + return TCL_OK; + } + if (textPtr->start != NULL) { + bound = TkBTreeLinesTo(NULL, textPtr->start); + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, + &indexBound); + if (TkTextIndexCmp(indexPtr, &indexBound) < 0) { + if (check) { + return TCL_ERROR; } + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, + indexPtr); } - if (textPtr->end != NULL) { - int end; - TkTextIndex indexEnd; - - end = TkBTreeLinesTo(NULL, textPtr->end); - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0, - &indexEnd); - if (TkTextIndexCmp(indexPtr, &indexEnd) > 0) { - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0, - indexPtr); + } + if (textPtr->end != NULL) { + bound = TkBTreeLinesTo(NULL, textPtr->end); + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, + &indexBound); + if (TkTextIndexCmp(indexPtr, &indexBound) > 0) { + if (check) { + return TCL_ERROR; } + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, + indexPtr); } } return TCL_OK; - - error: - Tcl_DStringFree(©); - Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad text index \"%s\"", string)); - Tcl_SetErrorCode(interp, "TK", "TEXT", "BAD_INDEX", NULL); - return TCL_ERROR; } /* diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index dcd7008..efc5b4c 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -434,8 +434,6 @@ TkTextMarkNameToIndex( TkTextIndex *indexPtr) /* Index information gets stored here. */ { TkTextSegment *segPtr; - TkTextIndex index; - int start, end; if (textPtr == NULL) { return TCL_ERROR; @@ -462,22 +460,10 @@ TkTextMarkNameToIndex( * (bug 1630271). */ - if (textPtr->start != NULL) { - start = TkBTreeLinesTo(NULL, textPtr->start); - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0, - &index); - if (TkTextIndexCmp(indexPtr, &index) < 0) { - return TCL_ERROR; - } - } - if (textPtr->end != NULL) { - end = TkBTreeLinesTo(NULL, textPtr->end); - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0, - &index); - if (TkTextIndexCmp(indexPtr, &index) > 0) { - return TCL_ERROR; - } + if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) { + return TCL_ERROR; } + return TCL_OK; } -- cgit v0.12 From 741cbd45247c2c1b3a4938047f7e4e9aba5add95 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 20:19:44 +0000 Subject: Fix style --- generic/tkText.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkText.h b/generic/tkText.h index a71a31e..512b27e 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -1161,7 +1161,7 @@ MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData); MODULE_SCOPE int TkTextIndexAdjustToStartEnd(TkText* textPtr, - TkTextIndex* indexPtr, int err); + TkTextIndex *indexPtr, int err); #endif /* _TKTEXT */ /* -- cgit v0.12 From ca1b22ae3f2a6d6160dfc3a537391a4b9eb1f4df Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 20:21:46 +0000 Subject: Fix style --- generic/tkText.h | 2 +- generic/tkTextIndex.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tkText.h b/generic/tkText.h index 512b27e..9898462 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -1160,7 +1160,7 @@ MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData); -MODULE_SCOPE int TkTextIndexAdjustToStartEnd(TkText* textPtr, +MODULE_SCOPE int TkTextIndexAdjustToStartEnd(TkText *textPtr, TkTextIndex *indexPtr, int err); #endif /* _TKTEXT */ diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 9320db8..6a7853d 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -1029,8 +1029,8 @@ GetIndex( int TkTextIndexAdjustToStartEnd( - TkText* textPtr, - TkTextIndex* indexPtr, /* Pointer to index. */ + TkText *textPtr, + TkTextIndex *indexPtr, /* Pointer to index. */ int check) /* 1 means only check indexPtr against * the -startline/-endline range * 0 means adjust to this range */ -- cgit v0.12 From 479d9861673212fae0bba018becfa2c08124e026 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 20:24:46 +0000 Subject: Fix [ea876b3e8a]: Text peer widget ignores set -startline when scrolling with the scrollbar. --- generic/tkTextDisp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a02544d..6453c06 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -5358,7 +5358,8 @@ TkTextSetYView( /* * If the specified position is the extra line at the end of the text, - * round it back to the last real line. + * round it back to the last real line. Also, adjust to the -starline + * and -endline limits. */ lineIndex = TkBTreeLinesTo(textPtr, indexPtr->linePtr); @@ -5366,6 +5367,7 @@ TkTextSetYView( TkTextIndexBackChars(textPtr, indexPtr, 1, &rounded, COUNT_INDICES); indexPtr = &rounded; } + TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 0); if (pickPlace == TK_TEXT_NOPIXELADJUST) { if (textPtr->topIndex.linePtr == indexPtr->linePtr -- cgit v0.12 From cadd5e537130fda5fd041a48f72d402b7227f853 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 20:35:50 +0000 Subject: Remove code that became useless since previous commit because TkTextSetYView() now adjusts the index to the -startline/-endline range. --- generic/tkText.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/generic/tkText.c b/generic/tkText.c index c41fc67..d1032e5 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -3284,14 +3284,6 @@ DeleteIndexRange( if (tPtr == textPtr) { if (viewUpdate) { - /* - * line cannot be before -startline of textPtr because - * this line corresponds to an index which is necessarily - * between "1.0" and "end" relative to textPtr. - * Therefore no need to clamp line to the -start/-end - * range. - */ - TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, line, byteIndex, &indexTmp); TkTextSetYView(tPtr, &indexTmp, 0); @@ -3299,27 +3291,6 @@ DeleteIndexRange( } else { TkTextMakeByteIndex(sharedTextPtr->tree, tPtr, line, byteIndex, &indexTmp); - /* - * line may be before -startline of tPtr and must be - * clamped to -startline before providing it to - * TkTextSetYView otherwise lines before -startline - * would be displayed. - * There is no need to worry about -endline however, - * because the view will only be reset if the deletion - * involves the TOP line of the screen - */ - - if (tPtr->start != NULL) { - int start; - TkTextIndex indexStart; - - start = TkBTreeLinesTo(NULL, tPtr->start); - TkTextMakeByteIndex(sharedTextPtr->tree, NULL, start, - 0, &indexStart); - if (TkTextIndexCmp(&indexTmp, &indexStart) < 0) { - indexTmp = indexStart; - } - } TkTextSetYView(tPtr, &indexTmp, 0); } } -- cgit v0.12 From cb943466b79e106344ad358375a968cc549fc94f Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 20:37:42 +0000 Subject: Add side effect description to TkTextSetYView() documentation. --- generic/tkTextDisp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 6453c06..814863b 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -5328,6 +5328,7 @@ TkTextRelayoutWindow( * The display will (eventually) be updated so that the position given by * "indexPtr" is visible on the screen at the position determined by * "pickPlace". + * indexPtr may be adjusted to the -startline/-endline range. * *---------------------------------------------------------------------- */ -- cgit v0.12 From 5c58251166dbac72b79ab9f699d6a3a27978f220 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 13 Apr 2021 21:03:07 +0000 Subject: Add non-regression test textDisp-11.22 --- tests/textDisp.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/textDisp.test b/tests/textDisp.test index 935f4a9..14b968f 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -1660,6 +1660,21 @@ test textDisp-11.21 {TkTextSetYView, window height smaller than the line height} .top.t see 1.0 .top.t index @0,[expr {$lineheight - 2}] } {1.0} +test textDisp-11.22 {TkTextSetYView, peer has -startline} { + .top.t delete 1.0 end + for {set i 1} {$i <= 50} {incr i} { + .top.t insert end "Line $i\n" + } + pack [.top.t peer create .top.p] -side left + pack [scrollbar .top.sb -command {.top.p yview}] -side left -fill y + .top.p configure -startline 5 -endline 35 -yscrollcommand {.top.sb set} + updateText + .top.p yview moveto 0 + updateText + set res [.top.p get @0,0 "@0,0 lineend"] + destroy .top.p + set res +} {Line 5} .t configure -wrap word .t delete 50.0 51.0 -- cgit v0.12 From 5402ff3258e600d59ed3086ec8ef814e4ee3a7d0 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 16 Apr 2021 21:32:09 +0000 Subject: Fix [0ca1768080]: @x,y index and insert mark placement --- doc/text.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/text.n b/doc/text.n index ecec988..73add92 100644 --- a/doc/text.n +++ b/doc/text.n @@ -2031,7 +2031,7 @@ In the descriptions below, is dependent on the value of the \fBtcl_wordchars\fR variable. See \fBtclvars\fR(n). .IP [1] -Clicking mouse button 1 positions the insertion cursor just before the +Clicking mouse button 1 positions the insertion cursor at the closest edge of the character underneath the mouse cursor, sets the input focus to this widget, and clears any selection in the widget. Dragging with mouse button 1 strokes out a selection between the insertion cursor and the character under the -- cgit v0.12 From ff1d4e80428df056e3929f7b9829308353c45ebf Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 12:31:16 +0000 Subject: Backout the first three commits of the present branch, and implement a better fix. It's not the business of TkTextSetYView() to adjust the index it's receiving, it shall rather receive an index that is already within the -starline/-endline limits. --- generic/tkText.c | 30 ++++++++++++++++++++++++++++++ generic/tkTextBTree.c | 20 ++++++++++++++++++++ generic/tkTextDisp.c | 5 +---- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/generic/tkText.c b/generic/tkText.c index d1032e5..2938c28 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -3284,6 +3284,14 @@ DeleteIndexRange( if (tPtr == textPtr) { if (viewUpdate) { + /* + * line cannot be before -startline of textPtr because + * this line corresponds to an index which is necessarily + * between "1.0" and "end" relative to textPtr. + * Therefore no need to clamp line to the -start/-end + * range. + */ + TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, line, byteIndex, &indexTmp); TkTextSetYView(tPtr, &indexTmp, 0); @@ -3291,6 +3299,28 @@ DeleteIndexRange( } else { TkTextMakeByteIndex(sharedTextPtr->tree, tPtr, line, byteIndex, &indexTmp); + /* + * line may be before -startline of tPtr and must be + * clamped to -startline before providing it to + * TkTextSetYView otherwise lines before -startline + * would be displayed. + * There is no need to worry about -endline however, + * because the view will only be reset if the deletion + * involves the TOP line of the screen + */ + + if (tPtr->start != NULL) { + int start; + TkTextIndex indexStart; + + start = TkBTreeLinesTo(NULL, tPtr->start); + TkTextMakeByteIndex(sharedTextPtr->tree, NULL, start, + 0, &indexStart); + if (TkTextIndexCmp(&indexTmp, &indexStart) < 0) { + indexTmp = indexStart; + printf("ADJUSTED !!!!!!!!!!!!!!!!!!!!!!\n"); + } + } TkTextSetYView(tPtr, &indexTmp, 0); } } diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 7832992..1b65cbc 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -1727,6 +1727,26 @@ TkBTreeFindPixelLine( } pixels -= linePtr->pixels[2 * pixelReference]; } + + /* + * Check for any start/end offset for this text widget. + */ + + if (textPtr->start != NULL) { + int lineBoundary = TkBTreeLinesTo(NULL, textPtr->start); + + if (TkBTreeLinesTo(NULL, linePtr) < lineBoundary) { + linePtr = TkBTreeFindLine(tree, NULL, lineBoundary); + } + } + if (textPtr->end != NULL) { + int lineBoundary = TkBTreeLinesTo(NULL, textPtr->end); + + if (TkBTreeLinesTo(NULL, linePtr) > lineBoundary) { + linePtr = TkBTreeFindLine(tree, NULL, lineBoundary); + } + } + if (pixelOffset != NULL && linePtr != NULL) { *pixelOffset = pixels; } diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 814863b..a02544d 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -5328,7 +5328,6 @@ TkTextRelayoutWindow( * The display will (eventually) be updated so that the position given by * "indexPtr" is visible on the screen at the position determined by * "pickPlace". - * indexPtr may be adjusted to the -startline/-endline range. * *---------------------------------------------------------------------- */ @@ -5359,8 +5358,7 @@ TkTextSetYView( /* * If the specified position is the extra line at the end of the text, - * round it back to the last real line. Also, adjust to the -starline - * and -endline limits. + * round it back to the last real line. */ lineIndex = TkBTreeLinesTo(textPtr, indexPtr->linePtr); @@ -5368,7 +5366,6 @@ TkTextSetYView( TkTextIndexBackChars(textPtr, indexPtr, 1, &rounded, COUNT_INDICES); indexPtr = &rounded; } - TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 0); if (pickPlace == TK_TEXT_NOPIXELADJUST) { if (textPtr->topIndex.linePtr == indexPtr->linePtr -- cgit v0.12 From 4746d38d07091977274df1faa0b6f3a06fdb7118 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 12:32:55 +0000 Subject: Remove leftover debug line --- generic/tkText.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tkText.c b/generic/tkText.c index 2938c28..c41fc67 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -3318,7 +3318,6 @@ DeleteIndexRange( 0, &indexStart); if (TkTextIndexCmp(&indexTmp, &indexStart) < 0) { indexTmp = indexStart; - printf("ADJUSTED !!!!!!!!!!!!!!!!!!!!!!\n"); } } TkTextSetYView(tPtr, &indexTmp, 0); -- cgit v0.12 From bbe6a7d31d30a7e5da059feb23f94f1412dbf307 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 13:11:42 +0000 Subject: Fix old commit [5528cb094a]. This commit changed NULL into tPtr in the call to TkTextMakeByteIndex() and introduced a check against -startline. However from then on this check is always false since the index returned by TkTextMakeByteIndex() is relative to tPtr and can never be located before the -startline of this peer. The error in [5528cb094a] was to replace NULL by tPtr. The line in this call is relative to textPtr, not to a peer tPtr, and NULL must be kept (and then the check against -startline is useful and runs in several tests of the test suite). --- generic/tkText.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkText.c b/generic/tkText.c index c41fc67..d2a1691 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -3297,7 +3297,7 @@ DeleteIndexRange( TkTextSetYView(tPtr, &indexTmp, 0); } } else { - TkTextMakeByteIndex(sharedTextPtr->tree, tPtr, line, + TkTextMakeByteIndex(sharedTextPtr->tree, NULL, line, byteIndex, &indexTmp); /* * line may be before -startline of tPtr and must be -- cgit v0.12 From 4326a851599c3a7f651a1731ed5366d01043e16f Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 13:16:24 +0000 Subject: Augment test text-32.3 so that it fails if previous commit is backed out. --- tests/text.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/text.test b/tests/text.test index 6bd0ae4..9ee0eff 100644 --- a/tests/text.test +++ b/tests/text.test @@ -7419,10 +7419,10 @@ test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup { .pt delete 2.0 3.0 # moreover -startline shall be correct # (was wrong before fixing bug 1630262) - lappend res [.t cget -start] [.pt cget -start] + lappend res [.t cget -start] [.pt cget -start] [.t get @0,0 "@0,0 lineend"] } -cleanup { destroy .pt -} -result {4 3} +} -result {4 3 {Line 5}} test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup { destroy .t .pt -- cgit v0.12 From ad62abdbadab35439f45dcb00a2cce9f18526da6 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 13:28:40 +0000 Subject: Avoid code duplication by calling TkTextIndexAdjustToStartEnd(). --- generic/tkText.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/generic/tkText.c b/generic/tkText.c index d2a1691..90ec575 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -3306,20 +3306,12 @@ DeleteIndexRange( * would be displayed. * There is no need to worry about -endline however, * because the view will only be reset if the deletion - * involves the TOP line of the screen + * involves the TOP line of the screen. That said, + * the following call adjusts to both. */ - if (tPtr->start != NULL) { - int start; - TkTextIndex indexStart; + TkTextIndexAdjustToStartEnd(tPtr, &indexTmp, 0); - start = TkBTreeLinesTo(NULL, tPtr->start); - TkTextMakeByteIndex(sharedTextPtr->tree, NULL, start, - 0, &indexStart); - if (TkTextIndexCmp(&indexTmp, &indexStart) < 0) { - indexTmp = indexStart; - } - } TkTextSetYView(tPtr, &indexTmp, 0); } } -- cgit v0.12 From 4ce78e47119129fea86ddbdb477ee2f562377bde Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 17:28:39 +0000 Subject: Cosmetic style changes --- generic/tkTextIndex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 6a7853d..a876711 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -1044,25 +1044,25 @@ TkTextIndexAdjustToStartEnd( if (textPtr->start != NULL) { bound = TkBTreeLinesTo(NULL, textPtr->start); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, - &indexBound); + &indexBound); if (TkTextIndexCmp(indexPtr, &indexBound) < 0) { if (check) { return TCL_ERROR; } TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, - indexPtr); + indexPtr); } } if (textPtr->end != NULL) { bound = TkBTreeLinesTo(NULL, textPtr->end); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, - &indexBound); + &indexBound); if (TkTextIndexCmp(indexPtr, &indexBound) > 0) { if (check) { return TCL_ERROR; } TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, bound, 0, - indexPtr); + indexPtr); } } return TCL_OK; -- cgit v0.12 From 5c6873217a6652c98e1919d47deb0da3a46b0ed4 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Apr 2021 21:52:30 +0000 Subject: Fix [3540e4929cd]: Revised [text]: textDisp-17.10 fails. The tests of the TkTextScanCmd procedure combine xview, yview and scan commands, and typically check what is the resulting index @0,0. However, the text widget updates its view at idle time, and the tests shall take this fact into account, otherwise the results may be linked between tests. Especially textDisp-17.9 has wrong expected result (see also commit [bf453137e1]). --- tests/textDisp.test | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/textDisp.test b/tests/textDisp.test index 935f4a9..ac80069 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -2352,45 +2352,61 @@ test textDisp-17.5 {TkTextScanCmd procedure} { test textDisp-17.6 {TkTextScanCmd procedure} {textfonts} { .t yview 1.0 .t xview moveto 0 + updateText .t scan mark 40 60 .t scan dragto 35 55 + updateText .t index @0,0 } {4.7} test textDisp-17.7 {TkTextScanCmd procedure} {textfonts} { .t yview 10.0 .t xview moveto 0 + updateText .t xview scroll 20 units + updateText .t scan mark -10 60 .t scan dragto -5 65 + updateText .t index @0,0 set x [.t index @0,0] .t scan dragto 0 [expr {70 + $fixedDiff}] + updateText list $x [.t index @0,0] } {6.12 2.5} test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} { .t yview 1.0 .t xview moveto 0 + updateText .t scan mark 0 60 .t scan dragto 30 100 + updateText .t scan dragto 25 95 + updateText .t index @0,0 } {4.7} test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} { .t yview end .t xview moveto 0 + updateText .t xview scroll 100 units + updateText .t scan mark 90 60 .t scan dragto 10 0 + updateText .t scan dragto 14 5 + updateText .t index @0,0 -} {18.44} +} {14.44} .t configure -wrap word test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {textfonts} { .t yview 10.0 + updateText .t scan mark -10 60 .t scan dragto -5 65 + updateText set x [.t index @0,0] .t scan dragto 0 [expr {70 + $fixedDiff}] + updateText list $x [.t index @0,0] } {9.0 8.0} .t configure -xscrollcommand scroll -yscrollcommand {} -- cgit v0.12 From 509182fab829214dd2ab6c6d2c31b4d7aabf9fd7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 18 Apr 2021 08:56:40 +0000 Subject: Trying to get the index of an embedded image or window should trigger an error when located outside of -startline/-endline (same as for marks, this was bug [1630271fff]). --- generic/tkTextImage.c | 23 +++++++++++++++++------ generic/tkTextIndex.c | 8 ++++---- generic/tkTextMark.c | 3 ++- generic/tkTextWind.c | 23 +++++++++++++++++------ tests/textIndex.test | 20 ++++++++++++++++++-- 5 files changed, 58 insertions(+), 19 deletions(-) diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index bc0da0a..b396314 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -764,9 +764,9 @@ EmbImageBboxProc( * index corresponding to the image's position in the text. * * Results: - * The return value is 1 if there is an embedded image by the given name - * in the text widget, 0 otherwise. If the image exists, *indexPtr is - * filled in with its index. + * The return value is TCL_OK if there is an embedded image by the given + * name in the text widget, TCL_ERROR otherwise. If the image exists, + * *indexPtr is filled in with its index. * * Side effects: * None. @@ -784,18 +784,29 @@ TkTextImageIndex( TkTextSegment *eiPtr; if (textPtr == NULL) { - return 0; + return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name); if (hPtr == NULL) { - return 0; + return TCL_ERROR; } eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); - return 1; + + /* + * If indexPtr refers to somewhere outside the -startline/-endline + * range limits of the widget, error out since the image indeed is not + * reachable from this text widget (it may be reachable from a peer). + */ + + if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) { + return TCL_ERROR; + } + + return TCL_OK; } /* diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index a876711..e6632d0 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -761,11 +761,11 @@ GetIndex( goto done; } - if (TkTextWindowIndex(textPtr, string, indexPtr) != 0) { + if (TkTextWindowIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } - if (TkTextImageIndex(textPtr, string, indexPtr) != 0) { + if (TkTextImageIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } @@ -917,7 +917,7 @@ GetIndex( *endOfBase = 0; result = TkTextWindowIndex(textPtr, Tcl_DStringValue(©), indexPtr); *endOfBase = c; - if (result != 0) { + if (result == TCL_OK) { goto gotBase; } } @@ -954,7 +954,7 @@ GetIndex( *endOfBase = 0; result = TkTextImageIndex(textPtr, Tcl_DStringValue(©), indexPtr); *endOfBase = c; - if (result != 0) { + if (result == TCL_OK) { goto gotBase; } } diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index efc5b4c..f77e6b4 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -454,7 +454,8 @@ TkTextMarkNameToIndex( } TkTextMarkSegToIndex(textPtr, segPtr, indexPtr); - /* If indexPtr refers to somewhere outside the -startline/-endline + /* + * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the mark indeed is not * reachable from this text widget (it may be reachable from a peer) * (bug 1630271). diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c9f34e4..2d9c5a1 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -1320,9 +1320,9 @@ EmbWinDelayedUnmap( * index corresponding to the window's position in the text. * * Results: - * The return value is 1 if there is an embedded window by the given name - * in the text widget, 0 otherwise. If the window exists, *indexPtr is - * filled in with its index. + * The return value is TCL_OK if there is an embedded window by the given + * name in the text widget, TCL_ERROR otherwise. If the window exists, + * *indexPtr is filled in with its index. * * Side effects: * None. @@ -1340,19 +1340,30 @@ TkTextWindowIndex( TkTextSegment *ewPtr; if (textPtr == NULL) { - return 0; + return TCL_ERROR; } hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable, name); if (hPtr == NULL) { - return 0; + return TCL_ERROR; } ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); - return 1; + + /* + * If indexPtr refers to somewhere outside the -startline/-endline + * range limits of the widget, error out since the image indeed is not + * reachable from this text widget (it may be reachable from a peer). + */ + + if (TkTextIndexAdjustToStartEnd(textPtr, indexPtr, 1) == TCL_ERROR) { + return TCL_ERROR; + } + + return TCL_OK; } /* diff --git a/tests/textIndex.test b/tests/textIndex.test index 4d509c9..a7b01e2 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -972,14 +972,30 @@ test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline lappend res [.p2 index "end"] lappend res [.p2 index "end lineend"] lappend res [.p2 index "end display lineend"] + destroy .t2 .p2 + set res +} {2.0 2.0 2.0} +test textIndex-26.2 {GetIndex errors out if mark, image or window is outside -starline/-endline, bug [34db75c0ac]} { + set res {} + pack [text .t2] + .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n" + pack [.t2 peer create .p2 -startline 2 -endline 3] .p2 configure -startline 3 -endline {} + .t2 mark set 1.0 mymark + catch {.p2 index mymark} msg + lappend res $msg image create photo redsquare -width 5 -height 5 redsquare put red -to 0 0 4 4 .t2 image create 1.0 -image redsquare - lappend res [.p2 index redsquare] + catch {.p2 index redsquare} msg + lappend res $msg + frame .f -width 10 -height 10 -bg blue + .t2 window create 1.2 -window .f + catch {.p2 index .f} msg + lappend res $msg destroy .t2 .p2 set res -} {2.0 2.0 2.0 1.0} +} {{bad text index "mymark"} {bad text index "redsquare"} {bad text index ".f"}} # cleanup -- cgit v0.12 From 9e9211dce64192332846e2dec40c3bb1d0c1190b Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 18 Apr 2021 09:00:53 +0000 Subject: Fix syntax error in textIndex-26.2 testcase. --- tests/textIndex.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/textIndex.test b/tests/textIndex.test index a7b01e2..b5cac7f 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -981,7 +981,7 @@ test textIndex-26.2 {GetIndex errors out if mark, image or window is outside -st .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n" pack [.t2 peer create .p2 -startline 2 -endline 3] .p2 configure -startline 3 -endline {} - .t2 mark set 1.0 mymark + .t2 mark set mymark 1.0 catch {.p2 index mymark} msg lappend res $msg image create photo redsquare -width 5 -height 5 -- cgit v0.12 From 0f1e51cfe0d1bd2c5ad4a06d4149db9407294aa7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 18 Apr 2021 09:15:10 +0000 Subject: Extend textIndex-26.2 to tags located outside -startline/-endline --- tests/textIndex.test | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/textIndex.test b/tests/textIndex.test index b5cac7f..1c5baeb 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -975,7 +975,7 @@ test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline destroy .t2 .p2 set res } {2.0 2.0 2.0} -test textIndex-26.2 {GetIndex errors out if mark, image or window is outside -starline/-endline, bug [34db75c0ac]} { +test textIndex-26.2 {GetIndex errors out if mark, image, window, or tag is outside peer -starline/-endline, bug [34db75c0ac]} { set res {} pack [text .t2] .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n" @@ -983,19 +983,23 @@ test textIndex-26.2 {GetIndex errors out if mark, image or window is outside -st .p2 configure -startline 3 -endline {} .t2 mark set mymark 1.0 catch {.p2 index mymark} msg - lappend res $msg + lappend res [.t2 index mymark] $msg image create photo redsquare -width 5 -height 5 redsquare put red -to 0 0 4 4 .t2 image create 1.0 -image redsquare catch {.p2 index redsquare} msg - lappend res $msg + lappend res [.t2 index redsquare] $msg frame .f -width 10 -height 10 -bg blue .t2 window create 1.2 -window .f catch {.p2 index .f} msg - lappend res $msg + lappend res [.t2 index .f] $msg + .t2 tag add mytag 1.3 + catch {.p2 index mytag.first} msg + lappend res [.t2 index mytag.first] $msg destroy .t2 .p2 set res -} {{bad text index "mymark"} {bad text index "redsquare"} {bad text index ".f"}} +} {1.0 {bad text index "mymark"} 1.0 {bad text index "redsquare"} 1.2\ + {bad text index ".f"} 1.3 {text doesn't contain any characters tagged with "mytag"}} # cleanup -- cgit v0.12 From 47ae36d9d12864e62e6ac7e1369acac839edccef Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 18 Apr 2021 09:17:32 +0000 Subject: Remove extra empty line. --- tests/textIndex.test | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/textIndex.test b/tests/textIndex.test index 1c5baeb..31ae495 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -1001,7 +1001,6 @@ test textIndex-26.2 {GetIndex errors out if mark, image, window, or tag is outsi } {1.0 {bad text index "mymark"} 1.0 {bad text index "redsquare"} 1.2\ {bad text index ".f"} 1.3 {text doesn't contain any characters tagged with "mytag"}} - # cleanup rename textimage {} catch {destroy .t} -- cgit v0.12 From 78797315675059bb90c1e59407b5394fb6e48d8f Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 18 Apr 2021 09:31:02 +0000 Subject: Slightly simplify test textMark-6.6 --- tests/textMark.test | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/textMark.test b/tests/textMark.test index 1335464..4d2e623 100644 --- a/tests/textMark.test +++ b/tests/textMark.test @@ -186,9 +186,8 @@ test textMark-6.6 {attempt to move the insert mark beyond peer -endline - bug 34 .t peer create .p -startline 1 -endline 2 pack .p update - .p mark set insert 1.0 + .p mark set insert 1.2 focus -force .p - event generate .p <> event generate .p <> ; # shall not error out set res [.p index insert] } -cleanup { -- cgit v0.12 From edbabbf9f332476a02f8d6779ff5df28520a3af2 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 18 Apr 2021 10:18:52 +0000 Subject: Fix copy/paste error in comment. --- generic/tkTextWind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 2d9c5a1..cb8e533 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -1355,7 +1355,7 @@ TkTextWindowIndex( /* * If indexPtr refers to somewhere outside the -startline/-endline - * range limits of the widget, error out since the image indeed is not + * range limits of the widget, error out since the window indeed is not * reachable from this text widget (it may be reachable from a peer). */ -- cgit v0.12 From 1620864ea3524ac3bf9cf1a1de9d594908654617 Mon Sep 17 00:00:00 2001 From: culler Date: Mon, 19 Apr 2021 15:44:04 +0000 Subject: Additional fixes to Aqua default colors and handling of fieldbackground for entry and spinbox widgets. Thanks to Christopher Chavez for patches. --- library/ttk/aquaTheme.tcl | 6 ++---- macosx/tkMacOSXDefault.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 9896021..876423f 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -44,8 +44,7 @@ namespace eval ttk::theme::aqua { # Entry ttk::style configure TEntry \ -foreground systemTextColor \ - -background systemTextBackgroundColor \ - -fieldbackground systemTextBackgroundColor + -background systemTextBackgroundColor ttk::style map TEntry \ -foreground { disabled systemDisabledControlTextColor @@ -66,8 +65,7 @@ namespace eval ttk::theme::aqua { # Spinbox ttk::style configure TSpinbox \ -foreground systemTextColor \ - -background systemTextBackgroundColor \ - -fieldbackground systemTextBackgroundColor + -background systemTextBackgroundColor ttk::style map TSpinbox \ -foreground { disabled systemDisabledControlTextColor diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 096e6b1..15677a1 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -124,7 +124,7 @@ #define DEF_CANVAS_CURSOR "" #define DEF_CANVAS_HEIGHT "7c" #define DEF_CANVAS_HIGHLIGHT_BG NORMAL_BG -#define DEF_CANVAS_HIGHLIGHT BLACK +#define DEF_CANVAS_HIGHLIGHT NORMAL_FG #define DEF_CANVAS_HIGHLIGHT_WIDTH "3" #define DEF_CANVAS_INSERT_BG BLACK #define DEF_CANVAS_INSERT_BD_COLOR "0" @@ -174,7 +174,7 @@ #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG -#define DEF_ENTRY_HIGHLIGHT BLACK +#define DEF_ENTRY_HIGHLIGHT NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" #define DEF_ENTRY_INSERT_BG NORMAL_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" @@ -212,7 +212,7 @@ #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG -#define DEF_FRAME_HIGHLIGHT BLACK +#define DEF_FRAME_HIGHLIGHT NORMAL_FG #define DEF_FRAME_HIGHLIGHT_WIDTH "0" #define DEF_FRAME_PADX "0" #define DEF_FRAME_PADY "0" @@ -248,7 +248,7 @@ #define DEF_LISTBOX_FG NORMAL_FG #define DEF_LISTBOX_HEIGHT "10" #define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG -#define DEF_LISTBOX_HIGHLIGHT BLACK +#define DEF_LISTBOX_HIGHLIGHT NORMAL_FG #define DEF_LISTBOX_HIGHLIGHT_WIDTH "0" #define DEF_LISTBOX_JUSTIFY "left" #define DEF_LISTBOX_RELIEF "solid" @@ -343,7 +343,7 @@ #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO -#define DEF_MENUBUTTON_HIGHLIGHT BLACK +#define DEF_MENUBUTTON_HIGHLIGHT NORMAL_FG #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" #define DEF_MENUBUTTON_IMAGE NULL #define DEF_MENUBUTTON_INDICATOR "1" @@ -373,7 +373,7 @@ #define DEF_MESSAGE_FG NORMAL_FG #define DEF_MESSAGE_FONT "TkDefaultFont" #define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG -#define DEF_MESSAGE_HIGHLIGHT BLACK +#define DEF_MESSAGE_HIGHLIGHT NORMAL_FG #define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" #define DEF_MESSAGE_JUSTIFY "left" #define DEF_MESSAGE_PADX "-1" @@ -439,7 +439,7 @@ #define DEF_SCALE_FROM "0" #define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR #define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO -#define DEF_SCALE_HIGHLIGHT BLACK +#define DEF_SCALE_HIGHLIGHT NORMAL_FG #define DEF_SCALE_HIGHLIGHT_WIDTH "0" #define DEF_SCALE_LABEL "" #define DEF_SCALE_LENGTH "100" @@ -474,7 +474,7 @@ #define DEF_SCROLLBAR_CURSOR "" #define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1" #define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG -#define DEF_SCROLLBAR_HIGHLIGHT BLACK +#define DEF_SCROLLBAR_HIGHLIGHT NORMAL_FG #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" -- cgit v0.12 From a343f35f005c6b08ad2c523b24ab68527019d4fb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 19 Apr 2021 16:41:18 +0000 Subject: Sync rules.vc with Tcl --- win/rules.vc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/win/rules.vc b/win/rules.vc index 85c37f2..a5690ef 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1260,7 +1260,13 @@ tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" # Various output paths PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib -PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +PRJLIBNAME8 = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +PRJLIBNAME9 = tcl9$(PROJECT)$(VERSION)$(SUFX).$(EXT) +!if $(TCL_MAJOR_VERSION) == 8 +PRJLIBNAME = $(PRJLIBNAME8) +!else +PRJLIBNAME = $(PRJLIBNAME9) +!endif PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib -- cgit v0.12 From 269976f190336ef9eb04dea3a593de5c67b807e4 Mon Sep 17 00:00:00 2001 From: culler Date: Mon, 19 Apr 2021 21:27:46 +0000 Subject: Eliminate the one call to setTkDirtyRect, which is unnecessary. --- macosx/tkMacOSXWm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 3c23308..4f073d8 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6309,8 +6309,7 @@ TkpRedrawWidget(Tk_Window tkwin) { [view bounds].size.height - tkBounds.bottom, tkBounds.right - tkBounds.left, tkBounds.bottom - tkBounds.top); - [view setTkNeedsDisplay:YES]; - [view setTkDirtyRect:bounds]; + [view addTkDirtyRect:bounds]; } } -- cgit v0.12 From 423b0ae36f245b340d14ab4ed3ec0fdf15dc71cc Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 20 Apr 2021 21:44:01 +0000 Subject: fix [cde766f911]: scrollbars do not update correctly for treeview widgets. --- macosx/tkMacOSXDraw.c | 72 +++++++++++++++++++++++++++--------------------- macosx/tkMacOSXPrivate.h | 3 +- macosx/tkMacOSXRegion.c | 49 ++++++++++++++++++++++++++++++++ macosx/ttkMacOSXTheme.c | 24 ++++++++++++---- 4 files changed, 109 insertions(+), 39 deletions(-) diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index ac5c721..63decb7 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -513,7 +513,7 @@ XDrawSegments( * * XFillPolygon -- * - * Draws a filled polygon. + * Draws a filled polygon using the even-odd fill algorithm, * * Results: * None. @@ -531,7 +531,7 @@ XFillPolygon( GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ - TCL_UNUSED(int), /* Shape to draw. */ + TCL_UNUSED(int), /* Shape to draw. */ int mode) /* Drawing mode. */ { MacDrawable *macWin = (MacDrawable *)d; @@ -1300,7 +1300,6 @@ TkMacOSXSetupDrawingContext( dc.portBounds = CGContextGetClipBoundingBox(dc.context); } else { NSRect drawingBounds, currentBounds; - dc.view = view; dc.context = GET_CGCONTEXT; dc.portBounds = NSRectToCGRect([view bounds]); @@ -1355,37 +1354,46 @@ TkMacOSXSetupDrawingContext( * Finish configuring the drawing context. */ - { - CGAffineTransform t = { - .a = 1, .b = 0, - .c = 0, .d = -1, - .tx = 0, - .ty = dc.portBounds.size.height - }; + CGAffineTransform t = { + .a = 1, .b = 0, + .c = 0, .d = -1, + .tx = 0, + .ty = dc.portBounds.size.height + }; - dc.portBounds.origin.x += macDraw->xOff; - dc.portBounds.origin.y += macDraw->yOff; - CGContextSaveGState(dc.context); - CGContextSetTextDrawingMode(dc.context, kCGTextFill); - CGContextConcatCTM(dc.context, t); - if (dc.clipRgn) { + dc.portBounds.origin.x += macDraw->xOff; + dc.portBounds.origin.y += macDraw->yOff; + CGContextSaveGState(dc.context); + CGContextSetTextDrawingMode(dc.context, kCGTextFill); + CGContextConcatCTM(dc.context, t); + if (dc.clipRgn) { #ifdef TK_MAC_DEBUG_DRAWING - CGContextSaveGState(dc.context); - ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); - CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); - CGContextEOFillPath(dc.context); - CGContextRestoreGState(dc.context); + CGContextSaveGState(dc.context); + ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); + CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); + CGContextEOFillPath(dc.context); + CGContextRestoreGState(dc.context); #endif /* TK_MAC_DEBUG_DRAWING */ + if (!HIShapeIsRectangular(dc.clipRgn)) { + + /* + * We expect the clipping path dc.clipRgn to consist of the + * bounding rectangle of the drawable window, together with + * disjoint smaller rectangles inside of it which bound its + * geometric children. In that case the even-odd rule will + * clip to the region inside the large rectangle and outside + * of the smaller rectangles. + */ + + ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); + CGContextEOClip(dc.context); + } + else { CGRect r; - CGRect b = CGRectApplyAffineTransform( - CGContextGetClipBoundingBox(dc.context), t); - if (!HIShapeIsRectangular(dc.clipRgn) || - !CGRectContainsRect(*HIShapeGetBounds(dc.clipRgn, &r), b)) { - ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); - CGContextEOClip(dc.context); - } + HIShapeGetBounds(dc.clipRgn, &r); + CGContextClipToRect(dc.context, r); } } if (gc) { @@ -1405,8 +1413,8 @@ TkMacOSXSetupDrawingContext( TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); if (view) { - CGContextSetPatternPhase(dc.context, CGSizeMake( - dc.portBounds.size.width, dc.portBounds.size.height)); + CGContextSetPatternPhase(dc.context, + CGSizeMake(dc.portBounds.size.width, dc.portBounds.size.height)); } if (gc->function != GXcopy) { TkMacOSXDbgMsg("Logical functions other than GXcopy are " @@ -1446,8 +1454,8 @@ TkMacOSXSetupDrawingContext( end: #ifdef TK_MAC_DEBUG_DRAWING - if (!canDraw && win != NULL) { - TkWindow *winPtr = TkMacOSXGetTkWindow(win); + if (!canDraw && macDraw->winPtr != NULL) { + TkWindow *winPtr = macDraw->winPtr; if (winPtr) { fprintf(stderr, "Cannot draw in %s - postponing.\n", diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index ed24255..0bd46c6 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -231,7 +231,8 @@ MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape, const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1, HIShapeRef inShape2, HIMutableShapeRef outResult); - +MODULE_SCOPE int TkMacOSXCountRectsInRegion(HIShapeRef shape); +MODULE_SCOPE void TkMacOSXPrintRectsInRegion(HIShapeRef shape); /* * Prototypes of TkAqua internal procs. */ diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 6c70a63..3c168f1 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -555,6 +555,55 @@ TkMacOSHIShapeUnion( return result; } +static OSStatus +rectCounter( + int msg, + TCL_UNUSED(HIShapeRef), + const CGRect *rect, + void *ref) +{ + int *count = (int *)ref; + (*count)++; + return noErr; +} + +static OSStatus +rectPrinter( + int msg, + TCL_UNUSED(HIShapeRef), + const CGRect *rect, + void *ref) +{ + if (rect) { + printf(" %s\n", NSStringFromRect(*rect).UTF8String); + } + return noErr; +} + +int +TkMacOSXCountRectsInRegion( + HIShapeRef shape) +{ + int rect_count = 0; + if (!HIShapeIsEmpty(shape)) { + ChkErr(HIShapeEnumerate, shape, + kHIShapeParseFromBottom|kHIShapeParseFromLeft, + rectCounter, &rect_count); + } + return rect_count; +} + +void +TkMacOSXPrintRectsInRegion( + HIShapeRef shape) +{ + if (!HIShapeIsEmpty(shape)) { + ChkErr(HIShapeEnumerate, shape, + kHIShapeParseFromBottom|kHIShapeParseFromLeft, + rectPrinter, NULL); + } +} + /* * Local Variables: * mode: objc diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 92c5156..c4e1f33 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -36,10 +36,22 @@ * Macros for handling drawing contexts. */ -#define BEGIN_DRAWING(d) { \ - TkMacOSXDrawingContext dc; \ - if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) {return;} -#define END_DRAWING \ +#define BEGIN_DRAWING(d) { \ + TkMacOSXDrawingContext dc; \ + if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) { \ + return; \ + } \ + +#define BEGIN_DRAWING_OR_REDRAW(d) { \ + TkMacOSXDrawingContext dc; \ + if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) { \ + NSView *view = TkMacOSXGetNSViewForDrawable(d); \ + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} \ + [(TKContentView *)view addTkDirtyRect:[view bounds]]; \ + return; \ + } \ + +#define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc);} #define HIOrientation kHIThemeOrientationNormal @@ -1602,7 +1614,7 @@ static void TabElementDraw( .position = Ttk_StateTableLookup(TabPositionTable, state), }; - BEGIN_DRAWING(d) + BEGIN_DRAWING_OR_REDRAW(d) if (TkMacOSXInDarkMode(tkwin)) { DrawDarkTab(bounds, state, dc.context); } else { @@ -2794,7 +2806,7 @@ static void FillElementDraw( NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *bgColor; CGFloat fill[4]; - BEGIN_DRAWING(d) + BEGIN_DRAWING_OR_REDRAW(d) GetBackgroundColor(dc.context, tkwin, 0, fill); bgColor = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; -- cgit v0.12 From e59ae0fe4812c0469f997d5f59bd7f2b9b918400 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 21 Apr 2021 09:30:17 +0000 Subject: Sync rules.vc with Tcl --- win/rules.vc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index a5690ef..19f0dd8 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1596,12 +1596,22 @@ default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL) default-pkgindex: + @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ - [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl + [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } else { >> $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } >> $(OUT_DIR)\pkgIndex.tcl !else default-pkgindex: + @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } else { >> $(OUT_DIR)\pkgIndex.tcl @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ - [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl + [list load [file join $$dir $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo } >> $(OUT_DIR)\pkgIndex.tcl !endif default-pkgindex-tea: @@ -1610,6 +1620,8 @@ default-pkgindex-tea: @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) +@PKG_LIB_FILE8@ $(PRJLIBNAME8) +@PKG_LIB_FILE9@ $(PRJLIBNAME9) << default-install: default-install-binaries default-install-libraries -- cgit v0.12 From 72e0feb39295be994a1f27da8a89e12605a8fbf5 Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 21 Apr 2021 12:13:33 +0000 Subject: Clean up debugging code in tkMacOSXDraw.c --- macosx/tkMacOSXDraw.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 63decb7..bf6a4a7 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1455,12 +1455,8 @@ end: #ifdef TK_MAC_DEBUG_DRAWING if (!canDraw && macDraw->winPtr != NULL) { - TkWindow *winPtr = macDraw->winPtr; - - if (winPtr) { - fprintf(stderr, "Cannot draw in %s - postponing.\n", - Tk_PathName(winPtr)); - } + fprintf(stderr, "Cannot draw in %s - postponing.\n", + Tk_PathName(macDraw->winPtr)); } #endif -- cgit v0.12 From 68040c67a97bac21a3c6558217ffec8273aa114e Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 21 Apr 2021 21:42:17 +0000 Subject: How did BEGIN_DRAWING_OR_REDRAW end up in the wrong place? --- macosx/ttkMacOSXTheme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index c4e1f33..5a9057c 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -2541,7 +2541,7 @@ static void ThumbElementDraw( thumbColor = [NSColor colorWithColorSpace: deviceRGB components: rgba count: 4]; - BEGIN_DRAWING(d) + BEGIN_DRAWING_OR_REDRAW(d) SolidFillRoundedRectangle(dc.context, thumbBounds, 4, thumbColor); END_DRAWING } else { @@ -2806,7 +2806,7 @@ static void FillElementDraw( NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *bgColor; CGFloat fill[4]; - BEGIN_DRAWING_OR_REDRAW(d) + BEGIN_DRAWING(d) GetBackgroundColor(dc.context, tkwin, 0, fill); bgColor = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; -- cgit v0.12 From ebcc71e5fa8f626759fb83cfa19bf70c4094298d Mon Sep 17 00:00:00 2001 From: culler Date: Thu, 22 Apr 2021 13:05:42 +0000 Subject: Cherrypick removal of BEGIN_DRAWING_OR_REDRAW --- macosx/ttkMacOSXTheme.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 5a9057c..64cbce6 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -42,15 +42,6 @@ return; \ } \ -#define BEGIN_DRAWING_OR_REDRAW(d) { \ - TkMacOSXDrawingContext dc; \ - if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) { \ - NSView *view = TkMacOSXGetNSViewForDrawable(d); \ - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} \ - [(TKContentView *)view addTkDirtyRect:[view bounds]]; \ - return; \ - } \ - #define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc);} @@ -1614,7 +1605,7 @@ static void TabElementDraw( .position = Ttk_StateTableLookup(TabPositionTable, state), }; - BEGIN_DRAWING_OR_REDRAW(d) + BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { DrawDarkTab(bounds, state, dc.context); } else { -- cgit v0.12 From 668875a4157628ad8e22c8873000773a5456a778 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Apr 2021 09:52:05 +0000 Subject: Fix MacOS build --- macosx/ttkMacOSXTheme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 64cbce6..8379812 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -2532,7 +2532,7 @@ static void ThumbElementDraw( thumbColor = [NSColor colorWithColorSpace: deviceRGB components: rgba count: 4]; - BEGIN_DRAWING_OR_REDRAW(d) + BEGIN_DRAWING(d) SolidFillRoundedRectangle(dc.context, thumbBounds, 4, thumbColor); END_DRAWING } else { -- cgit v0.12 From 8c01d5fea4cbdd448a644bfaf18e9dfc96843b61 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Apr 2021 09:55:01 +0000 Subject: Add more implicit type-casts. Backported from 8.7 --- generic/tkAtom.c | 6 +++--- generic/tkBind.c | 6 +++--- generic/tkBitmap.c | 50 +++++++++++++++++++++----------------------- generic/tkBusy.c | 2 +- generic/tkClipboard.c | 12 +++++------ generic/tkColor.c | 26 +++++++++++------------ generic/tkConfig.c | 2 +- generic/tkCursor.c | 30 +++++++++++++------------- generic/tkError.c | 2 +- generic/tkFocus.c | 14 ++++++------- generic/tkFont.c | 2 +- generic/tkGC.c | 11 +++++----- generic/tkObj.c | 6 +++--- generic/tkSelect.c | 2 +- generic/tkStubLib.c | 2 +- generic/tkStyle.c | 8 ++----- generic/tkTextImage.c | 4 ++-- generic/tkTextWind.c | 2 +- generic/tkUndo.c | 10 ++++----- generic/tkVisual.c | 58 +++++++++++++++++++++++++-------------------------- 20 files changed, 121 insertions(+), 134 deletions(-) diff --git a/generic/tkAtom.c b/generic/tkAtom.c index 2491fb2..475f9d2 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.c @@ -154,11 +154,11 @@ Tk_GetAtomName( if (mustFree) { XFree(mustFree); } - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, name); } - return Tcl_GetHashValue(hPtr); + return (const char *)Tcl_GetHashValue(hPtr); } /* @@ -200,7 +200,7 @@ AtomInit( name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, name); } diff --git a/generic/tkBind.c b/generic/tkBind.c index ad59299..da52c61 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -4490,13 +4490,13 @@ NameToWindow( * * DoWarp -- * - * Perform Warping of X pointer. Executed as an idle handler only. + * Perform warping of mouse pointer. Executed as an idle handler only. * * Results: * None * * Side effects: - * X Pointer will move to a new location. + * Mouse pointer moves to a new location. * *------------------------------------------------------------------------- */ @@ -4505,7 +4505,7 @@ static void DoWarp( ClientData clientData) { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; assert(clientData); diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 54bab69..ccc97a4 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -167,7 +167,7 @@ Tk_AllocBitmapFromObj( if (objPtr->typePtr != &tkBitmapObjType) { InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBitmap, see if it's the one we @@ -197,7 +197,7 @@ Tk_AllocBitmapFromObj( */ if (bitmapPtr != NULL) { - TkBitmap *firstBitmapPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + TkBitmap *firstBitmapPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); FreeBitmapObj(objPtr); for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL; @@ -307,7 +307,7 @@ GetBitmap( Pixmap bitmap; int isNew, width = 0, height = 0, dummy2; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!dispPtr->bitmapInit) { @@ -317,7 +317,7 @@ GetBitmap( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string, &isNew); if (!isNew) { - existingBitmapPtr = Tcl_GetHashValue(nameHashPtr); + existingBitmapPtr = (TkBitmap *)Tcl_GetHashValue(nameHashPtr); for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if ((Tk_Display(tkwin) == bitmapPtr->display) && @@ -395,7 +395,7 @@ GetBitmap( goto error; } } else { - predefPtr = Tcl_GetHashValue(predefHashPtr); + predefPtr = (TkPredefBitmap *)Tcl_GetHashValue(predefHashPtr); width = predefPtr->width; height = predefPtr->height; if (predefPtr->native) { @@ -407,7 +407,7 @@ GetBitmap( } else { bitmap = XCreateBitmapFromData(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), - predefPtr->source, (unsigned)width, (unsigned)height); + (const char *)predefPtr->source, (unsigned)width, (unsigned)height); } } } @@ -416,7 +416,7 @@ GetBitmap( * Add information about this bitmap to our database. */ - bitmapPtr = ckalloc(sizeof(TkBitmap)); + bitmapPtr = (TkBitmap *)ckalloc(sizeof(TkBitmap)); bitmapPtr->bitmap = bitmap; bitmapPtr->width = width; bitmapPtr->height = height; @@ -474,7 +474,7 @@ Tk_DefineBitmap( int isNew; Tcl_HashEntry *predefHashPtr; TkPredefBitmap *predefPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -497,7 +497,7 @@ Tk_DefineBitmap( Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL); return TCL_ERROR; } - predefPtr = ckalloc(sizeof(TkPredefBitmap)); + predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap)); predefPtr->source = source; predefPtr->width = width; predefPtr->height = height; @@ -540,7 +540,7 @@ Tk_NameOfBitmap( if (idHashPtr == NULL) { goto unknown; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); return bitmapPtr->nameHashPtr->key.string; } @@ -582,7 +582,7 @@ Tk_SizeOfBitmap( if (idHashPtr == NULL) { goto unknownBitmap; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); *widthPtr = bitmapPtr->width; *heightPtr = bitmapPtr->height; } @@ -612,14 +612,13 @@ FreeBitmap( { TkBitmap *prevPtr; - bitmapPtr->resourceRefCount--; - if (bitmapPtr->resourceRefCount > 0) { + if (bitmapPtr->resourceRefCount-- > 1) { return; } Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap); Tcl_DeleteHashEntry(bitmapPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + prevPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); if (prevPtr == bitmapPtr) { if (bitmapPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr); @@ -671,7 +670,7 @@ Tk_FreeBitmap( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument"); } - FreeBitmap(Tcl_GetHashValue(idHashPtr)); + FreeBitmap((TkBitmap *)Tcl_GetHashValue(idHashPtr)); } /* @@ -735,7 +734,7 @@ static void FreeBitmapObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBitmap *bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { bitmapPtr->objRefCount--; @@ -770,7 +769,7 @@ DupBitmapObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBitmap *bitmapPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -806,7 +805,6 @@ DupBitmapObjProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ Pixmap Tk_GetBitmapFromData( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ @@ -820,20 +818,20 @@ Tk_GetBitmapFromData( char string[16 + TCL_INTEGER_SPACE]; char *name; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { BitmapInit(dispPtr); } - nameKey.source = source; + nameKey.source = (const char *)source; nameKey.width = width; nameKey.height = height; dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable, (char *) &nameKey, &isNew); if (!isNew) { - name = Tcl_GetHashValue(dataHashPtr); + name = (char *)Tcl_GetHashValue(dataHashPtr); } else { dispPtr->bitmapAutoNumber++; sprintf(string, "_tk%d", dispPtr->bitmapAutoNumber); @@ -911,7 +909,7 @@ GetBitmapFromObj( InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { if ((bitmapPtr->resourceRefCount > 0) && (Tk_Display(tkwin) == bitmapPtr->display)) { @@ -932,7 +930,7 @@ GetBitmapFromObj( * more TkBitmap structures. See if any of them will work. */ - for (bitmapPtr = Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; + for (bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if (Tk_Display(tkwin) == bitmapPtr->display) { objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -1012,7 +1010,7 @@ BitmapInit( * or NULL if unavailable. */ { Tcl_Interp *dummy; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1150,7 +1148,7 @@ TkDebugBitmap( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable, name); if (hashPtr != NULL) { - bitmapPtr = Tcl_GetHashValue(hashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); if (bitmapPtr == NULL) { Tcl_Panic("TkDebugBitmap found empty hash table entry"); } @@ -1190,7 +1188,7 @@ TkDebugBitmap( Tcl_HashTable * TkGetBitmapPredefTable(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return &tsdPtr->predefBitmapTable; diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 1e4e91f..6f58c52 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -340,7 +340,7 @@ DestroyBusy( RefWinEventProc, busyPtr); if (busyPtr->tkBusy != NULL) { - Tk_FreeConfigOptions(data, busyPtr->optionTable, busyPtr->tkBusy); + Tk_FreeConfigOptions((char *)data, busyPtr->optionTable, busyPtr->tkBusy); Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); Tk_ManageGeometry(busyPtr->tkBusy, NULL, busyPtr); diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 8bc4237..e800da9 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -134,22 +134,22 @@ ClipboardAppHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkDisplay *dispPtr = clientData; - size_t length; + TkDisplay *dispPtr = (TkDisplay *)clientData; + int length; const char *p; p = dispPtr->clipboardAppPtr->winPtr->nameUid; length = strlen(p); - length -= offset; - if (length <= 0) { + if (length <= offset) { return 0; } - if (length > (size_t) maxBytes) { + length -= offset; + if (length > maxBytes) { length = maxBytes; } memcpy(buffer, p, length); buffer[length] = 0; - return (int)length; + return length; } /* diff --git a/generic/tkColor.c b/generic/tkColor.c index 48d17ac..6b6405a 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -128,7 +128,7 @@ Tk_AllocColorFromObj( */ if (tkColPtr != NULL) { - TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + TkColor *firstColorPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr); FreeColorObj(objPtr); for (tkColPtr = firstColorPtr; tkColPtr != NULL; @@ -203,7 +203,7 @@ Tk_GetColor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew); if (!isNew) { - existingColPtr = Tcl_GetHashValue(nameHashPtr); + existingColPtr = (TkColor *)Tcl_GetHashValue(nameHashPtr); for (tkColPtr = existingColPtr; tkColPtr != NULL; tkColPtr = tkColPtr->nextPtr) { if ((tkColPtr->screen == Tk_Screen(tkwin)) @@ -314,7 +314,7 @@ Tk_GetColorByValue( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable, (char *) &valueKey, &isNew); if (!isNew) { - tkColPtr = Tcl_GetHashValue(valueHashPtr); + tkColPtr = (TkColor *)Tcl_GetHashValue(valueHashPtr); tkColPtr->resourceRefCount++; return &tkColPtr->color; } @@ -368,7 +368,7 @@ Tk_NameOfColor( if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; } else { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red, @@ -480,8 +480,7 @@ Tk_FreeColor( Tcl_Panic("Tk_FreeColor called with bogus color"); } - tkColPtr->resourceRefCount--; - if (tkColPtr->resourceRefCount > 0) { + if (tkColPtr->resourceRefCount-- > 1) { return; } @@ -497,7 +496,7 @@ Tk_FreeColor( } TkpFreeColor(tkColPtr); - prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + prevPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr); if (prevPtr == tkColPtr) { if (tkColPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(tkColPtr->hashPtr); @@ -584,11 +583,10 @@ static void FreeColorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { - tkColPtr->objRefCount--; - if ((tkColPtr->objRefCount == 0) + if ((tkColPtr->objRefCount-- <= 1) && (tkColPtr->resourceRefCount == 0)) { ckfree(tkColPtr); } @@ -619,7 +617,7 @@ DupColorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = (TkColor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; @@ -669,7 +667,7 @@ Tk_GetColorFromObj( * map. If it is, we are done. */ - tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; + tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1; if ((tkColPtr != NULL) && (tkColPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == tkColPtr->screen) @@ -695,7 +693,7 @@ Tk_GetColorFromObj( if (hashPtr == NULL) { goto error; } - for (tkColPtr = Tcl_GetHashValue(hashPtr); + for (tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr); (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { if ((Tk_Screen(tkwin) == tkColPtr->screen) && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { @@ -811,7 +809,7 @@ TkDebugColor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name); if (hashPtr != NULL) { - TkColor *tkColPtr = Tcl_GetHashValue(hashPtr); + TkColor *tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr); if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 8381a0a..6a0ffd8 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -664,7 +664,7 @@ DoObjConfig( if (internalPtr != NULL) { if (valuePtr != NULL) { value = Tcl_GetStringFromObj(valuePtr, &length); - newStr = ckalloc(length + 1); + newStr = (char *)ckalloc(length + 1); strcpy(newStr, value); } else { newStr = NULL; diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 1e49c64..902472b 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -100,7 +100,7 @@ Tk_AllocCursorFromObj( if (objPtr->typePtr != &tkCursorObjType) { InitCursorObj(objPtr); } - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkCursor, see if it's the one we @@ -129,7 +129,7 @@ Tk_AllocCursorFromObj( */ if (cursorPtr != NULL) { - TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + TkCursor *firstCursorPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); FreeCursorObj(objPtr); for (cursorPtr = firstCursorPtr; cursorPtr != NULL; @@ -241,7 +241,7 @@ TkcGetCursor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable, string, &isNew); if (!isNew) { - existingCursorPtr = Tcl_GetHashValue(nameHashPtr); + existingCursorPtr = (TkCursor *)Tcl_GetHashValue(nameHashPtr); for (cursorPtr = existingCursorPtr; cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { @@ -341,7 +341,7 @@ Tk_GetCursorFromData( dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable, (char *) &dataKey, &isNew); if (!isNew) { - cursorPtr = Tcl_GetHashValue(dataHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(dataHashPtr); cursorPtr->resourceRefCount++; return cursorPtr->cursor; } @@ -432,7 +432,7 @@ Tk_NameOfCursor( if (idHashPtr == NULL) { goto printid; } - cursorPtr = Tcl_GetHashValue(idHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr); if (cursorPtr->otherTable != &dispPtr->cursorNameTable) { goto printid; } @@ -463,13 +463,12 @@ FreeCursor( { TkCursor *prevPtr; - cursorPtr->resourceRefCount--; - if (cursorPtr->resourceRefCount > 0) { + if (cursorPtr->resourceRefCount-- > 1) { return; } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + prevPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(cursorPtr->hashPtr); @@ -522,7 +521,7 @@ Tk_FreeCursor( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } - FreeCursor(Tcl_GetHashValue(idHashPtr)); + FreeCursor((TkCursor *)Tcl_GetHashValue(idHashPtr)); } /* @@ -587,11 +586,10 @@ static void FreeCursorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { - cursorPtr->objRefCount--; - if ((cursorPtr->objRefCount == 0) + if ((cursorPtr->objRefCount-- <= 1) && (cursorPtr->resourceRefCount == 0)) { ckfree(cursorPtr); } @@ -622,7 +620,7 @@ DupCursorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; @@ -707,7 +705,7 @@ GetCursorFromObj( * cached is the one that is needed. */ - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) { return cursorPtr; } @@ -722,7 +720,7 @@ GetCursorFromObj( if (hashPtr == NULL) { goto error; } - for (cursorPtr = Tcl_GetHashValue(hashPtr); + for (cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { FreeCursorObj(objPtr); @@ -857,7 +855,7 @@ TkDebugCursor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name); if (hashPtr != NULL) { - cursorPtr = Tcl_GetHashValue(hashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } diff --git a/generic/tkError.c b/generic/tkError.c index 277d7f0..6ff5475 100644 --- a/generic/tkError.c +++ b/generic/tkError.c @@ -107,7 +107,7 @@ Tk_CreateErrorHandler( * Create the handler record. */ - errorPtr = ckalloc(sizeof(TkErrorHandler)); + errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler)); errorPtr->dispPtr = dispPtr; errorPtr->firstRequest = NextRequest(display); errorPtr->lastRequest = (unsigned) -1; diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 42ac6bf..8066afd 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -113,8 +113,8 @@ Tk_FocusObjCmd( static const char *const focusOptions[] = { "-displayof", "-force", "-lastfor", NULL }; - Tk_Window tkwin = clientData; - TkWindow *winPtr = clientData; + Tk_Window tkwin = (Tk_Window)clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *newPtr, *topLevelPtr; ToplevelFocusInfo *tlFocusPtr; const char *windowName; @@ -415,7 +415,7 @@ TkFocusFilterEvent( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = tlFocusPtr->focusWinPtr = winPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -622,7 +622,7 @@ TkSetFocusWin( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = topLevelPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -961,7 +961,7 @@ FocusMapProc( ClientData clientData, /* Toplevel window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; DisplayFocusInfo *displayFocusPtr; if (eventPtr->type == VisibilityNotify) { @@ -1015,7 +1015,7 @@ FindDisplayFocusInfo( * The record doesn't exist yet. Make a new one. */ - displayFocusPtr = ckalloc(sizeof(DisplayFocusInfo)); + displayFocusPtr = (DisplayFocusInfo *)ckalloc(sizeof(DisplayFocusInfo)); displayFocusPtr->dispPtr = dispPtr; displayFocusPtr->focusWinPtr = NULL; displayFocusPtr->focusOnMapPtr = NULL; @@ -1143,7 +1143,7 @@ TkFocusSplit( * Move focus to new toplevel. */ - ToplevelFocusInfo *newTlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); newTlFocusPtr->topLevelPtr = winPtr; newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr; diff --git a/generic/tkFont.c b/generic/tkFont.c index 3e4044f..9c157db 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -3780,7 +3780,7 @@ NewChunk( if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk)); - layoutPtr = ckrealloc(layoutPtr, s); + layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; diff --git a/generic/tkGC.c b/generic/tkGC.c index a03c156..8744ec4 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -218,7 +218,7 @@ Tk_GetGC( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable, (char *) &valueKey, &isNew); if (!isNew) { - gcPtr = Tcl_GetHashValue(valueHashPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(valueHashPtr); gcPtr->refCount++; return gcPtr->gc; } @@ -228,7 +228,7 @@ Tk_GetGC( * and add a new structure to the database. */ - gcPtr = ckalloc(sizeof(TkGC)); + gcPtr = (TkGC *)ckalloc(sizeof(TkGC)); /* * Find or make a drawable to use to specify the screen and depth of the @@ -311,9 +311,8 @@ Tk_FreeGC( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeGC received unknown gc argument"); } - gcPtr = Tcl_GetHashValue(idHashPtr); - gcPtr->refCount--; - if (gcPtr->refCount == 0) { + gcPtr = (TkGC *)Tcl_GetHashValue(idHashPtr); + if (gcPtr->refCount-- <= 1) { XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); Tcl_DeleteHashEntry(idHashPtr); @@ -348,7 +347,7 @@ TkGCCleanup( for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search); entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { - gcPtr = Tcl_GetHashValue(entryPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(entryPtr); XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index db2e501..1552d11 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -934,8 +934,8 @@ DupWindowInternalRep( { WindowRep *oldPtr, *newPtr; - oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; - newPtr = ckalloc(sizeof(WindowRep)); + oldPtr = (WindowRep *)srcPtr->internalRep.twoPtrValue.ptr1; + newPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; @@ -997,7 +997,7 @@ TkNewWindowObj( SetWindowFromAny(NULL, objPtr); - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; winPtr->tkwin = tkwin; winPtr->mainPtr = mainPtr; winPtr->epoch = mainPtr->deletionEpoch; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 55fa473..f187f83 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1325,7 +1325,7 @@ HandleTclCommand( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - CommandInfo *cmdInfoPtr = clientData; + CommandInfo *cmdInfoPtr = (CommandInfo *)clientData; int length; Tcl_Obj *command; const char *string; diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index ea48894..0400bfa 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -80,7 +80,7 @@ Tk_InitStubs( ClientData clientData = NULL; const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 0, &clientData); - const TkStubs *stubsPtr = clientData; + const TkStubs *stubsPtr = (const TkStubs *)clientData; if (actualVersion == NULL) { return NULL; diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 1289f14..14bae66 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -1402,14 +1402,10 @@ Tk_AllocStyleFromObj( Tcl_Obj *objPtr) /* Object containing name of the style to * retrieve. */ { - Style *stylePtr; - if (objPtr->typePtr != &styleObjType) { SetStyleFromAny(interp, objPtr); } - stylePtr = objPtr->internalRep.twoPtrValue.ptr1; - - return (Tk_Style) stylePtr; + return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } /* @@ -1439,7 +1435,7 @@ Tk_GetStyleFromObj( SetStyleFromAny(NULL, objPtr); } - return objPtr->internalRep.twoPtrValue.ptr1; + return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } /* diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index b396314..776eb04 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -284,7 +284,7 @@ TkTextImageCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -796,7 +796,7 @@ TkTextImageIndex( indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); - /* + /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the image indeed is not * reachable from this text widget (it may be reachable from a peer). diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index cb8e533..fdd5378 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -1352,7 +1352,7 @@ TkTextWindowIndex( indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); - + /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the window indeed is not diff --git a/generic/tkUndo.c b/generic/tkUndo.c index c66905d..7494332 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.c @@ -94,7 +94,7 @@ TkUndoInsertSeparator( TkUndoAtom *separator; if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) { - separator = ckalloc(sizeof(TkUndoAtom)); + separator = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); separator->type = TK_UNDO_SEPARATOR; TkUndoPushStack(stack,separator); return 1; @@ -181,7 +181,7 @@ TkUndoPushAction( { TkUndoAtom *atom; - atom = ckalloc(sizeof(TkUndoAtom)); + atom = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); atom->type = TK_UNDO_ACTION; atom->apply = apply; atom->revert = revert; @@ -237,7 +237,7 @@ TkUndoMakeCmdSubAtom( Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = command; atom->funcPtr = NULL; atom->clientData = NULL; @@ -299,7 +299,7 @@ TkUndoMakeSubAtom( Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = NULL; atom->funcPtr = funcPtr; atom->clientData = clientData; @@ -341,7 +341,7 @@ TkUndoInitStack( { TkUndoRedoStack *stack; /* An Undo/Redo stack */ - stack = ckalloc(sizeof(TkUndoRedoStack)); + stack = (TkUndoRedoStack *)ckalloc(sizeof(TkUndoRedoStack)); stack->undoStack = NULL; stack->redoStack = NULL; stack->interp = interp; diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 567c552..9324499 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -96,10 +96,10 @@ Tk_GetVisual( * Tk_FreeColormap. */ { Tk_Window tkwin2; - XVisualInfo template, *visInfoList, *bestPtr; + XVisualInfo templ, *visInfoList, *bestPtr; long mask; Visual *visual; - ptrdiff_t length; + size_t length; int c, numVisuals, prio, bestPrio, i; const char *p; const VisualDictionary *dictPtr; @@ -137,20 +137,20 @@ Tk_GetVisual( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == *colormapPtr) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; break; } } } return visual; } - template.depth = Tk_Depth(tkwin2); - template.c_class = visual->c_class; - template.red_mask = visual->red_mask; - template.green_mask = visual->green_mask; - template.blue_mask = visual->blue_mask; - template.colormap_size = visual->map_entries; - template.bits_per_rgb = visual->bits_per_rgb; + templ.depth = Tk_Depth(tkwin2); + templ.c_class = visual->c_class; + templ.red_mask = visual->red_mask; + templ.green_mask = visual->green_mask; + templ.blue_mask = visual->blue_mask; + templ.colormap_size = visual->map_entries; + templ.bits_per_rgb = visual->bits_per_rgb; mask = VisualDepthMask|VisualClassMask|VisualRedMaskMask |VisualGreenMaskMask|VisualBlueMaskMask|VisualColormapSizeMask |VisualBitsPerRGBMask; @@ -178,7 +178,7 @@ Tk_GetVisual( Tcl_SetErrorCode(interp, "TK", "VALUE", "VISUALID", NULL); return NULL; } - template.visualid = visualId; + templ.visualid = visualId; mask = VisualIDMask; } else { /* @@ -192,16 +192,15 @@ Tk_GetVisual( } } length = p - string; - template.c_class = -1; + templ.c_class = -1; for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) { - if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) - && (strncmp(string, dictPtr->name, - (size_t) length) == 0)) { - template.c_class = dictPtr->c_class; + if ((dictPtr->name[0] == c) && (length >= (size_t)dictPtr->minLength) + && (strncmp(string, dictPtr->name, length) == 0)) { + templ.c_class = dictPtr->c_class; break; } } - if (template.c_class == -1) { + if (templ.c_class == -1) { Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", string); @@ -218,8 +217,8 @@ Tk_GetVisual( p++; } if (*p == 0) { - template.depth = 10000; - } else if (Tcl_GetInt(interp, p, &template.depth) != TCL_OK) { + templ.depth = 10000; + } else if (Tcl_GetInt(interp, p, &templ.depth) != TCL_OK) { return NULL; } if (c == 'b') { @@ -234,9 +233,9 @@ Tk_GetVisual( * an error if there are none that match. */ - template.screen = Tk_ScreenNumber(tkwin); + templ.screen = Tk_ScreenNumber(tkwin); mask |= VisualScreenMask; - visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &template, + visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ, &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -286,11 +285,11 @@ Tk_GetVisual( goto newBest; } if (visInfoList[i].depth < bestPtr->depth) { - if (visInfoList[i].depth >= template.depth) { + if (visInfoList[i].depth >= templ.depth) { goto newBest; } } else if (visInfoList[i].depth > bestPtr->depth) { - if (bestPtr->depth < template.depth) { + if (bestPtr->depth < templ.depth) { goto newBest; } } else { @@ -324,11 +323,11 @@ Tk_GetVisual( cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->shareable && (cmapPtr->visual == visual)) { *colormapPtr = cmapPtr->colormap; - cmapPtr->refCount += 1; + cmapPtr->refCount++; goto done; } } - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), visual, AllocNone); @@ -383,7 +382,7 @@ Tk_GetColormap( */ if (strcmp(string, "new") == 0) { - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin), AllocNone); @@ -427,7 +426,7 @@ Tk_GetColormap( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; } } return colormap; @@ -476,8 +475,7 @@ Tk_FreeColormap( for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount -= 1; - if (cmapPtr->refCount == 0) { + if (cmapPtr->refCount-- <= 1) { XFreeColormap(display, colormap); if (prevPtr == NULL) { dispPtr->cmapPtr = cmapPtr->nextPtr; @@ -534,7 +532,7 @@ Tk_PreserveColormap( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; return; } } -- cgit v0.12