Index: doc/CanvTxtInfo.3 ================================================================== --- doc/CanvTxtInfo.3 +++ doc/CanvTxtInfo.3 @@ -45,16 +45,20 @@ int \fIinsertWidth\fR; int \fIinsertBorderWidth\fR; Tk_Item *\fIfocusItemPtr\fR; int \fIgotFocus\fR; int \fIcursorOn\fR; + Tcl_Obj *\fIinsertBorderWidthObj\fR; + Tcl_Obj *\fIinsertWidthObj\fR; + Tcl_Obj *\fIselBorderWidthObj\fR; } \fBTk_CanvasTextInfo\fR; .CE The \fBselBorder\fR field identifies a Tk_3DBorder that should be used for drawing the background under selected text. \fIselBorderWidth\fR gives the width of the raised border around -selected text, in pixels. +selected text, in pixels. \fIselBorderWidthObj\fR contains the +same information, but the original Tcl_Obj * value; \fIselFgColorPtr\fR points to an XColor that describes the foreground color to be used when drawing selected text. \fIselItemPtr\fR points to the item that is currently selected, or NULL if there is no item selected or if the canvas does not have the selection. @@ -67,10 +71,12 @@ within \fIanchorItemPtr\fR. \fIinsertBorder\fR contains a Tk_3DBorder to use when drawing the insertion cursor; \fIinsertWidth\fR gives the total width of the insertion cursor in pixels, and \fIinsertBorderWidth\fR gives the width of the raised border around the insertion cursor. +\fIinsertWidthObj\fR and \fIinsertBorderWidthObj\fR contain the +same information, but the original Tcl_Obj * value. \fIfocusItemPtr\fR identifies the item that currently has the input focus, or NULL if there is no such item. \fIgotFocus\fR is 1 if the canvas widget has the input focus and 0 otherwise. \fIcursorOn\fR is 1 if the insertion cursor should be drawn in Index: generic/tk.h ================================================================== --- generic/tk.h +++ generic/tk.h @@ -1153,13 +1153,13 @@ * the input focus. Read-only to items.*/ int cursorOn; /* Non-zero means that an insertion cursor * should be displayed in focusItemPtr. * Read-only to items.*/ #if TK_MAJOR_VERSION > 8 - void *reserved1; /* reserved for future use */ - void *reserved2; - void *reserved3; + Tcl_Obj *insertBorderWidthObj; + Tcl_Obj *insertWidthObj; + Tcl_Obj *selBorderWidthObj; #endif } Tk_CanvasTextInfo; /* * Structures used for Dashing and Outline. Index: generic/tkCanvText.c ================================================================== --- generic/tkCanvText.c +++ generic/tkCanvText.c @@ -793,12 +793,12 @@ * box includes the bounding box of all its lines, plus an extra fudge * factor for the cursor border (which could potentially be quite large). */ textInfoPtr = textPtr->textInfoPtr; - Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), (Tcl_Obj *)textInfoPtr->reserved2, &textInfoPtr->insertWidth); - Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), (Tcl_Obj *)textInfoPtr->reserved3, &textInfoPtr->selBorderWidth); + Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->insertWidthObj, &textInfoPtr->insertWidth); + Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->selBorderWidthObj, &textInfoPtr->selBorderWidth); fudge = (textInfoPtr->insertWidth + 1) / 2; if (textInfoPtr->selBorderWidth > fudge) { fudge = textInfoPtr->selBorderWidth; } @@ -944,11 +944,11 @@ * last character, not the end of the line. */ x = xFirst; height = hFirst; - Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), (Tcl_Obj *)textInfoPtr->reserved3, &textInfoPtr->selBorderWidth); + Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->selBorderWidthObj, &textInfoPtr->selBorderWidth); for (y = yFirst ; y <= yLast; y += height) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; @@ -991,11 +991,11 @@ &x, &y, NULL, &height)) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; - Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), (Tcl_Obj *)textInfoPtr->reserved2, &textInfoPtr->insertWidth); + Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->insertWidthObj, &textInfoPtr->insertWidth); dx1 = x - (textInfoPtr->insertWidth / 2); dy1 = y; dx2 = textInfoPtr->insertWidth; dy2 = height; points[0].x = (short)(drawableX + dx1*c + dy1*s); @@ -1008,11 +1008,11 @@ points[3].y = (short)(drawableY + (dy1+dy2)*c - dx1*s); Tk_SetCaretPos(Tk_CanvasTkwin(canvas), points[0].x, points[0].y, height); if (textInfoPtr->cursorOn) { - Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), (Tcl_Obj *)textInfoPtr->reserved1, &textInfoPtr->insertBorderWidth); + Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->insertBorderWidthObj, &textInfoPtr->insertBorderWidth); Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->insertBorder, points, 4, textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED); } else if (textPtr->cursorOffGC != NULL) { /* Index: generic/tkCanvas.c ================================================================== --- generic/tkCanvas.c +++ generic/tkCanvas.c @@ -119,21 +119,21 @@ "HighlightThickness", DEF_CANVAS_HIGHLIGHT_WIDTH, offsetof(TkCanvas, highlightWidthObj), TK_CONFIG_OBJS, NULL}, {TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_CANVAS_INSERT_BG, offsetof(TkCanvas, textInfo.insertBorder), 0, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", - DEF_CANVAS_INSERT_BD_COLOR, offsetof(TkCanvas, textInfo.reserved1), + DEF_CANVAS_INSERT_BD_COLOR, offsetof(TkCanvas, textInfo.insertBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", - DEF_CANVAS_INSERT_BD_MONO, offsetof(TkCanvas, textInfo.reserved1), + DEF_CANVAS_INSERT_BD_MONO, offsetof(TkCanvas, textInfo.insertBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_CANVAS_INSERT_OFF_TIME, offsetof(TkCanvas, insertOffTime), 0, NULL}, {TK_CONFIG_INT, "-insertontime", "insertOnTime", "OnTime", DEF_CANVAS_INSERT_ON_TIME, offsetof(TkCanvas, insertOnTime), 0, NULL}, {TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", - DEF_CANVAS_INSERT_WIDTH, offsetof(TkCanvas, textInfo.reserved2), TK_CONFIG_OBJS, NULL}, + DEF_CANVAS_INSERT_WIDTH, offsetof(TkCanvas, textInfo.insertWidthObj), TK_CONFIG_OBJS, NULL}, {TK_CONFIG_CUSTOM, "-offset", "offset", "Offset", "0,0", offsetof(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", DEF_CANVAS_RELIEF, offsetof(TkCanvas, relief), 0, NULL}, @@ -145,14 +145,14 @@ TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_CANVAS_SELECT_MONO, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", - DEF_CANVAS_SELECT_BD_COLOR, offsetof(TkCanvas, textInfo.reserved3), + DEF_CANVAS_SELECT_BD_COLOR, offsetof(TkCanvas, textInfo.selBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", - DEF_CANVAS_SELECT_BD_MONO, offsetof(TkCanvas, textInfo.reserved3), + DEF_CANVAS_SELECT_BD_MONO, offsetof(TkCanvas, textInfo.selBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_COLOR, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", @@ -689,22 +689,22 @@ canvasPtr->widthObj = NULL; canvasPtr->heightObj = NULL; canvasPtr->confine = 0; canvasPtr->textInfo.selBorder = NULL; canvasPtr->textInfo.selBorderWidth = 0; - canvasPtr->textInfo.reserved3 = NULL; + canvasPtr->textInfo.selBorderWidthObj = NULL; canvasPtr->textInfo.selFgColorPtr = NULL; canvasPtr->textInfo.selItemPtr = NULL; canvasPtr->textInfo.selectFirst = TCL_INDEX_NONE; canvasPtr->textInfo.selectLast = TCL_INDEX_NONE; canvasPtr->textInfo.anchorItemPtr = NULL; canvasPtr->textInfo.selectAnchor = 0; canvasPtr->textInfo.insertBorder = NULL; canvasPtr->textInfo.insertWidth = 0; - canvasPtr->textInfo.reserved2 = NULL; + canvasPtr->textInfo.insertWidthObj = NULL; canvasPtr->textInfo.insertBorderWidth = 0; - canvasPtr->textInfo.reserved1 = NULL; + canvasPtr->textInfo.insertBorderWidthObj = NULL; canvasPtr->textInfo.focusItemPtr = NULL; canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertOnTime = 0; canvasPtr->insertOffTime = 0; @@ -2285,13 +2285,13 @@ Tk_SetBackgroundFromBorder(canvasPtr->tkwin, canvasPtr->bgBorder); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->heightObj, &height); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->highlightWidthObj, &highlightWidth); - Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved1, &canvasPtr->textInfo.insertBorderWidth); - Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved2, &canvasPtr->textInfo.insertWidth); - Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved3, &canvasPtr->textInfo.selBorderWidth); + Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertBorderWidthObj, &canvasPtr->textInfo.insertBorderWidth); + Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertWidthObj, &canvasPtr->textInfo.insertWidth); + Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.selBorderWidthObj, &canvasPtr->textInfo.selBorderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->widthObj, &width); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->xScrollIncrementObj, &xScrollIncrement); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->yScrollIncrementObj, &yScrollIncrement); if (borderWidth < 0) { borderWidth = 0; @@ -2330,25 +2330,25 @@ Tcl_IncrRefCount(canvasPtr->yScrollIncrementObj); } canvasPtr->inset = borderWidth + highlightWidth; if (canvasPtr->textInfo.insertBorderWidth < 0) { canvasPtr->textInfo.insertBorderWidth = 0; - Tcl_DecrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved1); - canvasPtr->textInfo.reserved1 = Tcl_NewIntObj(0); - Tcl_IncrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved1); + Tcl_DecrRefCount(canvasPtr->textInfo.insertBorderWidthObj); + canvasPtr->textInfo.insertBorderWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(canvasPtr->textInfo.insertBorderWidthObj); } if (canvasPtr->textInfo.insertWidth < 0) { canvasPtr->textInfo.insertWidth = 0; - Tcl_DecrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved2); - canvasPtr->textInfo.reserved2 = Tcl_NewIntObj(0); - Tcl_IncrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved2); + Tcl_DecrRefCount(canvasPtr->textInfo.insertWidthObj); + canvasPtr->textInfo.insertWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(canvasPtr->textInfo.insertWidthObj); } if (canvasPtr->textInfo.selBorderWidth < 0) { canvasPtr->textInfo.selBorderWidth = 0; - Tcl_DecrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved3); - canvasPtr->textInfo.reserved3 = Tcl_NewIntObj(0); - Tcl_IncrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved3); + Tcl_DecrRefCount(canvasPtr->textInfo.selBorderWidthObj); + canvasPtr->textInfo.selBorderWidthObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(canvasPtr->textInfo.selBorderWidthObj); } gcValues.function = GXcopy; gcValues.graphics_exposures = False; gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; @@ -2490,13 +2490,13 @@ void *instanceData) /* Information about widget. */ { TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; - Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved1, &canvasPtr->textInfo.insertBorderWidth); - Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved2, &canvasPtr->textInfo.insertWidth); - Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved3, &canvasPtr->textInfo.selBorderWidth); + Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertBorderWidthObj, &canvasPtr->textInfo.insertBorderWidth); + Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertWidthObj, &canvasPtr->textInfo.insertWidth); + Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.selBorderWidthObj, &canvasPtr->textInfo.selBorderWidth); itemPtr = canvasPtr->firstItemPtr; for ( ; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { if (ItemConfigure(canvasPtr, itemPtr, 0, NULL) != TCL_OK) { Tcl_ResetResult(canvasPtr->interp);