diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-13 14:51:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-13 14:51:58 (GMT) |
commit | 40b76dbd4f4479294a9cd461da0400e31734ac2b (patch) | |
tree | 0b9c811cef1183d76e05a6ac238b5652de5bb12d /generic | |
parent | ad423a347178d6279b112f7031e683c7e15d798a (diff) | |
parent | 75aab96f3ddb340be5aecbb880f1af2a07d9ec25 (diff) | |
download | tk-40b76dbd4f4479294a9cd461da0400e31734ac2b.zip tk-40b76dbd4f4479294a9cd461da0400e31734ac2b.tar.gz tk-40b76dbd4f4479294a9cd461da0400e31734ac2b.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic')
56 files changed, 372 insertions, 350 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index 87ddf76..92a7803 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -236,9 +236,9 @@ Tk_Get3DBorder( borderPtr->darkColorPtr = NULL; borderPtr->lightColorPtr = NULL; borderPtr->shadow = None; - borderPtr->bgGC = None; - borderPtr->darkGC = None; - borderPtr->lightGC = None; + borderPtr->bgGC = NULL; + borderPtr->darkGC = NULL; + borderPtr->lightGC = NULL; borderPtr->hashPtr = hashPtr; borderPtr->nextPtr = existingBorderPtr; Tcl_SetHashValue(hashPtr, borderPtr); @@ -374,7 +374,7 @@ Tk_3DBorderGC( { TkBorder * borderPtr = (TkBorder *) border; - if ((borderPtr->lightGC == None) && (which != TK_3D_FLAT_GC)) { + if ((borderPtr->lightGC == NULL) && (which != TK_3D_FLAT_GC)) { TkpGetShadows(borderPtr, tkwin); } if (which == TK_3D_FLAT_GC) { @@ -391,7 +391,7 @@ Tk_3DBorderGC( * compilers happy. */ - return (GC) None; + return NULL; } /* @@ -439,13 +439,13 @@ Tk_Free3DBorder( if (borderPtr->shadow != None) { Tk_FreeBitmap(display, borderPtr->shadow); } - if (borderPtr->bgGC != None) { + if (borderPtr->bgGC != NULL) { Tk_FreeGC(display, borderPtr->bgGC); } - if (borderPtr->darkGC != None) { + if (borderPtr->darkGC != NULL) { Tk_FreeGC(display, borderPtr->darkGC); } - if (borderPtr->lightGC != None) { + if (borderPtr->lightGC != NULL) { Tk_FreeGC(display, borderPtr->lightGC); } if (prevPtr == borderPtr) { @@ -765,7 +765,7 @@ Tk_Draw3DPolygon( int i, lightOnLeft, dx, dy, parallel, pointsSeen; Display *display = Tk_Display(tkwin); - if (borderPtr->lightGC == None) { + if (borderPtr->lightGC == NULL) { TkpGetShadows(borderPtr, tkwin); } @@ -1380,9 +1380,9 @@ TkDebugBorder( Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(borderPtr->resourceRefCount)); + Tcl_NewWideIntObj(borderPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(borderPtr->objRefCount)); + Tcl_NewWideIntObj(borderPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tk3d.h b/generic/tk3d.h index f574de7..d36b95e 100644 --- a/generic/tk3d.h +++ b/generic/tk3d.h @@ -54,10 +54,10 @@ typedef struct TkBorder { GC bgGC; /* Used (if necessary) to draw areas in the * background color. */ GC darkGC; /* Used to draw darker parts of the border. - * None means the shadow colors haven't been + * NULL means the shadow colors haven't been * allocated yet.*/ GC lightGC; /* Used to draw lighter parts of the border. - * None means the shadow colors haven't been + * NULL means the shadow colors haven't been * allocated yet. */ Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to * delete structure). */ diff --git a/generic/tkBind.c b/generic/tkBind.c index 469725e..b06fbc9 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3587,7 +3587,7 @@ DoWarp( if (dispPtr->warpWindow) { Tcl_Release(dispPtr->warpWindow); - dispPtr->warpWindow = None; + dispPtr->warpWindow = NULL; } dispPtr->flags &= ~TK_DISPLAY_IN_WARP; } diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index a2730d7..0ab922b 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -1157,9 +1157,9 @@ TkDebugBitmap( for ( ; (bitmapPtr != NULL); bitmapPtr = bitmapPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(bitmapPtr->resourceRefCount)); + Tcl_NewWideIntObj(bitmapPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewIntObj(bitmapPtr->objRefCount)); + Tcl_NewWideIntObj(bitmapPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 8991462..1846a94 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -519,7 +519,8 @@ CreateBusy( Tk_Window tkRef) /* Window hosting the busy window */ { Busy *busyPtr; - int length, x, y; + size_t length; + int x, y; const char *fmt; char *name; Tk_Window tkBusy, tkChild, tkParent; @@ -568,7 +569,7 @@ CreateBusy( busyPtr->height = Tk_Height(tkRef); busyPtr->x = Tk_X(tkRef); busyPtr->y = Tk_Y(tkRef); - busyPtr->cursor = None; + busyPtr->cursor = NULL; Tk_SetClass(tkBusy, "Busy"); busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs); if (Tk_InitOptions(interp, busyPtr, busyPtr->optionTable, @@ -598,7 +599,7 @@ CreateBusy( */ Tk_ManageGeometry(tkBusy, &busyMgrInfo, busyPtr); - if (busyPtr->cursor != None) { + if (busyPtr->cursor != NULL) { Tk_DefineCursor(tkBusy, busyPtr->cursor); } @@ -643,7 +644,7 @@ ConfigureBusy( return TCL_ERROR; } if (busyPtr->cursor != oldCursor) { - if (busyPtr->cursor == None) { + if (busyPtr->cursor == NULL) { Tk_UndefineCursor(busyPtr->tkBusy); } else { Tk_DefineCursor(busyPtr->tkBusy, busyPtr->cursor); diff --git a/generic/tkButton.c b/generic/tkButton.c index be8c6c4..9755861 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -710,12 +710,12 @@ ButtonCreate( butPtr->normalFg = NULL; butPtr->activeFg = NULL; butPtr->disabledFg = NULL; - butPtr->normalTextGC = None; - butPtr->activeTextGC = None; - butPtr->disabledGC = None; - butPtr->stippleGC = None; + butPtr->normalTextGC = NULL; + butPtr->activeTextGC = NULL; + butPtr->disabledGC = NULL; + butPtr->stippleGC = NULL; butPtr->gray = None; - butPtr->copyGC = None; + butPtr->copyGC = NULL; butPtr->widthPtr = NULL; butPtr->width = 0; butPtr->heightPtr = NULL; @@ -740,7 +740,7 @@ ButtonCreate( butPtr->onValuePtr = NULL; butPtr->offValuePtr = NULL; butPtr->tristateValuePtr = NULL; - butPtr->cursor = None; + butPtr->cursor = NULL; butPtr->takeFocusPtr = NULL; butPtr->commandPtr = NULL; butPtr->flags = 0; @@ -981,22 +981,22 @@ DestroyButton( if (butPtr->tristateImage != NULL) { Tk_FreeImage(butPtr->tristateImage); } - if (butPtr->normalTextGC != None) { + if (butPtr->normalTextGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->normalTextGC); } - if (butPtr->activeTextGC != None) { + if (butPtr->activeTextGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->activeTextGC); } - if (butPtr->disabledGC != None) { + if (butPtr->disabledGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->disabledGC); } - if (butPtr->stippleGC != None) { + if (butPtr->stippleGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->stippleGC); } if (butPtr->gray != None) { Tk_FreeBitmap(butPtr->display, butPtr->gray); } - if (butPtr->copyGC != None) { + if (butPtr->copyGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->copyGC); } if (butPtr->textLayout != NULL) { @@ -1367,7 +1367,7 @@ TkButtonWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->normalTextGC != None) { + if (butPtr->normalTextGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->normalTextGC); } butPtr->normalTextGC = newGC; @@ -1377,7 +1377,7 @@ TkButtonWorldChanged( gcValues.background = Tk_3DBorderColor(butPtr->activeBorder)->pixel; mask = GCForeground | GCBackground | GCFont; newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->activeTextGC != None) { + if (butPtr->activeTextGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->activeTextGC); } butPtr->activeTextGC = newGC; @@ -1389,7 +1389,7 @@ TkButtonWorldChanged( * Create the GC that can be used for stippling */ - if (butPtr->stippleGC == None) { + if (butPtr->stippleGC == NULL) { gcValues.foreground = gcValues.background; mask = GCForeground; if (butPtr->gray == None) { @@ -1415,12 +1415,12 @@ TkButtonWorldChanged( gcValues.foreground = gcValues.background; } newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->disabledGC != None) { + if (butPtr->disabledGC != NULL) { Tk_FreeGC(butPtr->display, butPtr->disabledGC); } butPtr->disabledGC = newGC; - if (butPtr->copyGC == None) { + if (butPtr->copyGC == NULL) { butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues); } diff --git a/generic/tkButton.h b/generic/tkButton.h index 7ed464f..7e04fb9 100644 --- a/generic/tkButton.h +++ b/generic/tkButton.h @@ -235,7 +235,7 @@ typedef struct { * Miscellaneous information: */ - Tk_Cursor cursor; /* Value of -cursor option: if not None, + Tk_Cursor cursor; /* Value of -cursor option: if not NULL, * specifies current cursor for window. */ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index 880d313..d9c2eca 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -299,7 +299,7 @@ CreateArc( arcPtr->activeFillStipple = None; arcPtr->disabledFillStipple = None; arcPtr->style = PIESLICE_STYLE; - arcPtr->fillGC = None; + arcPtr->fillGC = NULL; arcPtr->height = 0; /* @@ -508,9 +508,9 @@ ConfigureArc( mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = None; + newGC = NULL; } - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc != NULL) { Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc); } arcPtr->outline.gc = newGC; @@ -542,9 +542,9 @@ ConfigureArc( } if (arcPtr->style == ARC_STYLE) { - newGC = None; + newGC = NULL; } else if (color == NULL) { - newGC = None; + newGC = NULL; } else { gcValues.foreground = color->pixel; if (arcPtr->style == CHORD_STYLE) { @@ -560,7 +560,7 @@ ConfigureArc( } newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (arcPtr->fillGC != None) { + if (arcPtr->fillGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC); } arcPtr->fillGC = newGC; @@ -717,7 +717,7 @@ DeleteArc( if (arcPtr->disabledFillStipple != None) { Tk_FreeBitmap(display, arcPtr->disabledFillStipple); } - if (arcPtr->fillGC != None) { + if (arcPtr->fillGC != NULL) { Tk_FreeGC(display, arcPtr->fillGC); } } @@ -848,7 +848,7 @@ ComputeArcBbox( * drawn) and add one extra pixel just for safety. */ - if (arcPtr->outline.gc == None) { + if (arcPtr->outline.gc == NULL) { tmp = 1; } else { tmp = (int) ((width + 1.0)/2.0 + 1); @@ -947,7 +947,7 @@ DisplayArc( * window servers to crash and should be a no-op anyway. */ - if ((arcPtr->fillGC != None) && (extent != 0)) { + if ((arcPtr->fillGC != NULL) && (extent != 0)) { if (stipple != None) { int w = 0; int h = 0; @@ -981,7 +981,7 @@ DisplayArc( XSetTSOrigin(display, arcPtr->fillGC, 0, 0); } } - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc != NULL) { Tk_ChangeOutlineGC(canvas, itemPtr, &(arcPtr->outline)); if (extent != 0) { @@ -1019,13 +1019,13 @@ DisplayArc( } else { if (arcPtr->style == CHORD_STYLE) { TkFillPolygon(canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS, - display, drawable, arcPtr->outline.gc, None); + display, drawable, arcPtr->outline.gc, NULL); } else if (arcPtr->style == PIESLICE_STYLE) { TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS, - display, drawable, arcPtr->outline.gc, None); + display, drawable, arcPtr->outline.gc, NULL); TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS, PIE_OUTLINE2_PTS, display, drawable, - arcPtr->outline.gc, None); + arcPtr->outline.gc, NULL); } } @@ -1131,12 +1131,12 @@ ArcToPoint( return dist; } - if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) { + if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) { filled = 1; } else { filled = 0; } - if (arcPtr->outline.gc == None) { + if (arcPtr->outline.gc == NULL) { width = 0.0; } @@ -1258,12 +1258,12 @@ ArcToArea( } } - if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) { + if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) { filled = 1; } else { filled = 0; } - if (arcPtr->outline.gc == None) { + if (arcPtr->outline.gc == NULL) { width = 0.0; } @@ -1997,7 +1997,7 @@ ArcToPostscript( * arc. */ - if (arcPtr->fillGC != None) { + if (arcPtr->fillGC != NULL) { Tcl_AppendPrintfToObj(psObj, "matrix currentmatrix\n" "%.15g %.15g translate %.15g %.15g scale\n", @@ -2026,7 +2026,7 @@ ArcToPostscript( } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc != NULL) { Tcl_AppendToObj(psObj, "grestore gsave\n", -1); } } else { @@ -2038,7 +2038,7 @@ ArcToPostscript( * If there's an outline for the arc, draw it. */ - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc != NULL) { Tcl_AppendPrintfToObj(psObj, "matrix currentmatrix\n" "%.15g %.15g translate %.15g %.15g scale\n", diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 8e3a410..1fbfddf 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -189,7 +189,7 @@ TkcCreateBitmap( bmapPtr->bgColor = NULL; bmapPtr->activeBgColor = NULL; bmapPtr->disabledBgColor = NULL; - bmapPtr->gc = None; + bmapPtr->gc = NULL; /* * Process the arguments to fill in the item record. Only 1 (list) or 2 (x @@ -372,7 +372,7 @@ ConfigureBitmap( } if (bitmap == None) { - newGC = None; + newGC = NULL; } else { gcValues.foreground = fgColor->pixel; mask = GCForeground; @@ -385,7 +385,7 @@ ConfigureBitmap( } newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (bmapPtr->gc != None) { + if (bmapPtr->gc != NULL) { Tk_FreeGC(Tk_Display(tkwin), bmapPtr->gc); } bmapPtr->gc = newGC; diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 0d4aa9d..76b3689 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -449,7 +449,7 @@ ComputeImageBbox( x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5)); y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5)); - if ((state == TK_STATE_HIDDEN) || (image == None)) { + if ((state == TK_STATE_HIDDEN) || (image == NULL)) { imgPtr->header.x1 = imgPtr->header.x2 = x; imgPtr->header.y1 = imgPtr->header.y2 = y; return; diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index e35cbd9..dd0a6cb 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -296,7 +296,7 @@ CreateLine( linePtr->coordPtr = NULL; linePtr->capStyle = CapButt; linePtr->joinStyle = JoinRound; - linePtr->arrowGC = None; + linePtr->arrowGC = NULL; linePtr->arrow = ARROWS_NONE; linePtr->arrowShapeA = (float)8.0; linePtr->arrowShapeB = (float)10.0; @@ -521,12 +521,12 @@ ConfigureLine( #endif arrowGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = arrowGC = None; + newGC = arrowGC = NULL; } - if (linePtr->outline.gc != None) { + if (linePtr->outline.gc != NULL) { Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc); } - if (linePtr->arrowGC != None) { + if (linePtr->arrowGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), linePtr->arrowGC); } linePtr->outline.gc = newGC; @@ -611,7 +611,7 @@ DeleteLine( if (linePtr->coordPtr != NULL) { ckfree(linePtr->coordPtr); } - if (linePtr->arrowGC != None) { + if (linePtr->arrowGC != NULL) { Tk_FreeGC(display, linePtr->arrowGC); } if (linePtr->firstArrowPtr != NULL) { @@ -840,7 +840,7 @@ DisplayLine( int numPoints; Tk_State state = itemPtr->state; - if ((!linePtr->numPoints) || (linePtr->outline.gc == None)) { + if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) { return; } diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 5241bd8..f10aae7 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -273,7 +273,7 @@ CreatePolygon( polyPtr->fillStipple = None; polyPtr->activeFillStipple = None; polyPtr->disabledFillStipple = None; - polyPtr->fillGC = None; + polyPtr->fillGC = NULL; polyPtr->smooth = NULL; polyPtr->splineSteps = 12; polyPtr->autoClosed = 0; @@ -478,9 +478,9 @@ ConfigurePolygon( mask |= GCCapStyle|GCJoinStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = None; + newGC = NULL; } - if (polyPtr->outline.gc != None) { + if (polyPtr->outline.gc != NULL) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc); } polyPtr->outline.gc = newGC; @@ -504,7 +504,7 @@ ConfigurePolygon( } if (color == NULL) { - newGC = None; + newGC = NULL; } else { gcValues.foreground = color->pixel; mask = GCForeground; @@ -518,13 +518,13 @@ ConfigurePolygon( * Mac OS X CG drawing needs access to the outline linewidth * even for fills (as linewidth controls antialiasing). */ - gcValues.line_width = polyPtr->outline.gc != None ? + gcValues.line_width = polyPtr->outline.gc != NULL ? polyPtr->outline.gc->line_width : 0; mask |= GCLineWidth; #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (polyPtr->fillGC != None) { + if (polyPtr->fillGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC); } polyPtr->fillGC = newGC; @@ -590,7 +590,7 @@ DeletePolygon( if (polyPtr->disabledFillStipple != None) { Tk_FreeBitmap(display, polyPtr->disabledFillStipple); } - if (polyPtr->fillGC != None) { + if (polyPtr->fillGC != NULL) { Tk_FreeGC(display, polyPtr->fillGC); } } @@ -694,7 +694,7 @@ ComputePolygonBbox( } } - if (polyPtr->outline.gc != None) { + if (polyPtr->outline.gc != NULL) { tsoffset = &polyPtr->outline.tsoffset; if (tsoffset) { if (tsoffset->flags & TK_OFFSET_INDEX) { @@ -836,11 +836,11 @@ TkFillPolygon( * allocated. */ - if (gc != None && numPoints > 3) { + if (gc != NULL && numPoints > 3) { XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex, CoordModeOrigin); } - if (outlineGC != None) { + if (outlineGC != NULL) { XDrawLines(display, drawable, outlineGC, pointPtr, numPoints, CoordModeOrigin); } @@ -881,9 +881,9 @@ DisplayPolygon( Pixmap stipple = polyPtr->fillStipple; double linewidth = polyPtr->outline.width; - if (((polyPtr->fillGC == None) && (polyPtr->outline.gc == None)) || + if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) || (polyPtr->numPoints < 1) || - (polyPtr->numPoints < 3 && polyPtr->outline.gc == None)) { + (polyPtr->numPoints < 3 && polyPtr->outline.gc == NULL)) { return; } @@ -911,7 +911,7 @@ DisplayPolygon( * reset the offset when done, since the GC is supposed to be read-only. */ - if ((stipple != None) && (polyPtr->fillGC != None)) { + if ((stipple != None) && (polyPtr->fillGC != NULL)) { Tk_TSOffset *tsoffset = &polyPtr->tsoffset; int w = 0, h = 0; int flags = tsoffset->flags; @@ -973,11 +973,11 @@ DisplayPolygon( } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); - if (polyPtr->fillGC != None) { + if (polyPtr->fillGC != NULL) { XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr, numPoints, Complex, CoordModeOrigin); } - if (polyPtr->outline.gc != None) { + if (polyPtr->outline.gc != NULL) { XDrawLines(display, drawable, polyPtr->outline.gc, pointPtr, numPoints, CoordModeOrigin); } @@ -986,7 +986,7 @@ DisplayPolygon( } } Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline); - if ((stipple != None) && (polyPtr->fillGC != None)) { + if ((stipple != None) && (polyPtr->fillGC != NULL)) { XSetTSOrigin(display, polyPtr->fillGC, 0, 0); } } @@ -1299,7 +1299,7 @@ PolygonToPoint( if (bestDist <= 0.0) { goto donepoint; } - if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) { + if ((polyPtr->outline.gc != NULL) && (polyPtr->joinStyle == JoinRound)) { dist = bestDist - radius; if (dist <= 0.0) { bestDist = 0.0; @@ -1309,7 +1309,7 @@ PolygonToPoint( } } - if ((polyPtr->outline.gc == None) || (width <= 1)) { + if ((polyPtr->outline.gc == NULL) || (width <= 1)) { goto donepoint; } @@ -1515,7 +1515,7 @@ PolygonToArea( goto donearea; } - if (polyPtr->outline.gc == None) { + if (polyPtr->outline.gc == NULL) { goto donearea; } diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index b4fa656..cfffc62 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -269,9 +269,9 @@ CreateText( textPtr->textLayout = NULL; textPtr->actualWidth = 0; textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0; - textPtr->gc = None; - textPtr->selTextGC = None; - textPtr->cursorOffGC = None; + textPtr->gc = NULL; + textPtr->selTextGC = NULL; + textPtr->cursorOffGC = NULL; textPtr->sine = 0.0; textPtr->cosine = 1.0; @@ -447,7 +447,7 @@ ConfigureText( } } - newGC = newSelGC = None; + newGC = newSelGC = NULL; if (textPtr->tkfont != NULL) { gcValues.font = Tk_FontId(textPtr->tkfont); mask = GCFont; @@ -472,11 +472,11 @@ ConfigureText( } newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues); } - if (textPtr->gc != None) { + if (textPtr->gc != NULL) { Tk_FreeGC(Tk_Display(tkwin), textPtr->gc); } textPtr->gc = newGC; - if (textPtr->selTextGC != None) { + if (textPtr->selTextGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), textPtr->selTextGC); } textPtr->selTextGC = newSelGC; @@ -491,9 +491,9 @@ ConfigureText( } newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); } else { - newGC = None; + newGC = NULL; } - if (textPtr->cursorOffGC != None) { + if (textPtr->cursorOffGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC); } textPtr->cursorOffGC = newGC; @@ -592,13 +592,13 @@ DeleteText( } Tk_FreeTextLayout(textPtr->textLayout); - if (textPtr->gc != None) { + if (textPtr->gc != NULL) { Tk_FreeGC(display, textPtr->gc); } - if (textPtr->selTextGC != None) { + if (textPtr->selTextGC != NULL) { Tk_FreeGC(display, textPtr->selTextGC); } - if (textPtr->cursorOffGC != None) { + if (textPtr->cursorOffGC != NULL) { Tk_FreeGC(display, textPtr->cursorOffGC); } } @@ -820,7 +820,7 @@ DisplayCanvText( } } - if (textPtr->gc == None) { + if (textPtr->gc == NULL) { return; } @@ -932,7 +932,7 @@ DisplayCanvText( Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->insertBorder, points, 4, textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED); - } else if (textPtr->cursorOffGC != None) { + } else if (textPtr->cursorOffGC != NULL) { /* * Redraw the background over the area of the cursor, even * though the cursor is turned off. This guarantees that the diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index 09ce98c..6ce671d 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -961,7 +961,7 @@ void Tk_CreateOutline( Tk_Outline *outline) /* Outline structure to be filled in. */ { - outline->gc = None; + outline->gc = NULL; outline->width = 1.0; outline->activeWidth = 0.0; outline->disabledWidth = 0.0; @@ -1002,7 +1002,7 @@ Tk_DeleteOutline( Display *display, /* Display containing window. */ Tk_Outline *outline) { - if (outline->gc != None) { + if (outline->gc != NULL) { Tk_FreeGC(display, outline->gc); } if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) { diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index c0b5dce..01f2981 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -625,7 +625,7 @@ Tk_CanvasObjCmd( canvasPtr->highlightBgColorPtr = NULL; canvasPtr->highlightColorPtr = NULL; canvasPtr->inset = 0; - canvasPtr->pixmapGC = None; + canvasPtr->pixmapGC = NULL; canvasPtr->width = None; canvasPtr->height = None; canvasPtr->confine = 0; @@ -671,7 +671,7 @@ Tk_CanvasObjCmd( canvasPtr->scanYOrigin = 0; canvasPtr->hotPtr = NULL; canvasPtr->hotPrevPtr = NULL; - canvasPtr->cursor = None; + canvasPtr->cursor = NULL; canvasPtr->takeFocus = NULL; canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin)); canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin)); @@ -2135,7 +2135,7 @@ DestroyCanvas( */ Tcl_DeleteHashTable(&canvasPtr->idTable); - if (canvasPtr->pixmapGC != None) { + if (canvasPtr->pixmapGC != NULL) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } expr = canvasPtr->bindTagExprs; @@ -2209,7 +2209,7 @@ ConfigureCanvas( gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; newGC = Tk_GetGC(canvasPtr->tkwin, GCFunction|GCGraphicsExposures|GCForeground, &gcValues); - if (canvasPtr->pixmapGC != None) { + if (canvasPtr->pixmapGC != NULL) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } canvasPtr->pixmapGC = newGC; diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h index b8b1b46..e2221a8 100644 --- a/generic/tkCanvas.h +++ b/generic/tkCanvas.h @@ -206,7 +206,7 @@ typedef struct TkCanvas { * Miscellaneous information: */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ diff --git a/generic/tkCmds.c b/generic/tkCmds.c index f0c489a..cefd5fc 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -942,11 +942,11 @@ InactiveCmd( return TCL_ERROR; } if (objc - skip == 1) { - long inactive; + Tcl_WideInt inactive; inactive = (Tcl_IsSafe(interp) ? -1 : Tk_GetUserInactiveTime(Tk_Display(tkwin))); - Tcl_SetObjResult(interp, Tcl_NewLongObj(inactive)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(inactive)); } else if (objc - skip == 2) { const char *string; @@ -1579,11 +1579,11 @@ Tk_WinfoObjCmd( objv += skip; string = Tcl_GetString(objv[2]); Tcl_SetObjResult(interp, - Tcl_NewLongObj((long) Tk_InternAtom(tkwin, string))); + Tcl_NewWideIntObj(Tk_InternAtom(tkwin, string))); break; case WIN_ATOMNAME: { const char *name; - long id; + Tcl_WideInt id; skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { @@ -1594,7 +1594,7 @@ Tk_WinfoObjCmd( return TCL_ERROR; } objv += skip; - if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) { + if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) { return TCL_ERROR; } name = Tk_GetAtomName(tkwin, (Atom) id); diff --git a/generic/tkColor.c b/generic/tkColor.c index 9d5e157..3a82545 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -245,7 +245,7 @@ Tk_GetColor( */ tkColPtr->magic = COLOR_MAGIC; - tkColPtr->gc = None; + tkColPtr->gc = NULL; tkColPtr->screen = Tk_Screen(tkwin); tkColPtr->colormap = Tk_Colormap(tkwin); tkColPtr->visual = Tk_Visual(tkwin); @@ -326,7 +326,7 @@ Tk_GetColorByValue( tkColPtr = TkpGetColorByValue(tkwin, colorPtr); tkColPtr->magic = COLOR_MAGIC; - tkColPtr->gc = None; + tkColPtr->gc = NULL; tkColPtr->screen = Tk_Screen(tkwin); tkColPtr->colormap = valueKey.colormap; tkColPtr->visual = Tk_Visual(tkwin); @@ -436,7 +436,7 @@ Tk_GCForColor( Tcl_Panic("Tk_GCForColor called with bogus color"); } - if (tkColPtr->gc == None) { + if (tkColPtr->gc == NULL) { gcValues.foreground = tkColPtr->color.pixel; tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable, GCForeground, &gcValues); @@ -490,9 +490,9 @@ Tk_FreeColor( * longer any objects referencing it. */ - if (tkColPtr->gc != None) { + if (tkColPtr->gc != NULL) { XFreeGC(DisplayOfScreen(screen), tkColPtr->gc); - tkColPtr->gc = None; + tkColPtr->gc = NULL; } TkpFreeColor(tkColPtr); diff --git a/generic/tkColor.h b/generic/tkColor.h index d5bde9d..bcd71fe 100644 --- a/generic/tkColor.h +++ b/generic/tkColor.h @@ -32,7 +32,7 @@ typedef struct TkColor { * COLOR_MAGIC. */ GC gc; /* Simple gc with this color as foreground * color and all other fields defaulted. May - * be None. */ + * be NULL. */ Screen *screen; /* Screen where this color is valid. Used to * delete it, and to find its display. */ Colormap colormap; /* Colormap from which this entry was diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 46300d3..b9499e5 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -799,11 +799,11 @@ DoObjConfig( Tk_Cursor newCursor; if (nullOK && ObjectIsEmpty(valuePtr)) { - newCursor = None; + newCursor = NULL; valuePtr = NULL; } else { newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr); - if (newCursor == None) { + if (newCursor == NULL) { return TCL_ERROR; } } @@ -861,7 +861,7 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; - newWin = None; + newWin = NULL; } else { if (TkGetWindowFromObj(interp, tkwin, valuePtr, &newWin) != TCL_OK) { @@ -1663,9 +1663,9 @@ FreeResources( break; case TK_OPTION_CURSOR: if (internalFormExists) { - if (*((Tk_Cursor *) internalPtr) != None) { + if (*((Tk_Cursor *) internalPtr) != NULL) { Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr)); - *((Tk_Cursor *) internalPtr) = None; + *((Tk_Cursor *) internalPtr) = NULL; } } else if (objPtr != NULL) { Tk_FreeCursorFromObj(tkwin, objPtr); @@ -1936,7 +1936,7 @@ GetObjectForOption( case TK_OPTION_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) internalPtr); - if (cursor != None) { + if (cursor != NULL) { objPtr = Tcl_NewStringObj( Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1); } diff --git a/generic/tkCursor.c b/generic/tkCursor.c index afdf6dd..76bbc89 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -150,7 +150,7 @@ Tk_AllocCursorFromObj( cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr)); objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; if (cursorPtr == NULL) { - return None; + return NULL; } cursorPtr->objRefCount++; return cursorPtr->cursor; @@ -190,7 +190,7 @@ Tk_GetCursor( TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string); if (cursorPtr == NULL) { - return None; + return NULL; } return cursorPtr->cursor; } @@ -388,7 +388,7 @@ Tk_GetCursorFromData( error: Tcl_DeleteHashEntry(dataHashPtr); - return None; + return NULL; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index e045772..5a39f53 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -536,20 +536,20 @@ Tk_EntryObjCmd( entryPtr->selectFirst = -1; entryPtr->selectLast = -1; - entryPtr->cursor = None; + entryPtr->cursor = NULL; entryPtr->exportSelection = 1; entryPtr->justify = TK_JUSTIFY_LEFT; entryPtr->relief = TK_RELIEF_FLAT; entryPtr->state = STATE_NORMAL; entryPtr->displayString = entryPtr->string; entryPtr->inset = XPAD; - entryPtr->textGC = None; - entryPtr->selTextGC = None; - entryPtr->highlightGC = None; + entryPtr->textGC = NULL; + entryPtr->selTextGC = NULL; + entryPtr->highlightGC = NULL; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; - entryPtr->placeholderGC = None; + entryPtr->placeholderGC = NULL; /* * Keep a hold of the associated tkwin until we destroy the entry, @@ -1047,10 +1047,10 @@ DestroyEntry( EntryTextVarProc, entryPtr); entryPtr->flags &= ~ENTRY_VAR_TRACED; } - if (entryPtr->textGC != None) { + if (entryPtr->textGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } - if (entryPtr->selTextGC != None) { + if (entryPtr->selTextGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler); @@ -1446,7 +1446,7 @@ EntryWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = None; + GC gc = NULL; unsigned long mask; Tk_3DBorder border; XColor *colorPtr; @@ -1498,7 +1498,7 @@ EntryWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->textGC != None) { + if (entryPtr->textGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } entryPtr->textGC = gc; @@ -1508,7 +1508,7 @@ EntryWorldChanged( } mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->placeholderGC != None) { + if (entryPtr->placeholderGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->placeholderGC); } entryPtr->placeholderGC = gc; @@ -1521,7 +1521,7 @@ EntryWorldChanged( gcValues.font = Tk_FontId(entryPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->selTextGC != None) { + if (entryPtr->selTextGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } entryPtr->selTextGC = gc; @@ -2541,9 +2541,9 @@ EntryEventProc( } else if ((elem == SEL_BUTTONDOWN) || (elem == SEL_BUTTONUP)) { cursor = sbPtr->bCursor; } else { - cursor = None; + cursor = NULL; } - if (cursor != None) { + if (cursor != NULL) { Tk_DefineCursor(entryPtr->tkwin, cursor); } else { Tk_UndefineCursor(entryPtr->tkwin); @@ -3717,22 +3717,22 @@ Tk_SpinboxObjCmd( entryPtr->selectFirst = -1; entryPtr->selectLast = -1; - entryPtr->cursor = None; + entryPtr->cursor = NULL; entryPtr->exportSelection = 1; entryPtr->justify = TK_JUSTIFY_LEFT; entryPtr->relief = TK_RELIEF_FLAT; entryPtr->state = STATE_NORMAL; entryPtr->displayString = entryPtr->string; entryPtr->inset = XPAD; - entryPtr->textGC = None; - entryPtr->selTextGC = None; - entryPtr->highlightGC = None; + entryPtr->textGC = NULL; + entryPtr->selTextGC = NULL; + entryPtr->highlightGC = NULL; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; sbPtr->selElement = SEL_NONE; sbPtr->curElement = SEL_NONE; - sbPtr->bCursor = None; + sbPtr->bCursor = NULL; sbPtr->repeatDelay = 400; sbPtr->repeatInterval = 100; sbPtr->fromValue = 0.0; @@ -3742,7 +3742,7 @@ Tk_SpinboxObjCmd( sbPtr->bdRelief = TK_RELIEF_FLAT; sbPtr->buRelief = TK_RELIEF_FLAT; - entryPtr->placeholderGC = None; + entryPtr->placeholderGC = NULL; /* * Keep a hold of the associated tkwin until we destroy the spinbox, diff --git a/generic/tkEntry.h b/generic/tkEntry.h index e74b52b..c81563c 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -82,7 +82,7 @@ typedef struct { * in readonly state, plus used for * background. */ int borderWidth; /* Width of 3-D border around window. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ int exportSelection; /* Non-zero means tie internal entry selection * to X selection. */ Tk_Font tkfont; /* Information about text font, or NULL. */ @@ -205,7 +205,7 @@ typedef struct { Tk_3DBorder activeBorder; /* Used for drawing border around active * buttons. */ Tk_3DBorder buttonBorder; /* Used for drawing border around buttons. */ - Tk_Cursor bCursor; /* cursor for buttons, or None. */ + Tk_Cursor bCursor; /* cursor for buttons, or NULL. */ int bdRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ int buRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ char *command; /* Command to invoke for spin buttons. NULL diff --git a/generic/tkEvent.c b/generic/tkEvent.c index d058e7c..891f667 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -1368,7 +1368,7 @@ Tk_HandleEvent( * handle CreateNotify events, so we gotta pass 'em through. */ - if ((ip.winPtr != None) + if ((ip.winPtr != NULL) && ((mask != SubstructureNotifyMask) || (eventPtr->type == CreateNotify))) { TkBindEventProc(winPtr, eventPtr); @@ -1439,7 +1439,7 @@ TkEventDeadWindow( ipPtr->nextHandler = NULL; } if (ipPtr->winPtr == winPtr) { - ipPtr->winPtr = None; + ipPtr->winPtr = NULL; } } ckfree(handlerPtr); diff --git a/generic/tkFrame.c b/generic/tkFrame.c index eb9dc4c..708faef 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -663,13 +663,13 @@ CreateFrame( framePtr->type = type; framePtr->colormap = colormap; framePtr->relief = TK_RELIEF_FLAT; - framePtr->cursor = None; + framePtr->cursor = NULL; if (framePtr->type == TYPE_LABELFRAME) { Labelframe *labelframePtr = (Labelframe *) framePtr; labelframePtr->labelAnchor = LABELANCHOR_NW; - labelframePtr->textGC = None; + labelframePtr->textGC = NULL; } /* @@ -866,7 +866,7 @@ DestroyFrame( if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); - if (labelframePtr->textGC != None) { + if (labelframePtr->textGC != NULL) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } } @@ -1122,7 +1122,7 @@ FrameWorldChanged( gcValues.graphics_exposures = False; gc = Tk_GetGC(tkwin, GCForeground | GCFont | GCGraphicsExposures, &gcValues); - if (labelframePtr->textGC != None) { + if (labelframePtr->textGC != NULL) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } labelframePtr->textGC = gc; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index c37b6be..ff5d083 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -426,12 +426,7 @@ Tk_Grab( } Tk_MakeWindowExist(tkwin); -#ifndef MAC_OSX_TK - if (!grabGlobal) -#else - if (0) -#endif /* MAC_OSX_TK */ - { + if (!grabGlobal) { Window dummy1, dummy2; int dummy3, dummy4, dummy5, dummy6; unsigned int state; diff --git a/generic/tkImage.c b/generic/tkImage.c index 359d6c6..32e09c0 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -775,7 +775,7 @@ Tk_PostscriptImage( gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); - if (newGC != None) { + if (newGC != NULL) { XFillRectangle(Tk_Display(tkwin), pmap, newGC, 0, 0, (unsigned) width, (unsigned) height); Tk_FreeGC(Tk_Display(tkwin), newGC); diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 2104ea8..f83f4cc 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -427,9 +427,9 @@ ImgBmapConfigureInstance( } gc = Tk_GetGC(instancePtr->tkwin, mask, &gcValues); } else { - gc = None; + gc = NULL; } - if (instancePtr->gc != None) { + if (instancePtr->gc != NULL) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } instancePtr->gc = gc; @@ -441,10 +441,10 @@ ImgBmapConfigureInstance( * it clear that this instance cannot be displayed. Then report the error. */ - if (instancePtr->gc != None) { + if (instancePtr->gc != NULL) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } - instancePtr->gc = None; + instancePtr->gc = NULL; Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf( "\n (while configuring image \"%s\")", Tk_NameOfImage( masterPtr->tkMaster))); @@ -848,7 +848,7 @@ ImgBmapGet( instancePtr->bg = NULL; instancePtr->bitmap = None; instancePtr->mask = None; - instancePtr->gc = None; + instancePtr->gc = NULL; instancePtr->nextPtr = masterPtr->instancePtr; masterPtr->instancePtr = instancePtr; ImgBmapConfigureInstance(instancePtr); @@ -902,7 +902,7 @@ ImgBmapDisplay( * creating the image instance so it can't be displayed. */ - if (instancePtr->gc == None) { + if (instancePtr->gc == NULL) { return; } @@ -972,7 +972,7 @@ ImgBmapFree( if (instancePtr->mask != None) { Tk_FreePixmap(display, instancePtr->mask); } - if (instancePtr->gc != None) { + if (instancePtr->gc != NULL) { Tk_FreeGC(display, instancePtr->gc); } if (instancePtr->masterPtr->instancePtr == instancePtr) { diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 1dc8840..f67ab36 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -1589,7 +1589,7 @@ TkImgDisposeInstance( if (instancePtr->pixels != None) { Tk_FreePixmap(instancePtr->display, instancePtr->pixels); } - if (instancePtr->gc != None) { + if (instancePtr->gc != NULL) { Tk_FreeGC(instancePtr->display, instancePtr->gc); } if (instancePtr->imagePtr != NULL) { diff --git a/generic/tkListbox.c b/generic/tkListbox.c index dce0106..e35c6c5 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -542,13 +542,13 @@ Tk_ListboxObjCmd( listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS); listPtr->relief = TK_RELIEF_RAISED; - listPtr->textGC = None; - listPtr->selFgColorPtr = None; - listPtr->selTextGC = None; + listPtr->textGC = NULL; + listPtr->selFgColorPtr = NULL; + listPtr->selTextGC = NULL; listPtr->fullLines = 1; listPtr->xScrollUnit = 1; listPtr->exportSelection = 1; - listPtr->cursor = None; + listPtr->cursor = NULL; listPtr->state = STATE_NORMAL; listPtr->gray = None; listPtr->justify = TK_JUSTIFY_LEFT; @@ -1489,10 +1489,10 @@ DestroyListbox( * Tk_FreeOptions handle all the standard option-related stuff. */ - if (listPtr->textGC != None) { + if (listPtr->textGC != NULL) { Tk_FreeGC(listPtr->display, listPtr->textGC); } - if (listPtr->selTextGC != None) { + if (listPtr->selTextGC != NULL) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } if (listPtr->gray != None) { @@ -1792,7 +1792,7 @@ ListboxWorldChanged( gcValues.font = Tk_FontId(listPtr->tkfont); gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); - if (listPtr->textGC != None) { + if (listPtr->textGC != NULL) { Tk_FreeGC(listPtr->display, listPtr->textGC); } listPtr->textGC = gc; @@ -1803,7 +1803,7 @@ ListboxWorldChanged( gcValues.font = Tk_FontId(listPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); - if (listPtr->selTextGC != None) { + if (listPtr->selTextGC != NULL) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } listPtr->selTextGC = gc; diff --git a/generic/tkMain.c b/generic/tkMain.c index ffcaecf..eb311ff 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -37,7 +37,7 @@ extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); * The default prompt used when the user has not overridden it. */ -#define DEFAULT_PRIMARY_PROMPT "% " +static const char DEFAULT_PRIMARY_PROMPT[] = "% "; /* * This file can be compiled on Windows in UNICODE mode, as well as @@ -512,7 +512,7 @@ Prompt( chan = Tcl_GetStdChannel(TCL_STDOUT); if (chan != NULL) { Tcl_WriteChars(chan, DEFAULT_PRIMARY_PROMPT, - strlen(DEFAULT_PRIMARY_PROMPT)); + sizeof(DEFAULT_PRIMARY_PROMPT) - 1); } } } else { diff --git a/generic/tkMenu.c b/generic/tkMenu.c index e67c476..0bd40a6 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -458,7 +458,7 @@ Tk_MenuObjCmd( Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, MenuCmdDeletedProc); menuPtr->active = -1; - menuPtr->cursorPtr = None; + menuPtr->cursorPtr = NULL; menuPtr->masterMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; TkMenuInitializeDrawingFields(menuPtr); diff --git a/generic/tkMenu.h b/generic/tkMenu.h index 6d51a72..802781a 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -75,8 +75,8 @@ typedef struct TkMenuEntry { * of character to underline (-1 means don't * underline anything). */ Tcl_Obj *underlinePtr; /* Index of character to underline. */ - Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or None. - * If not None then label is ignored. */ + Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL. + * If not NULL then label is ignored. */ Tcl_Obj *imagePtr; /* Name of image to display, or NULL. If not * NULL, bitmap, text, and textVarName are * ignored. */ @@ -175,7 +175,7 @@ typedef struct TkMenuEntry { * NULL means use overall disabledGC from menu * structure. See comments for disabledFg in * menu structure for more information. */ - GC indicatorGC; /* For drawing indicators. None means use GC + GC indicatorGC; /* For drawing indicators. NULL means use GC * from menu. */ /* @@ -340,7 +340,7 @@ typedef struct TkMenu { Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ - Tcl_Obj *cursorPtr; /* Current cursor for window, or None. */ + Tcl_Obj *cursorPtr; /* Current cursor for window, or NULL. */ Tcl_Obj *postCommandPtr; /* Used to detect cycles in cascade hierarchy * trees when preprocessing postcommands on * some platforms. See PostMenu for more diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 3f492db..3abfc3c 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -43,12 +43,12 @@ void TkMenuInitializeDrawingFields( TkMenu *menuPtr) /* The menu we are initializing. */ { - menuPtr->textGC = None; + menuPtr->textGC = NULL; menuPtr->gray = None; - menuPtr->disabledGC = None; - menuPtr->activeGC = None; - menuPtr->indicatorGC = None; - menuPtr->disabledImageGC = None; + menuPtr->disabledGC = NULL; + menuPtr->activeGC = NULL; + menuPtr->indicatorGC = NULL; + menuPtr->disabledImageGC = NULL; menuPtr->totalWidth = menuPtr->totalHeight = 0; } @@ -79,10 +79,10 @@ TkMenuInitializeEntryDrawingFields( mePtr->y = 0; mePtr->indicatorSpace = 0; mePtr->labelWidth = 0; - mePtr->textGC = None; - mePtr->activeGC = None; - mePtr->disabledGC = None; - mePtr->indicatorGC = None; + mePtr->textGC = NULL; + mePtr->activeGC = NULL; + mePtr->disabledGC = NULL; + mePtr->indicatorGC = NULL; } /* @@ -106,22 +106,22 @@ void TkMenuFreeDrawOptions( TkMenu *menuPtr) { - if (menuPtr->textGC != None) { + if (menuPtr->textGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->textGC); } - if (menuPtr->disabledImageGC != None) { + if (menuPtr->disabledImageGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->disabledImageGC); } if (menuPtr->gray != None) { Tk_FreeBitmap(menuPtr->display, menuPtr->gray); } - if (menuPtr->disabledGC != None) { + if (menuPtr->disabledGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->disabledGC); } - if (menuPtr->activeGC != None) { + if (menuPtr->activeGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->activeGC); } - if (menuPtr->indicatorGC != None) { + if (menuPtr->indicatorGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC); } } @@ -147,16 +147,16 @@ void TkMenuEntryFreeDrawOptions( TkMenuEntry *mePtr) { - if (mePtr->textGC != None) { + if (mePtr->textGC != NULL) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->textGC); } - if (mePtr->disabledGC != None) { + if (mePtr->disabledGC != NULL) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->disabledGC); } - if (mePtr->activeGC != None) { + if (mePtr->activeGC != NULL) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->activeGC); } - if (mePtr->indicatorGC != None) { + if (mePtr->indicatorGC != NULL) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->indicatorGC); } } @@ -205,7 +205,7 @@ TkMenuConfigureDrawOptions( gcValues.background = Tk_3DBorderColor(border)->pixel; newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont, &gcValues); - if (menuPtr->textGC != None) { + if (menuPtr->textGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->textGC); } menuPtr->textGC = newGC; @@ -233,7 +233,7 @@ TkMenuConfigureDrawOptions( } } newGC = Tk_GetGC(menuPtr->tkwin, mask, &gcValues); - if (menuPtr->disabledGC != None) { + if (menuPtr->disabledGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->disabledGC); } menuPtr->disabledGC = newGC; @@ -249,7 +249,7 @@ TkMenuConfigureDrawOptions( newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCFillStyle|GCStipple, &gcValues); } - if (menuPtr->disabledImageGC != None) { + if (menuPtr->disabledImageGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->disabledImageGC); } menuPtr->disabledImageGC = newGC; @@ -262,7 +262,7 @@ TkMenuConfigureDrawOptions( gcValues.background = Tk_3DBorderColor(activeBorder)->pixel; newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont, &gcValues); - if (menuPtr->activeGC != None) { + if (menuPtr->activeGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->activeGC); } menuPtr->activeGC = newGC; @@ -273,7 +273,7 @@ TkMenuConfigureDrawOptions( gcValues.background = Tk_3DBorderColor(border)->pixel; newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont, &gcValues); - if (menuPtr->indicatorGC != None) { + if (menuPtr->indicatorGC != NULL) { Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC); } menuPtr->indicatorGC = newGC; @@ -385,24 +385,24 @@ TkMenuConfigureEntryDrawOptions( GCForeground|GCBackground|GCFont|GCGraphicsExposures, &gcValues); } else { - newGC = None; - newActiveGC = None; - newDisabledGC = None; - newIndicatorGC = None; + newGC = NULL; + newActiveGC = NULL; + newDisabledGC = NULL; + newIndicatorGC = NULL; } - if (mePtr->textGC != None) { + if (mePtr->textGC != NULL) { Tk_FreeGC(menuPtr->display, mePtr->textGC); } mePtr->textGC = newGC; - if (mePtr->activeGC != None) { + if (mePtr->activeGC != NULL) { Tk_FreeGC(menuPtr->display, mePtr->activeGC); } mePtr->activeGC = newActiveGC; - if (mePtr->disabledGC != None) { + if (mePtr->disabledGC != NULL) { Tk_FreeGC(menuPtr->display, mePtr->disabledGC); } mePtr->disabledGC = newDisabledGC; - if (mePtr->indicatorGC != None) { + if (mePtr->indicatorGC != NULL) { Tk_FreeGC(menuPtr->display, mePtr->indicatorGC); } mePtr->indicatorGC = newIndicatorGC; diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index d3372cc..65883c0 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -279,11 +279,11 @@ Tk_MenubuttonObjCmd( mbPtr->normalFg = NULL; mbPtr->activeFg = NULL; mbPtr->disabledFg = NULL; - mbPtr->normalTextGC = None; - mbPtr->activeTextGC = None; + mbPtr->normalTextGC = NULL; + mbPtr->activeTextGC = NULL; mbPtr->gray = None; - mbPtr->disabledGC = None; - mbPtr->stippleGC = None; + mbPtr->disabledGC = NULL; + mbPtr->stippleGC = NULL; mbPtr->leftBearing = 0; mbPtr->rightBearing = 0; mbPtr->widthString = NULL; @@ -300,7 +300,7 @@ Tk_MenubuttonObjCmd( mbPtr->indicatorWidth = 0; mbPtr->indicatorHeight = 0; mbPtr->direction = DIRECTION_FLUSH; - mbPtr->cursor = None; + mbPtr->cursor = NULL; mbPtr->takeFocus = NULL; mbPtr->flags = 0; @@ -443,16 +443,16 @@ DestroyMenuButton( if (mbPtr->image != NULL) { Tk_FreeImage(mbPtr->image); } - if (mbPtr->normalTextGC != None) { + if (mbPtr->normalTextGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC); } - if (mbPtr->activeTextGC != None) { + if (mbPtr->activeTextGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } - if (mbPtr->disabledGC != None) { + if (mbPtr->disabledGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } - if (mbPtr->stippleGC != None) { + if (mbPtr->stippleGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->stippleGC); } if (mbPtr->gray != None) { @@ -690,7 +690,7 @@ TkMenuButtonWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->normalTextGC != None) { + if (mbPtr->normalTextGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC); } mbPtr->normalTextGC = gc; @@ -699,7 +699,7 @@ TkMenuButtonWorldChanged( gcValues.background = Tk_3DBorderColor(mbPtr->activeBorder)->pixel; mask = GCForeground | GCBackground | GCFont; gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->activeTextGC != None) { + if (mbPtr->activeTextGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } mbPtr->activeTextGC = gc; @@ -710,7 +710,7 @@ TkMenuButtonWorldChanged( * Create the GC that can be used for stippling */ - if (mbPtr->stippleGC == None) { + if (mbPtr->stippleGC == NULL) { gcValues.foreground = gcValues.background; mask = GCForeground; if (mbPtr->gray == None) { @@ -736,7 +736,7 @@ TkMenuButtonWorldChanged( gcValues.foreground = gcValues.background; } gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->disabledGC != None) { + if (mbPtr->disabledGC != NULL) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } mbPtr->disabledGC = gc; diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h index e8dc12f..1dbacb3 100644 --- a/generic/tkMenubutton.h +++ b/generic/tkMenubutton.h @@ -170,7 +170,7 @@ typedef struct { * "left" and "right" will pop the menu left * or right, and the active item will be next * to the button. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 96724db..2495ce2 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -256,11 +256,11 @@ Tk_MessageObjCmd( MessageCmdDeletedProc); msgPtr->optionTable = optionTable; msgPtr->relief = TK_RELIEF_FLAT; - msgPtr->textGC = None; + msgPtr->textGC = NULL; msgPtr->anchor = TK_ANCHOR_CENTER; msgPtr->aspect = 150; msgPtr->justify = TK_JUSTIFY_LEFT; - msgPtr->cursor = None; + msgPtr->cursor = NULL; Tk_SetClass(msgPtr->tkwin, "Message"); Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr); @@ -398,7 +398,7 @@ DestroyMessage( * Tk_FreeConfigOptions handle all the standard option-related stuff. */ - if (msgPtr->textGC != None) { + if (msgPtr->textGC != NULL) { Tk_FreeGC(msgPtr->display, msgPtr->textGC); } if (msgPtr->textLayout != NULL) { @@ -525,7 +525,7 @@ MessageWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = None; + GC gc = NULL; Tk_FontMetrics fm; Message *msgPtr = instanceData; @@ -536,7 +536,7 @@ MessageWorldChanged( gcValues.font = Tk_FontId(msgPtr->tkfont); gcValues.foreground = msgPtr->fgColorPtr->pixel; gc = Tk_GetGC(msgPtr->tkwin, GCForeground | GCFont, &gcValues); - if (msgPtr->textGC != None) { + if (msgPtr->textGC != NULL) { Tk_FreeGC(msgPtr->display, msgPtr->textGC); } msgPtr->textGC = gc; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 4473a3e..d83c30b 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -481,16 +481,16 @@ DoConfig( Tk_Cursor newCursor, oldCursor; if (nullValue) { - newCursor = None; + newCursor = NULL; } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newCursor = Tk_GetCursor(interp, tkwin, uid); - if (newCursor == None) { + if (newCursor == NULL) { return TCL_ERROR; } } oldCursor = *((Tk_Cursor *) ptr); - if (oldCursor != None) { + if (oldCursor != NULL) { Tk_FreeCursor(Tk_Display(tkwin), oldCursor); } *((Tk_Cursor *) ptr) = newCursor; @@ -842,7 +842,7 @@ FormatConfigValue( case TK_CONFIG_ACTIVE_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) ptr); - if (cursor != None) { + if (cursor != NULL) { result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); } break; @@ -1027,9 +1027,9 @@ Tk_FreeOptions( break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: - if (*((Tk_Cursor *) ptr) != None) { + if (*((Tk_Cursor *) ptr) != NULL) { Tk_FreeCursor(display, *((Tk_Cursor *) ptr)); - *((Tk_Cursor *) ptr) = None; + *((Tk_Cursor *) ptr) = NULL; } } } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 967d322..d6953e7 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -448,9 +448,9 @@ Tk_PanedWindowObjCmd( pwPtr->optionTable = pwOpts->pwOptions; pwPtr->slaveOpts = pwOpts->slaveOpts; pwPtr->relief = TK_RELIEF_RAISED; - pwPtr->gc = None; - pwPtr->cursor = None; - pwPtr->sashCursor = None; + pwPtr->gc = NULL; + pwPtr->cursor = NULL; + pwPtr->sashCursor = NULL; /* * Keep a hold of the associated tkwin until we destroy the widget, @@ -862,7 +862,7 @@ ConfigureSlaves( index = -1; haveLoc = 0; - if (options.after != None) { + if (options.after != NULL) { tkwin = options.after; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -871,7 +871,7 @@ ConfigureSlaves( break; } } - } else if (options.before != None) { + } else if (options.before != NULL) { tkwin = options.before; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -1304,7 +1304,7 @@ PanedWindowWorldChanged( gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel; newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues); - if (pwPtr->gc != None) { + if (pwPtr->gc != NULL) { Tk_FreeGC(pwPtr->display, pwPtr->gc); } pwPtr->gc = newGC; @@ -2044,10 +2044,10 @@ Unlink( for (i = 0; i < masterPtr->numSlaves; i++) { if (masterPtr->slaves[i]->before == slavePtr->tkwin) { - masterPtr->slaves[i]->before = None; + masterPtr->slaves[i]->before = NULL; } if (masterPtr->slaves[i]->after == slavePtr->tkwin) { - masterPtr->slaves[i]->after = None; + masterPtr->slaves[i]->after = NULL; } } diff --git a/generic/tkPlace.c b/generic/tkPlace.c index e7cfbaf..1e606be 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -395,7 +395,7 @@ CreateSlave( slavePtr = ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); slavePtr->tkwin = tkwin; - slavePtr->inTkwin = None; + slavePtr->inTkwin = NULL; slavePtr->anchor = TK_ANCHOR_NW; slavePtr->borderMode = BM_INSIDE; slavePtr->optionTable = table; diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index e650030..58bb99a 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -258,7 +258,7 @@ CreateRectOval( rectOvalPtr->fillStipple = None; rectOvalPtr->activeFillStipple = None; rectOvalPtr->disabledFillStipple = None; - rectOvalPtr->fillGC = None; + rectOvalPtr->fillGC = NULL; /* * Process the arguments to fill in the item record. @@ -466,9 +466,9 @@ ConfigureRectOval( mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = None; + newGC = NULL; } - if (rectOvalPtr->outline.gc != None) { + if (rectOvalPtr->outline.gc != NULL) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->outline.gc); } rectOvalPtr->outline.gc = newGC; @@ -500,7 +500,7 @@ ConfigureRectOval( } if (color == NULL) { - newGC = None; + newGC = NULL; } else { gcValues.foreground = color->pixel; if (stipple != None) { @@ -515,14 +515,13 @@ ConfigureRectOval( * Mac OS X CG drawing needs access to the outline linewidth even for * fills (as linewidth controls antialiasing). */ - - gcValues.line_width = rectOvalPtr->outline.gc != None ? + gcValues.line_width = rectOvalPtr->outline.gc != NULL ? rectOvalPtr->outline.gc->line_width : 0; mask |= GCLineWidth; #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (rectOvalPtr->fillGC != None) { + if (rectOvalPtr->fillGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->fillGC); } rectOvalPtr->fillGC = newGC; @@ -595,7 +594,7 @@ DeleteRectOval( if (rectOvalPtr->disabledFillStipple != None) { Tk_FreeBitmap(display, rectOvalPtr->disabledFillStipple); } - if (rectOvalPtr->fillGC != None) { + if (rectOvalPtr->fillGC != NULL) { Tk_FreeGC(display, rectOvalPtr->fillGC); } } @@ -664,7 +663,7 @@ ComputeRectOvalBbox( rectOvalPtr->bbox[0] = tmpX; } - if (rectOvalPtr->outline.gc == None) { + if (rectOvalPtr->outline.gc == NULL) { /* * The Win32 switch was added for 8.3 to solve a problem with ovals * leaving traces on bottom and right of 1 pixel. This may not be the @@ -878,7 +877,7 @@ DisplayRectOval( } } - if (rectOvalPtr->fillGC != None) { + if (rectOvalPtr->fillGC != NULL) { if (fillStipple != None) { Tk_TSOffset *tsoffset; int w = 0, h = 0; @@ -922,7 +921,7 @@ DisplayRectOval( } } - if (rectOvalPtr->outline.gc != None) { + if (rectOvalPtr->outline.gc != NULL) { Tk_ChangeOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline)); if (rectOvalPtr->header.typePtr == &tkRectangleType) { XDrawRectangle(display, drawable, rectOvalPtr->outline.gc, @@ -993,7 +992,7 @@ RectToPoint( y1 = rectPtr->bbox[1]; x2 = rectPtr->bbox[2]; y2 = rectPtr->bbox[3]; - if (rectPtr->outline.gc != None) { + if (rectPtr->outline.gc != NULL) { inc = width/2.0; x1 -= inc; y1 -= inc; @@ -1009,7 +1008,7 @@ RectToPoint( if ((pointPtr[0] >= x1) && (pointPtr[0] < x2) && (pointPtr[1] >= y1) && (pointPtr[1] < y2)) { - if ((rectPtr->fillGC != None) || (rectPtr->outline.gc == None)) { + if ((rectPtr->fillGC != NULL) || (rectPtr->outline.gc == NULL)) { return 0.0; } xDiff = pointPtr[0] - x1; @@ -1105,8 +1104,8 @@ OvalToPoint( } - filled = ovalPtr->fillGC != None; - if (ovalPtr->outline.gc == None) { + filled = ovalPtr->fillGC != NULL; + if (ovalPtr->outline.gc == NULL) { width = 0.0; filled = 1; } @@ -1161,7 +1160,7 @@ RectToArea( } halfWidth = width/2.0; - if (rectPtr->outline.gc == None) { + if (rectPtr->outline.gc == NULL) { halfWidth = 0.0; } @@ -1171,7 +1170,7 @@ RectToArea( || (areaPtr[1] >= (rectPtr->bbox[3] + halfWidth))) { return -1; } - if ((rectPtr->fillGC == None) && (rectPtr->outline.gc != None) + if ((rectPtr->fillGC == NULL) && (rectPtr->outline.gc != NULL) && (areaPtr[0] >= (rectPtr->bbox[0] + halfWidth)) && (areaPtr[1] >= (rectPtr->bbox[1] + halfWidth)) && (areaPtr[2] <= (rectPtr->bbox[2] - halfWidth)) @@ -1239,7 +1238,7 @@ OvalToArea( */ halfWidth = width/2.0; - if (ovalPtr->outline.gc == None) { + if (ovalPtr->outline.gc == NULL) { halfWidth = 0.0; } oval[0] = ovalPtr->bbox[0] - halfWidth; @@ -1256,8 +1255,8 @@ OvalToArea( * return "outside". */ - if ((result == 0) && (ovalPtr->outline.gc != None) - && (ovalPtr->fillGC == None)) { + if ((result == 0) && (ovalPtr->outline.gc != NULL) + && (ovalPtr->fillGC == NULL)) { double centerX, centerY, height; double xDelta1, yDelta1, xDelta2, yDelta2; diff --git a/generic/tkScale.c b/generic/tkScale.c index ab8c125..6862ea9 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -270,11 +270,11 @@ Tk_ScaleObjCmd( scalePtr->activeBorder = NULL; scalePtr->sliderRelief = TK_RELIEF_RAISED; scalePtr->troughColorPtr = NULL; - scalePtr->troughGC = None; - scalePtr->copyGC = None; + scalePtr->troughGC = NULL; + scalePtr->copyGC = NULL; scalePtr->tkfont = NULL; scalePtr->textColorPtr = NULL; - scalePtr->textGC = None; + scalePtr->textGC = NULL; scalePtr->relief = TK_RELIEF_FLAT; scalePtr->highlightWidth = 0; scalePtr->highlightBorder = NULL; @@ -291,7 +291,7 @@ Tk_ScaleObjCmd( scalePtr->vertTroughX = 0; scalePtr->vertLabelX = 0; scalePtr->fontHeight = 0; - scalePtr->cursor = None; + scalePtr->cursor = NULL; scalePtr->takeFocusPtr = NULL; scalePtr->flags = NEVER_SET; @@ -518,13 +518,13 @@ DestroyScale( NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, scalePtr); } - if (scalePtr->troughGC != None) { + if (scalePtr->troughGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); } - if (scalePtr->copyGC != None) { + if (scalePtr->copyGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->copyGC); } - if (scalePtr->textGC != None) { + if (scalePtr->textGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } Tk_FreeConfigOptions((char *) scalePtr, scalePtr->optionTable, @@ -729,7 +729,7 @@ ScaleWorldChanged( gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); - if (scalePtr->troughGC != None) { + if (scalePtr->troughGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); } scalePtr->troughGC = gc; @@ -737,12 +737,12 @@ ScaleWorldChanged( gcValues.font = Tk_FontId(scalePtr->tkfont); gcValues.foreground = scalePtr->textColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground | GCFont, &gcValues); - if (scalePtr->textGC != None) { + if (scalePtr->textGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } scalePtr->textGC = gc; - if (scalePtr->copyGC == None) { + if (scalePtr->copyGC == NULL) { gcValues.graphics_exposures = False; scalePtr->copyGC = Tk_GetGC(scalePtr->tkwin, GCGraphicsExposures, &gcValues); diff --git a/generic/tkScale.h b/generic/tkScale.h index d0be190..e7e0dde 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -151,7 +151,7 @@ typedef struct TkScale { */ int fontHeight; /* Height of scale font. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. May be NULL. */ diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 4898b37..f88b37b 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -187,7 +187,7 @@ Tk_ScrollbarObjCmd( #endif /* TK_NO_DEPRECATED */ scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; - scrollPtr->cursor = None; + scrollPtr->cursor = NULL; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index 99f16a4..f7c39c8 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.h @@ -123,7 +123,7 @@ typedef struct TkScrollbar { * Miscellaneous information: */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 10d481b..8421988 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -169,7 +169,7 @@ SquareObjCmd( squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr, SquareDeletedProc); - squarePtr->gc = None; + squarePtr->gc = NULL; squarePtr->optionTable = optionTable; if (Tk_InitOptions(interp, squarePtr, optionTable, tkwin) @@ -335,7 +335,7 @@ SquareConfigure( Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); - if ((squarePtr->gc == None) && (doubleBuffer)) { + if ((squarePtr->gc == NULL) && doubleBuffer) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; @@ -400,7 +400,7 @@ SquareObjEventProc( if (squarePtr->tkwin != NULL) { Tk_FreeConfigOptions((char *) squarePtr, squarePtr->optionTable, squarePtr->tkwin); - if (squarePtr->gc != None) { + if (squarePtr->gc != NULL) { Tk_FreeGC(squarePtr->display, squarePtr->gc); } squarePtr->tkwin = NULL; diff --git a/generic/tkText.c b/generic/tkText.c index fb230cd..3710b31 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -406,7 +406,6 @@ static Tcl_Obj * TextGetText(const TkText *textPtr, static void GenerateModifiedEvent(TkText *textPtr); static void GenerateUndoStackEvent(TkText *textPtr); static void UpdateDirtyFlag(TkSharedText *sharedPtr); -static void RunAfterSyncCmd(ClientData clientData); static void TextPushUndoAction(TkText *textPtr, Tcl_Obj *undoString, int insert, const TkTextIndex *index1Ptr, @@ -587,7 +586,7 @@ CreateWidget( textPtr->state = TK_TEXT_STATE_NORMAL; textPtr->relief = TK_RELIEF_FLAT; - textPtr->cursor = None; + textPtr->cursor = NULL; textPtr->charWidth = 1; textPtr->charHeight = 10; textPtr->wrapMode = TEXT_WRAPMODE_CHAR; @@ -1544,7 +1543,7 @@ TextWidgetObjCmd( textPtr->afterSyncCmd = cmd; } else { textPtr->afterSyncCmd = cmd; - Tcl_DoWhenIdle(RunAfterSyncCmd, (ClientData) textPtr); + Tcl_DoWhenIdle(TkTextRunAfterSyncCmd, (ClientData) textPtr); } break; } else if (objc != 2) { @@ -1556,7 +1555,7 @@ TextWidgetObjCmd( Tcl_DecrRefCount(textPtr->afterSyncCmd); } textPtr->afterSyncCmd = NULL; - TkTextUpdateLineMetrics(textPtr, 1, + TkTextUpdateLineMetrics(textPtr, 0, TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr), -1); break; } @@ -2275,7 +2274,7 @@ ConfigureText( textPtr->selTagPtr->affectsDisplay = 0; textPtr->selTagPtr->affectsDisplayGeometry = 0; if ((textPtr->selTagPtr->elideString != NULL) - || (textPtr->selTagPtr->tkfont != None) + || (textPtr->selTagPtr->tkfont != NULL) || (textPtr->selTagPtr->justifyString != NULL) || (textPtr->selTagPtr->lMargin1String != NULL) || (textPtr->selTagPtr->lMargin2String != NULL) @@ -5587,7 +5586,7 @@ UpdateDirtyFlag( /* *---------------------------------------------------------------------- * - * RunAfterSyncCmd -- + * TkTextRunAfterSyncCmd -- * * This function is called by the event loop and executes the command * scheduled by [.text sync -command $cmd]. @@ -5601,8 +5600,8 @@ UpdateDirtyFlag( *---------------------------------------------------------------------- */ -static void -RunAfterSyncCmd( +void +TkTextRunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { register TkText *textPtr = clientData; diff --git a/generic/tkText.h b/generic/tkText.h index 5e84fd5..8fb4134 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -677,7 +677,7 @@ typedef struct TkText { /* Color for drawing traversal highlight area * when highlight is off. */ XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ XColor *fgColor; /* Default foreground color for text. */ Tk_Font tkfont; /* Default font for displaying text. */ int charWidth; /* Width of average character in default @@ -1080,7 +1080,7 @@ MODULE_SCOPE int TkTextGetObjIndex(Tcl_Interp *interp, TkText *textPtr, MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp, TkSharedText *sharedTextPtr, Tcl_Obj *idxPtr, TkTextIndex *indexPtr); -MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp, +MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *objPtr); MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *stringPtr); @@ -1169,7 +1169,7 @@ MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); - +MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData); #endif /* _TKTEXT */ /* diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 64d455f..cb22646 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -491,13 +491,15 @@ static TkTextDispChunk *baseCharChunkPtr = NULL; * different character might be under the mouse * cursor now). Need to recompute the current * character before the next redisplay. + * OUT_OF_SYNC 1 means that the last <<WidgetViewSync>> event had + * value 0, indicating that the widget is out of sync. */ #define DINFO_OUT_OF_DATE 1 #define REDRAW_PENDING 2 #define REDRAW_BORDERS 4 #define REPICK_NEEDED 8 - +#define OUT_OF_SYNC 16 /* * Action values for FreeDLines: * @@ -658,7 +660,7 @@ TkTextCreateDInfo( dInfoPtr = ckalloc(sizeof(TextDInfo)); Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int)); dInfoPtr->dLinePtr = NULL; - dInfoPtr->copyGC = None; + dInfoPtr->copyGC = NULL; gcValues.graphics_exposures = True; dInfoPtr->scrollGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); @@ -675,7 +677,7 @@ TkTextCreateDInfo( dInfoPtr->scanTotalYScroll = 0; dInfoPtr->scanMarkY = 0; dInfoPtr->dLinesInvalidated = 0; - dInfoPtr->flags = DINFO_OUT_OF_DATE; + dInfoPtr->flags = 0; dInfoPtr->topPixelOffset = 0; dInfoPtr->newTopPixelOffset = 0; dInfoPtr->currentMetricUpdateLine = -1; @@ -722,7 +724,7 @@ TkTextFreeDInfo( FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK); Tcl_DeleteHashTable(&dInfoPtr->styleTable); - if (dInfoPtr->copyGC != None) { + if (dInfoPtr->copyGC != NULL) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC); @@ -854,7 +856,7 @@ GetStyle( border = tagPtr->selBorder; } - if ((tagPtr->selFgColor != None) && (isSelected)) { + if ((tagPtr->selFgColor != NULL) && isSelected) { fgColor = tagPtr->selFgColor; } @@ -881,11 +883,11 @@ GetStyle( styleValues.bgStipple = tagPtr->bgStipple; bgStipplePrio = tagPtr->priority; } - if ((fgColor != None) && (tagPtr->priority > fgPrio)) { + if ((fgColor != NULL) && (tagPtr->priority > fgPrio)) { styleValues.fgColor = fgColor; fgPrio = tagPtr->priority; } - if ((tagPtr->tkfont != None) && (tagPtr->priority > fontPrio)) { + if ((tagPtr->tkfont != NULL) && (tagPtr->priority > fontPrio)) { styleValues.tkfont = tagPtr->tkfont; fontPrio = tagPtr->priority; } @@ -923,9 +925,9 @@ GetStyle( && (tagPtr->priority > overstrikePrio)) { styleValues.overstrike = tagPtr->overstrike; overstrikePrio = tagPtr->priority; - if (tagPtr->overstrikeColor != None) { + if (tagPtr->overstrikeColor != NULL) { styleValues.overstrikeColor = tagPtr->overstrikeColor; - } else if (fgColor != None) { + } else if (fgColor != NULL) { styleValues.overstrikeColor = fgColor; } } @@ -968,9 +970,9 @@ GetStyle( && (tagPtr->priority > underlinePrio)) { styleValues.underline = tagPtr->underline; underlinePrio = tagPtr->priority; - if (tagPtr->underlineColor != None) { + if (tagPtr->underlineColor != NULL) { styleValues.underlineColor = tagPtr->underlineColor; - } else if (fgColor != None) { + } else if (fgColor != NULL) { styleValues.underlineColor = fgColor; } } @@ -1017,7 +1019,7 @@ GetStyle( } stylePtr->bgGC = Tk_GetGC(textPtr->tkwin, mask, &gcValues); } else { - stylePtr->bgGC = None; + stylePtr->bgGC = NULL; } mask = GCFont; gcValues.font = Tk_FontId(styleValues.tkfont); @@ -1067,16 +1069,16 @@ FreeStyle( /* Information about style to free. */ { if (stylePtr->refCount-- <= 1) { - if (stylePtr->bgGC != None) { + if (stylePtr->bgGC != NULL) { Tk_FreeGC(textPtr->display, stylePtr->bgGC); } - if (stylePtr->fgGC != None) { + if (stylePtr->fgGC != NULL) { Tk_FreeGC(textPtr->display, stylePtr->fgGC); } - if (stylePtr->ulGC != None) { + if (stylePtr->ulGC != NULL) { Tk_FreeGC(textPtr->display, stylePtr->ulGC); } - if (stylePtr->ovGC != None) { + if (stylePtr->ovGC != NULL) { Tk_FreeGC(textPtr->display, stylePtr->ovGC); } Tcl_DeleteHashEntry(stylePtr->hPtr); @@ -2681,7 +2683,7 @@ DisplayLineBackground( if ((chunkPtr->nextPtr == NULL) && (rightX < maxX)) { rightX = maxX; } - if (chunkPtr->stylePtr->bgGC != None) { + if (chunkPtr->stylePtr->bgGC != NULL) { /* * Not visible - bail out now. */ @@ -3063,10 +3065,13 @@ AsyncUpdateLineMetrics( * We have looped over all lines, so we're done. We must release our * refCount on the widget (the timer token was already set to NULL * above). If there is a registered aftersync command, run that first. + * Cancel any pending idle task which would try to run the command + * after the afterSyncCmd pointer had been set to NULL. */ if (textPtr->afterSyncCmd) { int code; + Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr); Tcl_Preserve((ClientData) textPtr->interp); code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL); @@ -3084,7 +3089,6 @@ AsyncUpdateLineMetrics( * with its internal data (actually it will be after the next trip * through the event loop, because the widget redraws at idle-time). */ - GenerateWidgetViewSyncEvent(textPtr, 1); if (textPtr->refCount-- <= 1) { @@ -3108,8 +3112,14 @@ AsyncUpdateLineMetrics( * GenerateWidgetViewSyncEvent -- * * Send the <<WidgetViewSync>> event related to the text widget - * line metrics asynchronous update. - * This is equivalent to: + * line metrics asynchronous update. These events should only + * be sent when the sync status has changed. So this function + * compares the requested state with the state saved in the + * TkText structure, and only generates the event if they are + * different. This means that it is safe to call this function + * at any time when the state is known. + * + * If an event is sent, the effect is equivalent to: * event generate $textWidget <<WidgetViewSync>> -data $s * where $s is the sync status: true (when the widget view is in * sync with its internal data) or false (when it is not). @@ -3125,9 +3135,12 @@ AsyncUpdateLineMetrics( static void GenerateWidgetViewSyncEvent( - TkText *textPtr, /* Information about text widget. */ - Bool InSync) /* true if in sync, false otherwise */ + TkText *textPtr, /* Information about text widget. */ + Bool InSync) /* true if becoming in sync, false otherwise */ { + Bool NewSyncState = (InSync != 0); /* ensure 0 or 1 value */ + Bool OldSyncState = !(textPtr->dInfoPtr->flags & OUT_OF_SYNC); + /* * OSX 10.14 needs to be told to display the window when the Text Widget * is in sync. (That is, to run DisplayText inside of the drawRect @@ -3140,8 +3153,15 @@ GenerateWidgetViewSyncEvent( FORCE_DISPLAY(textPtr->tkwin); } - TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync", - Tcl_NewBooleanObj(InSync)); + if (NewSyncState != OldSyncState) { + if (NewSyncState) { + textPtr->dInfoPtr->flags &= ~OUT_OF_SYNC; + } else { + textPtr->dInfoPtr->flags |= OUT_OF_SYNC; + } + TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync", + Tcl_NewBooleanObj(NewSyncState)); + } } /* @@ -3184,6 +3204,9 @@ TkTextUpdateLineMetrics( TkTextLine *linePtr = NULL; int count = 0; int totalLines = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr); + int fullUpdateRequested = (lineNum == 0 && + endLine == totalLines && + doThisMuch == -1); if (totalLines == 0) { /* @@ -3194,6 +3217,7 @@ TkTextUpdateLineMetrics( } while (1) { + /* * Get a suitable line. */ @@ -3220,6 +3244,8 @@ TkTextUpdateLineMetrics( */ if (textPtr->dInfoPtr->metricEpoch == TCL_AUTO_LENGTH && lineNum == endLine) { + + /* * We have looped over all lines, so we're done. */ @@ -3243,10 +3269,12 @@ TkTextUpdateLineMetrics( if (TkBTreeLinePixelEpoch(textPtr, linePtr) == textPtr->dInfoPtr->lineMetricUpdateEpoch) { + /* * This line is already up to date. That means there's nothing * to do here. */ + } else if (doThisMuch == -1) { count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,NULL,0); } else { @@ -3268,6 +3296,7 @@ TkTextUpdateLineMetrics( indexPtr = &textPtr->dInfoPtr->metricIndex; pixelHeight = textPtr->dInfoPtr->metricPixelHeight; } else { + /* * We must reset the partial line height calculation data * here, so we don't use it when it is out of date. @@ -3291,6 +3320,7 @@ TkTextUpdateLineMetrics( pixelHeight, indexPtr, 1); if (indexPtr->linePtr == linePtr) { + /* * We didn't complete the logical line, because it * produced very many display lines, which must be because @@ -3299,6 +3329,7 @@ TkTextUpdateLineMetrics( */ if (pixelHeight == 0) { + /* * These have already been stored, unless we just * started the new line. @@ -3320,6 +3351,7 @@ TkTextUpdateLineMetrics( textPtr->dInfoPtr->metricEpoch = -1; } } else { + /* * We must never recalculate the height of the last artificial * line. It must stay at zero, and if we recalculate it, it will @@ -3344,13 +3376,17 @@ TkTextUpdateLineMetrics( } } if (doThisMuch == -1) { + /* - * If we were requested to provide a full update, then also update the - * scrollbar. + * If we were requested to update the entire range, then also update + * the scrollbar. */ GetYView(textPtr->interp, textPtr, 1); } + if (fullUpdateRequested) { + GenerateWidgetViewSyncEvent(textPtr, 1); + } return lineNum; } @@ -3519,8 +3555,12 @@ TextInvalidateLineMetrics( textPtr->refCount++; dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1, AsyncUpdateLineMetrics, textPtr); - GenerateWidgetViewSyncEvent(textPtr, 0); } + + /* + * The widget is out of sync: send a <<WidgetViewSync>> event. + */ + GenerateWidgetViewSyncEvent(textPtr, 0); } /* @@ -4537,7 +4577,7 @@ DisplayText( dlPtr->spaceAbove, dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, NULL, - (Drawable) None, dlPtr->y + dlPtr->spaceAbove); + None, dlPtr->y + dlPtr->spaceAbove); } } } @@ -5173,7 +5213,7 @@ TkTextRelayoutWindow( gcValues.graphics_exposures = False; newGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); - if (dInfoPtr->copyGC != None) { + if (dInfoPtr->copyGC != NULL) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } dInfoPtr->copyGC = newGC; @@ -5262,9 +5302,7 @@ TkTextRelayoutWindow( inSync = 0; } - if (!inSync) { - GenerateWidgetViewSyncEvent(textPtr, 0); - } + GenerateWidgetViewSyncEvent(textPtr, inSync); } } @@ -6289,11 +6327,7 @@ TkTextPendingsync( { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - return ( - (!(dInfoPtr->flags & REDRAW_PENDING) && - (dInfoPtr->metricEpoch == TCL_AUTO_LENGTH) && - (dInfoPtr->lastMetricUpdateLine == dInfoPtr->currentMetricUpdateLine)) ? - 0 : 1); + return ((dInfoPtr->flags & OUT_OF_SYNC) != 0); } /* @@ -7987,7 +8021,7 @@ CharDisplayProc( */ if (!sValuePtr->elide && (numBytes > offsetBytes) - && (stylePtr->fgGC != None)) { + && (stylePtr->fgGC != NULL)) { #if TK_DRAW_IN_CONTEXT int start = ciPtr->baseOffset + offsetBytes; int len = ciPtr->numBytes - offsetBytes; diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index d04c71d..25e6af1 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -516,7 +516,7 @@ TkTextTagCmd( tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; if ((tagPtr->elideString != NULL) - || (tagPtr->tkfont != None) + || (tagPtr->tkfont != NULL) || (tagPtr->justifyString != NULL) || (tagPtr->lMargin1String != NULL) || (tagPtr->lMargin2String != NULL) diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 23c0891..3d91927 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -2089,7 +2089,7 @@ void Tk_UndefineCursor( Tk_Window tkwin) /* Window to manipulate. */ { - Tk_DefineCursor(tkwin, None); + Tk_DefineCursor(tkwin, NULL); } void diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 62bf4eb..b22e5d5 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -6,8 +6,6 @@ */ #include "tkInt.h" -#include <X11/Xlib.h> -#include <X11/Xutil.h> #include "ttkTheme.h" #define DEFAULT_BORDERWIDTH "2" diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 9fbcd02..002448b 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -5,8 +5,6 @@ */ #include "tkInt.h" -#include <X11/Xlib.h> -#include <X11/Xutil.h> #include "ttkTheme.h" #if defined(_WIN32) diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 66b3418..b46b2fb 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -9,8 +9,6 @@ */ #include "tkInt.h" -#include <X11/Xatom.h> - #include "ttkTheme.h" #include "ttkWidget.h" @@ -357,7 +355,7 @@ EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { Entry *entryPtr = clientData; - size_t byteCount; + int byteCount; const char *string; const char *selStart, *selEnd; @@ -371,7 +369,7 @@ EntryFetchSelection( selEnd = Tcl_UtfAtIndex(selStart, entryPtr->entry.selectLast - entryPtr->entry.selectFirst); byteCount = selEnd - selStart - offset; - if (byteCount > (size_t)maxBytes) { + if (byteCount > maxBytes) { /* @@@POSSIBLE BUG: Can transfer partial UTF-8 sequences. Is this OK? */ byteCount = maxBytes; } @@ -1179,7 +1177,7 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip) mask |= GCForeground; } gc = Tk_GetGC(entryPtr->core.tkwin, mask, &gcValues); - if (clip != None) { + if (clip != NULL) { TkSetRegion(Tk_Display(entryPtr->core.tkwin), gc, clip); } return gc; @@ -1290,7 +1288,7 @@ static void EntryDisplay(void *clientData, Drawable d) cursorX = field.x + field.width - cursorWidth; } - gc = EntryGetGC(entryPtr, es.insertColorObj, None); + gc = EntryGetGC(entryPtr, es.insertColorObj, NULL); XFillRectangle(Tk_Display(tkwin), d, gc, cursorX, cursorY, cursorWidth, cursorHeight); Tk_FreeGC(Tk_Display(tkwin), gc); @@ -1336,7 +1334,7 @@ static void EntryDisplay(void *clientData, Drawable d) * it from the Xft guts (if they're being used). */ #ifdef HAVE_XFT - TkUnixSetXftClipRegion(None); + TkUnixSetXftClipRegion(NULL); #endif TkDestroyRegion(clipRegion); } diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index de530e9..2367f99 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -182,7 +182,7 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) if (clipRegion != NULL) { #ifdef HAVE_XFT - TkUnixSetXftClipRegion(None); + TkUnixSetXftClipRegion(NULL); #endif XSetClipMask(Tk_Display(tkwin), gc1, None); XSetClipMask(Tk_Display(tkwin), gc2, None); diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 7ac6740..9e5cf4b 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -129,7 +129,7 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr) unsigned int mask = onbits | offbits; Tcl_DString result; int i; - size_t len; + int len; Tcl_DStringInit(&result); @@ -145,14 +145,14 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr) len = Tcl_DStringLength(&result); if (len) { /* 'len' includes extra trailing ' ' */ - objPtr->bytes = Tcl_Alloc(len); + objPtr->bytes = ckalloc(len); objPtr->length = len-1; strncpy(objPtr->bytes, Tcl_DStringValue(&result), len-1); objPtr->bytes[len-1] = '\0'; } else { /* empty string */ objPtr->length = 0; - objPtr->bytes = Tcl_Alloc(1); + objPtr->bytes = ckalloc(1); *objPtr->bytes = '\0'; } |