diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-12-20 08:02:30 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-12-20 08:02:30 (GMT) |
commit | 81b0bd7641a9d2f63154c97d41c27bbb696ef674 (patch) | |
tree | a17119411589e8c1291df53e2546243d84e78583 | |
parent | 93d974c265533cf2445446954346be8192e850a0 (diff) | |
download | tk-81b0bd7641a9d2f63154c97d41c27bbb696ef674.zip tk-81b0bd7641a9d2f63154c97d41c27bbb696ef674.tar.gz tk-81b0bd7641a9d2f63154c97d41c27bbb696ef674.tar.bz2 |
Fix [9e31fd944934e269121fa78ff56b7b86f33e6db6|9e31fd9449]: X11/X.h and Windows.h have conflicting symbols.
Also fix a few newer (harmless) gcc warnings.
70 files changed, 847 insertions, 844 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index caa40dd..a97bed3 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -236,10 +236,10 @@ Tk_Get3DBorder( borderPtr->bgColorPtr = bgColorPtr; borderPtr->darkColorPtr = NULL; borderPtr->lightColorPtr = NULL; - borderPtr->shadow = None; - borderPtr->bgGC = None; - borderPtr->darkGC = None; - borderPtr->lightGC = None; + borderPtr->shadow = 0; + borderPtr->bgGC = 0; + borderPtr->darkGC = 0; + borderPtr->lightGC = 0; borderPtr->hashPtr = hashPtr; borderPtr->nextPtr = existingBorderPtr; Tcl_SetHashValue(hashPtr, borderPtr); @@ -375,7 +375,7 @@ Tk_3DBorderGC( { TkBorder * borderPtr = (TkBorder *) border; - if ((borderPtr->lightGC == None) && (which != TK_3D_FLAT_GC)) { + if (!borderPtr->lightGC && (which != TK_3D_FLAT_GC)) { TkpGetShadows(borderPtr, tkwin); } if (which == TK_3D_FLAT_GC) { @@ -392,7 +392,7 @@ Tk_3DBorderGC( * compilers happy. */ - return (GC) None; + return 0; } /* @@ -428,29 +428,29 @@ Tk_Free3DBorder( prevPtr = (TkBorder *) Tcl_GetHashValue(borderPtr->hashPtr); TkpFreeBorder(borderPtr); - if (borderPtr->bgColorPtr != NULL) { + if (borderPtr->bgColorPtr) { Tk_FreeColor(borderPtr->bgColorPtr); } - if (borderPtr->darkColorPtr != NULL) { + if (borderPtr->darkColorPtr) { Tk_FreeColor(borderPtr->darkColorPtr); } - if (borderPtr->lightColorPtr != NULL) { + if (borderPtr->lightColorPtr) { Tk_FreeColor(borderPtr->lightColorPtr); } - if (borderPtr->shadow != None) { + if (borderPtr->shadow) { Tk_FreeBitmap(display, borderPtr->shadow); } - if (borderPtr->bgGC != None) { + if (borderPtr->bgGC) { Tk_FreeGC(display, borderPtr->bgGC); } - if (borderPtr->darkGC != None) { + if (borderPtr->darkGC) { Tk_FreeGC(display, borderPtr->darkGC); } - if (borderPtr->lightGC != None) { + if (borderPtr->lightGC) { Tk_FreeGC(display, borderPtr->lightGC); } if (prevPtr == borderPtr) { - if (borderPtr->nextPtr == NULL) { + if (!borderPtr->nextPtr) { Tcl_DeleteHashEntry(borderPtr->hashPtr); } else { Tcl_SetHashValue(borderPtr->hashPtr, borderPtr->nextPtr); @@ -759,7 +759,7 @@ Tk_Draw3DPolygon( int i, lightOnLeft, dx, dy, parallel, pointsSeen; Display *display = Tk_Display(tkwin); - if (borderPtr->lightGC == None) { + if (!borderPtr->lightGC) { TkpGetShadows(borderPtr, tkwin); } diff --git a/generic/tkBind.c b/generic/tkBind.c index c4f8226..476aed0 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -631,7 +631,7 @@ static const TkStateMap visNotify[] = { }; static const TkStateMap configureRequestDetail[] = { - {None, "None"}, + {0, "None"}, {Above, "Above"}, {Below, "Below"}, {BottomIf, "BottomIf"}, @@ -3870,7 +3870,7 @@ DoWarp( { TkDisplay *dispPtr = (TkDisplay *) clientData; - XWarpPointer(dispPtr->display, (Window) None, (Window) dispPtr->warpWindow, + XWarpPointer(dispPtr->display, 0, (Window) dispPtr->warpWindow, 0, 0, 0, 0, (int) dispPtr->warpX, (int) dispPtr->warpY); XForceScreenSaver(dispPtr->display, ScreenSaverReset); dispPtr->flags &= ~TK_DISPLAY_IN_WARP; diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index f7df546..73ab9fd 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -218,7 +218,7 @@ Tk_AllocBitmapFromObj( bitmapPtr = GetBitmap(interp, tkwin, Tcl_GetString(objPtr)); objPtr->internalRep.twoPtrValue.ptr1 = (void *) bitmapPtr; if (bitmapPtr == NULL) { - return None; + return 0; } bitmapPtr->objRefCount++; return bitmapPtr->bitmap; @@ -260,7 +260,7 @@ Tk_GetBitmap( TkBitmap *bitmapPtr = GetBitmap(interp, tkwin, string); if (bitmapPtr == NULL) { - return None; + return 0; } return bitmapPtr->bitmap; } @@ -381,7 +381,7 @@ GetBitmap( bitmap = TkpGetNativeAppBitmap(Tk_Display(tkwin), string, &width, &height); - if (bitmap == None) { + if (!bitmap) { if (interp != NULL) { Tcl_AppendResult(interp, "bitmap \"", string, "\" not defined", NULL); @@ -395,7 +395,7 @@ GetBitmap( if (predefPtr->native) { bitmap = TkpCreateNativeBitmap(Tk_Display(tkwin), predefPtr->source); - if (bitmap == None) { + if (!bitmap) { Tcl_Panic("native bitmap creation failed"); } } else { diff --git a/generic/tkButton.c b/generic/tkButton.c index 70bba83..1967ab2 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -688,7 +688,7 @@ ButtonCreate( butPtr->textPtr = NULL; butPtr->underline = -1; butPtr->textVarNamePtr = NULL; - butPtr->bitmap = None; + butPtr->bitmap = 0; butPtr->imagePtr = NULL; butPtr->image = NULL; butPtr->selectImagePtr = NULL; @@ -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->gray = None; - butPtr->copyGC = None; + butPtr->normalTextGC = 0; + butPtr->activeTextGC = 0; + butPtr->disabledGC = 0; + butPtr->stippleGC = 0; + butPtr->gray = 0; + butPtr->copyGC = 0; 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 = 0; butPtr->takeFocusPtr = NULL; butPtr->commandPtr = NULL; butPtr->flags = 0; @@ -969,37 +969,37 @@ DestroyButton( TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, (ClientData) butPtr); } - if (butPtr->image != NULL) { + if (butPtr->image) { Tk_FreeImage(butPtr->image); } - if (butPtr->selectImage != NULL) { + if (butPtr->selectImage) { Tk_FreeImage(butPtr->selectImage); } - if (butPtr->tristateImage != NULL) { + if (butPtr->tristateImage) { Tk_FreeImage(butPtr->tristateImage); } - if (butPtr->normalTextGC != None) { + if (butPtr->normalTextGC) { Tk_FreeGC(butPtr->display, butPtr->normalTextGC); } - if (butPtr->activeTextGC != None) { + if (butPtr->activeTextGC) { Tk_FreeGC(butPtr->display, butPtr->activeTextGC); } - if (butPtr->disabledGC != None) { + if (butPtr->disabledGC) { Tk_FreeGC(butPtr->display, butPtr->disabledGC); } - if (butPtr->stippleGC != None) { + if (butPtr->stippleGC) { Tk_FreeGC(butPtr->display, butPtr->stippleGC); } - if (butPtr->gray != None) { + if (butPtr->gray) { Tk_FreeBitmap(butPtr->display, butPtr->gray); } - if (butPtr->copyGC != None) { + if (butPtr->copyGC) { Tk_FreeGC(butPtr->display, butPtr->copyGC); } - if (butPtr->textLayout != NULL) { + if (butPtr->textLayout) { Tk_FreeTextLayout(butPtr->textLayout); } - if (butPtr->selVarNamePtr != NULL) { + if (butPtr->selVarNamePtr) { Tcl_UntraceVar(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, (ClientData) butPtr); @@ -1184,7 +1184,7 @@ ConfigureButton( * don't go to zero and cause image data to be discarded. */ - if (butPtr->imagePtr != NULL) { + if (butPtr->imagePtr) { image = Tk_GetImage(butPtr->interp, butPtr->tkwin, Tcl_GetString(butPtr->imagePtr), ButtonImageProc, (ClientData) butPtr); @@ -1198,7 +1198,7 @@ ConfigureButton( Tk_FreeImage(butPtr->image); } butPtr->image = image; - if (butPtr->selectImagePtr != NULL) { + if (butPtr->selectImagePtr) { image = Tk_GetImage(butPtr->interp, butPtr->tkwin, Tcl_GetString(butPtr->selectImagePtr), ButtonSelectImageProc, (ClientData) butPtr); @@ -1208,7 +1208,7 @@ ConfigureButton( } else { image = NULL; } - if (butPtr->selectImage != NULL) { + if (butPtr->selectImage) { Tk_FreeImage(butPtr->selectImage); } butPtr->selectImage = image; @@ -1228,7 +1228,7 @@ ConfigureButton( butPtr->tristateImage = image; haveImage = 0; - if (butPtr->imagePtr != NULL || butPtr->bitmap != None) { + if (butPtr->imagePtr || butPtr->bitmap) { haveImage = 1; } if ((!haveImage || butPtr->compound != COMPOUND_NONE) @@ -1243,14 +1243,14 @@ ConfigureButton( namePtr = butPtr->textVarNamePtr; valuePtr = Tcl_ObjGetVar2(interp, namePtr, NULL, TCL_GLOBAL_ONLY); - if (valuePtr == NULL) { + if (!valuePtr) { if (Tcl_ObjSetVar2(interp, namePtr, NULL, butPtr->textPtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) { continue; } } else { - if (butPtr->textPtr != NULL) { + if (butPtr->textPtr) { Tcl_DecrRefCount(butPtr->textPtr); } butPtr->textPtr = valuePtr; @@ -1258,7 +1258,7 @@ ConfigureButton( } } - if ((butPtr->bitmap != None) || (butPtr->imagePtr != NULL)) { + if (butPtr->bitmap || butPtr->imagePtr) { /* * The button must display the contents of an image or bitmap. */ @@ -1366,17 +1366,17 @@ TkButtonWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->normalTextGC != None) { + if (butPtr->normalTextGC) { Tk_FreeGC(butPtr->display, butPtr->normalTextGC); } butPtr->normalTextGC = newGC; - if (butPtr->activeFg != NULL) { + if (butPtr->activeFg) { gcValues.foreground = butPtr->activeFg->pixel; 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) { Tk_FreeGC(butPtr->display, butPtr->activeTextGC); } butPtr->activeTextGC = newGC; @@ -1388,13 +1388,13 @@ TkButtonWorldChanged( * Create the GC that can be used for stippling */ - if (butPtr->stippleGC == None) { + if (!butPtr->stippleGC) { gcValues.foreground = gcValues.background; mask = GCForeground; - if (butPtr->gray == None) { + if (!butPtr->gray) { butPtr->gray = Tk_GetBitmap(NULL, butPtr->tkwin, "gray50"); } - if (butPtr->gray != None) { + if (butPtr->gray) { gcValues.fill_style = FillStippled; gcValues.stipple = butPtr->gray; mask |= GCFillStyle | GCStipple; @@ -1408,18 +1408,18 @@ TkButtonWorldChanged( */ mask = GCForeground | GCBackground | GCFont; - if (butPtr->disabledFg != NULL) { + if (butPtr->disabledFg) { gcValues.foreground = butPtr->disabledFg->pixel; } else { gcValues.foreground = gcValues.background; } newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->disabledGC != None) { + if (butPtr->disabledGC) { Tk_FreeGC(butPtr->display, butPtr->disabledGC); } butPtr->disabledGC = newGC; - if (butPtr->copyGC == None) { + if (!butPtr->copyGC) { butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues); } diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index ecd57b8..101f7aa 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -296,11 +296,11 @@ CreateArc( arcPtr->fillColor = NULL; arcPtr->activeFillColor = NULL; arcPtr->disabledFillColor = NULL; - arcPtr->fillStipple = None; - arcPtr->activeFillStipple = None; - arcPtr->disabledFillStipple = None; + arcPtr->fillStipple = 0; + arcPtr->activeFillStipple = 0; + arcPtr->disabledFillStipple = 0; arcPtr->style = PIESLICE_STYLE; - arcPtr->fillGC = None; + arcPtr->fillGC = 0; /* * Process the arguments to fill in the item record. @@ -452,11 +452,11 @@ ConfigureArc( */ if (arcPtr->outline.activeWidth > arcPtr->outline.width || - arcPtr->outline.activeDash.number != 0 || - arcPtr->outline.activeColor != NULL || - arcPtr->outline.activeStipple != None || - arcPtr->activeFillColor != NULL || - arcPtr->activeFillStipple != None) { + arcPtr->outline.activeDash.number || + arcPtr->outline.activeColor || + arcPtr->outline.activeStipple || + arcPtr->activeFillColor || + arcPtr->activeFillStipple) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -493,9 +493,9 @@ ConfigureArc( mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = None; + newGC = 0; } - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc); } arcPtr->outline.gc = newGC; @@ -511,25 +511,23 @@ ConfigureArc( color = arcPtr->fillColor; stipple = arcPtr->fillStipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (arcPtr->activeFillColor!=NULL) { + if (arcPtr->activeFillColor) { color = arcPtr->activeFillColor; } - if (arcPtr->activeFillStipple!=None) { + if (arcPtr->activeFillStipple) { stipple = arcPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { - if (arcPtr->disabledFillColor!=NULL) { + if (arcPtr->disabledFillColor) { color = arcPtr->disabledFillColor; } - if (arcPtr->disabledFillStipple!=None) { + if (arcPtr->disabledFillStipple) { stipple = arcPtr->disabledFillStipple; } } - if (arcPtr->style == ARC_STYLE) { - newGC = None; - } else if (color == NULL) { - newGC = None; + if ((arcPtr->style == ARC_STYLE) || !color) { + newGC = 0; } else { gcValues.foreground = color->pixel; if (arcPtr->style == CHORD_STYLE) { @@ -538,14 +536,14 @@ ConfigureArc( gcValues.arc_mode = ArcPieSlice; } mask = GCForeground|GCArcMode; - if (stipple != None) { + if (stipple) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (arcPtr->fillGC != None) { + if (arcPtr->fillGC) { Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC); } arcPtr->fillGC = newGC; @@ -600,25 +598,25 @@ DeleteArc( if (arcPtr->numOutlinePoints != 0) { ckfree((char *) arcPtr->outlinePtr); } - if (arcPtr->fillColor != NULL) { + if (arcPtr->fillColor) { Tk_FreeColor(arcPtr->fillColor); } - if (arcPtr->activeFillColor != NULL) { + if (arcPtr->activeFillColor) { Tk_FreeColor(arcPtr->activeFillColor); } - if (arcPtr->disabledFillColor != NULL) { + if (arcPtr->disabledFillColor) { Tk_FreeColor(arcPtr->disabledFillColor); } - if (arcPtr->fillStipple != None) { + if (arcPtr->fillStipple) { Tk_FreeBitmap(display, arcPtr->fillStipple); } - if (arcPtr->activeFillStipple != None) { + if (arcPtr->activeFillStipple) { Tk_FreeBitmap(display, arcPtr->activeFillStipple); } - if (arcPtr->disabledFillStipple != None) { + if (arcPtr->disabledFillStipple) { Tk_FreeBitmap(display, arcPtr->disabledFillStipple); } - if (arcPtr->fillGC != None) { + if (arcPtr->fillGC) { Tk_FreeGC(display, arcPtr->fillGC); } } @@ -749,7 +747,7 @@ ComputeArcBbox( * drawn) and add one extra pixel just for safety. */ - if (arcPtr->outline.gc == None) { + if (!arcPtr->outline.gc) { tmp = 1; } else { tmp = (int) ((width + 1.0)/2.0 + 1); @@ -806,20 +804,20 @@ DisplayArc( if (arcPtr->outline.activeWidth>lineWidth) { lineWidth = arcPtr->outline.activeWidth; } - if (arcPtr->outline.activeDash.number != 0) { + if (arcPtr->outline.activeDash.number) { dashnumber = arcPtr->outline.activeDash.number; } - if (arcPtr->activeFillStipple != None) { + if (arcPtr->activeFillStipple) { stipple = arcPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { if (arcPtr->outline.disabledWidth > 0) { lineWidth = arcPtr->outline.disabledWidth; } - if (arcPtr->outline.disabledDash.number != 0) { + if (arcPtr->outline.disabledDash.number) { dashnumber = arcPtr->outline.disabledDash.number; } - if (arcPtr->disabledFillStipple != None) { + if (arcPtr->disabledFillStipple) { stipple = arcPtr->disabledFillStipple; } } @@ -848,8 +846,8 @@ DisplayArc( * window servers to crash and should be a no-op anyway. */ - if ((arcPtr->fillGC != None) && (extent != 0)) { - if (stipple != None) { + if ((arcPtr->fillGC) && (extent != 0)) { + if (stipple) { int w = 0; int h = 0; Tk_TSOffset *tsoffset = &arcPtr->tsoffset; @@ -878,14 +876,14 @@ DisplayArc( } XFillArc(display, drawable, arcPtr->fillGC, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), start, extent); - if (stipple != None) { + if (stipple) { XSetTSOrigin(display, arcPtr->fillGC, 0, 0); } } - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc) { Tk_ChangeOutlineGC(canvas, itemPtr, &(arcPtr->outline)); - if (extent != 0) { + if (extent) { XDrawArc(display, drawable, arcPtr->outline.gc, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), start, extent); } @@ -897,7 +895,7 @@ DisplayArc( * outline is dashed, because then polygons don't work. */ - if (lineWidth < 1.5 || dashnumber != 0) { + if (lineWidth < 1.5 || dashnumber) { Tk_CanvasDrawableCoords(canvas, arcPtr->center1[0], arcPtr->center1[1], &x1, &y1); Tk_CanvasDrawableCoords(canvas, arcPtr->center2[0], @@ -920,13 +918,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, 0); } else if (arcPtr->style == PIESLICE_STYLE) { TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS, - display, drawable, arcPtr->outline.gc, None); + display, drawable, arcPtr->outline.gc, 0); TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS, PIE_OUTLINE2_PTS, display, drawable, - arcPtr->outline.gc, None); + arcPtr->outline.gc, 0); } } @@ -1032,12 +1030,12 @@ ArcToPoint( return dist; } - if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) { + if (arcPtr->fillGC || !arcPtr->outline.gc) { filled = 1; } else { filled = 0; } - if (arcPtr->outline.gc == None) { + if (!arcPtr->outline.gc) { width = 0.0; } @@ -1159,12 +1157,12 @@ ArcToArea( } } - if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) { + if ((arcPtr->fillGC) || !arcPtr->outline.gc) { filled = 1; } else { filled = 0; } - if (arcPtr->outline.gc == None) { + if (!arcPtr->outline.gc) { width = 0.0; } @@ -1859,29 +1857,29 @@ ArcToPostscript( fillColor = arcPtr->fillColor; fillStipple = arcPtr->fillStipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (arcPtr->outline.activeColor!=NULL) { + if (arcPtr->outline.activeColor) { color = arcPtr->outline.activeColor; } - if (arcPtr->outline.activeStipple!=None) { + if (arcPtr->outline.activeStipple) { stipple = arcPtr->outline.activeStipple; } - if (arcPtr->activeFillColor!=NULL) { + if (arcPtr->activeFillColor) { fillColor = arcPtr->activeFillColor; } - if (arcPtr->activeFillStipple!=None) { + if (arcPtr->activeFillStipple) { fillStipple = arcPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { - if (arcPtr->outline.disabledColor!=NULL) { + if (arcPtr->outline.disabledColor) { color = arcPtr->outline.disabledColor; } - if (arcPtr->outline.disabledStipple!=None) { + if (arcPtr->outline.disabledStipple) { stipple = arcPtr->outline.disabledStipple; } - if (arcPtr->disabledFillColor!=NULL) { + if (arcPtr->disabledFillColor) { fillColor = arcPtr->disabledFillColor; } - if (arcPtr->disabledFillStipple!=None) { + if (arcPtr->disabledFillStipple) { fillStipple = arcPtr->disabledFillStipple; } } @@ -1891,7 +1889,7 @@ ArcToPostscript( * arc. */ - if (arcPtr->fillGC != None) { + if (arcPtr->fillGC) { sprintf(buffer, "matrix currentmatrix\n%.15g %.15g translate %.15g %.15g scale\n", (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2, (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); @@ -1908,12 +1906,12 @@ ArcToPostscript( if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) { return TCL_ERROR; } - if (fillStipple != None) { + if (fillStipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) { return TCL_ERROR; } - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc) { Tcl_AppendResult(interp, "grestore gsave\n", NULL); } } else { @@ -1925,7 +1923,7 @@ ArcToPostscript( * If there's an outline for the arc, draw it. */ - if (arcPtr->outline.gc != None) { + if (arcPtr->outline.gc) { sprintf(buffer, "matrix currentmatrix\n%.15g %.15g translate %.15g %.15g scale\n", (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2, (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); @@ -1948,7 +1946,7 @@ ArcToPostscript( != TCL_OK) { return TCL_ERROR; } - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK){ return TCL_ERROR; @@ -1965,7 +1963,7 @@ ArcToPostscript( != TCL_OK) { return TCL_ERROR; } - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 30aa429..6f38293 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -182,16 +182,16 @@ TkcCreateBitmap( */ bmapPtr->anchor = TK_ANCHOR_CENTER; - bmapPtr->bitmap = None; - bmapPtr->activeBitmap = None; - bmapPtr->disabledBitmap = None; + bmapPtr->bitmap = 0; + bmapPtr->activeBitmap = 0; + bmapPtr->disabledBitmap = 0; bmapPtr->fgColor = NULL; bmapPtr->activeFgColor = NULL; bmapPtr->disabledFgColor = NULL; bmapPtr->bgColor = NULL; bmapPtr->activeBgColor = NULL; bmapPtr->disabledBgColor = NULL; - bmapPtr->gc = None; + bmapPtr->gc = 0; /* * Process the arguments to fill in the item record. Only 1 (list) or 2 (x @@ -336,9 +336,9 @@ ConfigureBitmap( state = itemPtr->state; - if (bmapPtr->activeFgColor!=NULL || - bmapPtr->activeBgColor!=NULL || - bmapPtr->activeBitmap!=None) { + if (bmapPtr->activeFgColor || + bmapPtr->activeBgColor || + bmapPtr->activeBitmap) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -355,33 +355,33 @@ ConfigureBitmap( bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeFgColor!=NULL) { + if (bmapPtr->activeFgColor) { fgColor = bmapPtr->activeFgColor; } - if (bmapPtr->activeBgColor!=NULL) { + if (bmapPtr->activeBgColor) { bgColor = bmapPtr->activeBgColor; } - if (bmapPtr->activeBitmap!=None) { + if (bmapPtr->activeBitmap) { bitmap = bmapPtr->activeBitmap; } } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledFgColor!=NULL) { + if (bmapPtr->disabledFgColor) { fgColor = bmapPtr->disabledFgColor; } - if (bmapPtr->disabledBgColor!=NULL) { + if (bmapPtr->disabledBgColor) { bgColor = bmapPtr->disabledBgColor; } - if (bmapPtr->disabledBitmap!=None) { + if (bmapPtr->disabledBitmap) { bitmap = bmapPtr->disabledBitmap; } } - if (bitmap == None) { - newGC = None; + if (!bitmap) { + newGC = 0; } else { gcValues.foreground = fgColor->pixel; mask = GCForeground; - if (bgColor != NULL) { + if (bgColor) { gcValues.background = bgColor->pixel; mask |= GCBackground; } else { @@ -390,7 +390,7 @@ ConfigureBitmap( } newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (bmapPtr->gc != None) { + if (bmapPtr->gc) { Tk_FreeGC(Tk_Display(tkwin), bmapPtr->gc); } bmapPtr->gc = newGC; @@ -424,34 +424,34 @@ DeleteBitmap( { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; - if (bmapPtr->bitmap != None) { + if (bmapPtr->bitmap) { Tk_FreeBitmap(display, bmapPtr->bitmap); } - if (bmapPtr->activeBitmap != None) { + if (bmapPtr->activeBitmap) { Tk_FreeBitmap(display, bmapPtr->activeBitmap); } - if (bmapPtr->disabledBitmap != None) { + if (bmapPtr->disabledBitmap) { Tk_FreeBitmap(display, bmapPtr->disabledBitmap); } - if (bmapPtr->fgColor != NULL) { + if (bmapPtr->fgColor) { Tk_FreeColor(bmapPtr->fgColor); } - if (bmapPtr->activeFgColor != NULL) { + if (bmapPtr->activeFgColor) { Tk_FreeColor(bmapPtr->activeFgColor); } - if (bmapPtr->disabledFgColor != NULL) { + if (bmapPtr->disabledFgColor) { Tk_FreeColor(bmapPtr->disabledFgColor); } - if (bmapPtr->bgColor != NULL) { + if (bmapPtr->bgColor) { Tk_FreeColor(bmapPtr->bgColor); } - if (bmapPtr->activeBgColor != NULL) { + if (bmapPtr->activeBgColor) { Tk_FreeColor(bmapPtr->activeBgColor); } - if (bmapPtr->disabledBgColor != NULL) { + if (bmapPtr->disabledBgColor) { Tk_FreeColor(bmapPtr->disabledBgColor); } - if (bmapPtr->gc != NULL) { + if (bmapPtr->gc) { Tk_FreeGC(display, bmapPtr->gc); } } @@ -490,11 +490,11 @@ ComputeBitmapBbox( } bitmap = bmapPtr->bitmap; if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)bmapPtr) { - if (bmapPtr->activeBitmap!=None) { + if (bmapPtr->activeBitmap) { bitmap = bmapPtr->activeBitmap; } - } else if (state==TK_STATE_DISABLED) { - if (bmapPtr->disabledBitmap!=None) { + } else if (state == TK_STATE_DISABLED) { + if (bmapPtr->disabledBitmap) { bitmap = bmapPtr->disabledBitmap; } } @@ -502,7 +502,7 @@ ComputeBitmapBbox( x = (int) (bmapPtr->x + ((bmapPtr->x >= 0) ? 0.5 : - 0.5)); y = (int) (bmapPtr->y + ((bmapPtr->y >= 0) ? 0.5 : - 0.5)); - if (state==TK_STATE_HIDDEN || bitmap == None) { + if ((state == TK_STATE_HIDDEN) || !bitmap) { bmapPtr->header.x1 = bmapPtr->header.x2 = x; bmapPtr->header.y1 = bmapPtr->header.y2 = y; return; @@ -600,16 +600,16 @@ DisplayBitmap( } bitmap = bmapPtr->bitmap; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeBitmap!=None) { + if (bmapPtr->activeBitmap) { bitmap = bmapPtr->activeBitmap; } } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledBitmap!=None) { + if (bmapPtr->disabledBitmap) { bitmap = bmapPtr->disabledBitmap; } } - if (bitmap != None) { + if (bitmap) { if (x > bmapPtr->header.x1) { bmapX = x - bmapPtr->header.x1; bmapWidth = bmapPtr->header.x2 - x; @@ -868,28 +868,28 @@ BitmapToPostscript( bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeFgColor!=NULL) { + if (bmapPtr->activeFgColor) { fgColor = bmapPtr->activeFgColor; } - if (bmapPtr->activeBgColor!=NULL) { + if (bmapPtr->activeBgColor) { bgColor = bmapPtr->activeBgColor; } - if (bmapPtr->activeBitmap!=None) { + if (bmapPtr->activeBitmap) { bitmap = bmapPtr->activeBitmap; } } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledFgColor!=NULL) { + if (bmapPtr->disabledFgColor) { fgColor = bmapPtr->disabledFgColor; } - if (bmapPtr->disabledBgColor!=NULL) { + if (bmapPtr->disabledBgColor) { bgColor = bmapPtr->disabledBgColor; } - if (bmapPtr->disabledBitmap!=None) { + if (bmapPtr->disabledBitmap) { bitmap = bmapPtr->disabledBitmap; } } - if (bitmap == None) { + if (!bitmap) { return TCL_OK; } diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 9e928c7..134cc23 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -436,16 +436,16 @@ ComputeImageBbox( Tk_Image image; Tk_State state = imgPtr->header.state; - if(state == TK_STATE_NULL) { + if (state == TK_STATE_NULL) { state = ((TkCanvas *)canvas)->canvas_state; } image = imgPtr->image; if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)imgPtr) { - if (imgPtr->activeImage != NULL) { + if (imgPtr->activeImage) { image = imgPtr->activeImage; } } else if (state == TK_STATE_DISABLED) { - if (imgPtr->disabledImage != NULL) { + if (imgPtr->disabledImage) { image = imgPtr->disabledImage; } } @@ -453,7 +453,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) { 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 cce3460..78cf74c 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -303,7 +303,7 @@ CreateLine( linePtr->coordPtr = NULL; linePtr->capStyle = CapButt; linePtr->joinStyle = JoinRound; - linePtr->arrowGC = None; + linePtr->arrowGC = 0; linePtr->arrow = ARROWS_NONE; linePtr->arrowShapeA = (float)8.0; linePtr->arrowShapeB = (float)10.0; @@ -503,9 +503,9 @@ ConfigureLine( } if (linePtr->outline.activeWidth > linePtr->outline.width || - linePtr->outline.activeDash.number != 0 || - linePtr->outline.activeColor != NULL || - linePtr->outline.activeStipple != None) { + linePtr->outline.activeDash.number || + linePtr->outline.activeColor || + linePtr->outline.activeStipple) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -531,12 +531,12 @@ ConfigureLine( #endif arrowGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = arrowGC = None; + newGC = arrowGC = 0; } - if (linePtr->outline.gc != None) { + if (linePtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc); } - if (linePtr->arrowGC != None) { + if (linePtr->arrowGC) { Tk_FreeGC(Tk_Display(tkwin), linePtr->arrowGC); } linePtr->outline.gc = newGC; @@ -552,7 +552,7 @@ ConfigureLine( linePtr->splineSteps = 100; } - if ((!linePtr->numPoints) || (state==TK_STATE_HIDDEN)) { + if (!linePtr->numPoints || (state==TK_STATE_HIDDEN)) { ComputeLineBbox(canvas, linePtr); return TCL_OK; } @@ -562,7 +562,7 @@ ConfigureLine( * line's endpoints (they were shortened when the arrowheads were added). */ - if ((linePtr->firstArrowPtr != NULL) && (linePtr->arrow != ARROWS_FIRST) + if (linePtr->firstArrowPtr && (linePtr->arrow != ARROWS_FIRST) && (linePtr->arrow != ARROWS_BOTH)) { linePtr->coordPtr[0] = linePtr->firstArrowPtr[0]; linePtr->coordPtr[1] = linePtr->firstArrowPtr[1]; @@ -618,16 +618,16 @@ DeleteLine( LineItem *linePtr = (LineItem *) itemPtr; Tk_DeleteOutline(display, &(linePtr->outline)); - if (linePtr->coordPtr != NULL) { + if (linePtr->coordPtr) { ckfree((char *) linePtr->coordPtr); } - if (linePtr->arrowGC != None) { + if (linePtr->arrowGC) { Tk_FreeGC(display, linePtr->arrowGC); } - if (linePtr->firstArrowPtr != NULL) { + if (linePtr->firstArrowPtr) { ckfree((char *) linePtr->firstArrowPtr); } - if (linePtr->lastArrowPtr != NULL) { + if (linePtr->lastArrowPtr) { ckfree((char *) linePtr->lastArrowPtr); } } @@ -664,7 +664,7 @@ ComputeLineBbox( state = ((TkCanvas *)canvas)->canvas_state; } - if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) { + if (!(linePtr->numPoints) || (state == TK_STATE_HIDDEN)) { linePtr->header.x1 = -1; linePtr->header.x2 = -1; linePtr->header.y1 = -1; @@ -677,7 +677,7 @@ ComputeLineBbox( if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } - } else if (state==TK_STATE_DISABLED) { + } else if (state == TK_STATE_DISABLED) { if (linePtr->outline.disabledWidth>0) { width = linePtr->outline.disabledWidth; } @@ -846,7 +846,7 @@ DisplayLine( int numPoints; Tk_State state = itemPtr->state; - if ((!linePtr->numPoints)||(linePtr->outline.gc==None)) { + if (!linePtr->numPoints || !linePtr->outline.gc) { return; } @@ -2251,7 +2251,7 @@ LineToPostscript( * being created. */ { LineItem *linePtr = (LineItem *) itemPtr; - char buffer[64 + TCL_INTEGER_SPACE]; + char buffer[64 + 4*TCL_INTEGER_SPACE]; char *style; double width; @@ -2270,20 +2270,20 @@ LineToPostscript( if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } - if (linePtr->outline.activeColor!=NULL) { + if (linePtr->outline.activeColor) { color = linePtr->outline.activeColor; } - if (linePtr->outline.activeStipple!=None) { + if (linePtr->outline.activeStipple) { stipple = linePtr->outline.activeStipple; } } else if (state==TK_STATE_DISABLED) { if (linePtr->outline.disabledWidth>0) { width = linePtr->outline.disabledWidth; } - if (linePtr->outline.disabledColor!=NULL) { + if (linePtr->outline.disabledColor) { color = linePtr->outline.disabledColor; } - if (linePtr->outline.disabledStipple!=None) { + if (linePtr->outline.disabledStipple) { stipple = linePtr->outline.disabledStipple; } } @@ -2301,7 +2301,7 @@ LineToPostscript( if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; @@ -2319,7 +2319,7 @@ LineToPostscript( if ((!linePtr->smooth) || (linePtr->numPoints < 3)) { Tk_CanvasPsPath(interp, canvas, linePtr->coordPtr, linePtr->numPoints); } else { - if ((stipple == None) && linePtr->smooth->postscriptProc) { + if (!stipple && linePtr->smooth->postscriptProc) { linePtr->smooth->postscriptProc(interp, canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps); } else { @@ -2379,8 +2379,8 @@ LineToPostscript( * Output polygons for the arrowheads, if there are any. */ - if (linePtr->firstArrowPtr != NULL) { - if (stipple != None) { + if (linePtr->firstArrowPtr) { + if (stipple) { Tcl_AppendResult(interp, "grestore gsave\n", NULL); } if (ArrowheadPostscript(interp, canvas, linePtr, @@ -2389,7 +2389,7 @@ LineToPostscript( } } if (linePtr->lastArrowPtr != NULL) { - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "grestore gsave\n", NULL); } if (ArrowheadPostscript(interp, canvas, linePtr, @@ -2438,17 +2438,17 @@ ArrowheadPostscript( stipple = linePtr->outline.stipple; if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) { - if (linePtr->outline.activeStipple!=None) { + if (linePtr->outline.activeStipple) { stipple = linePtr->outline.activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (linePtr->outline.activeStipple!=None) { + if (linePtr->outline.activeStipple) { stipple = linePtr->outline.disabledStipple; } } Tk_CanvasPsPath(interp, canvas, arrowPtr, PTS_IN_ARROW); - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index b86bc63..9b210fa 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -276,10 +276,10 @@ CreatePolygon( polyPtr->fillColor = NULL; polyPtr->activeFillColor = NULL; polyPtr->disabledFillColor = NULL; - polyPtr->fillStipple = None; - polyPtr->activeFillStipple = None; - polyPtr->disabledFillStipple = None; - polyPtr->fillGC = None; + polyPtr->fillStipple = 0; + polyPtr->activeFillStipple = 0; + polyPtr->disabledFillStipple = 0; + polyPtr->fillGC = 0; polyPtr->smooth = NULL; polyPtr->splineSteps = 12; polyPtr->autoClosed = 0; @@ -459,11 +459,11 @@ ConfigurePolygon( state = itemPtr->state; if (polyPtr->outline.activeWidth > polyPtr->outline.width || - polyPtr->outline.activeDash.number != 0 || - polyPtr->outline.activeColor != NULL || - polyPtr->outline.activeStipple != None || - polyPtr->activeFillColor != NULL || - polyPtr->activeFillStipple != None) { + polyPtr->outline.activeDash.number || + polyPtr->outline.activeColor || + polyPtr->outline.activeStipple || + polyPtr->activeFillColor || + polyPtr->activeFillStipple) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -484,9 +484,9 @@ ConfigurePolygon( mask |= GCCapStyle|GCJoinStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = None; + newGC = 0; } - if (polyPtr->outline.gc != None) { + if (polyPtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc); } polyPtr->outline.gc = newGC; @@ -494,27 +494,27 @@ ConfigurePolygon( color = polyPtr->fillColor; stipple = polyPtr->fillStipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->activeFillColor!=NULL) { + if (polyPtr->activeFillColor) { color = polyPtr->activeFillColor; } - if (polyPtr->activeFillStipple!=None) { + if (polyPtr->activeFillStipple) { stipple = polyPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { if (polyPtr->disabledFillColor!=NULL) { color = polyPtr->disabledFillColor; } - if (polyPtr->disabledFillStipple!=None) { + if (polyPtr->disabledFillStipple) { stipple = polyPtr->disabledFillStipple; } } if (color == NULL) { - newGC = None; + newGC = 0; } else { gcValues.foreground = color->pixel; mask = GCForeground; - if (stipple != None) { + if (stipple) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -530,7 +530,7 @@ ConfigurePolygon( #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (polyPtr->fillGC != None) { + if (polyPtr->fillGC) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC); } polyPtr->fillGC = newGC; @@ -575,28 +575,28 @@ DeletePolygon( PolygonItem *polyPtr = (PolygonItem *) itemPtr; Tk_DeleteOutline(display,&(polyPtr->outline)); - if (polyPtr->coordPtr != NULL) { + if (polyPtr->coordPtr) { ckfree((char *) polyPtr->coordPtr); } - if (polyPtr->fillColor != NULL) { + if (polyPtr->fillColor) { Tk_FreeColor(polyPtr->fillColor); } - if (polyPtr->activeFillColor != NULL) { + if (polyPtr->activeFillColor) { Tk_FreeColor(polyPtr->activeFillColor); } - if (polyPtr->disabledFillColor != NULL) { + if (polyPtr->disabledFillColor) { Tk_FreeColor(polyPtr->disabledFillColor); } - if (polyPtr->fillStipple != None) { + if (polyPtr->fillStipple) { Tk_FreeBitmap(display, polyPtr->fillStipple); } - if (polyPtr->activeFillStipple != None) { + if (polyPtr->activeFillStipple) { Tk_FreeBitmap(display, polyPtr->activeFillStipple); } - if (polyPtr->disabledFillStipple != None) { + if (polyPtr->disabledFillStipple) { Tk_FreeBitmap(display, polyPtr->disabledFillStipple); } - if (polyPtr->fillGC != None) { + if (polyPtr->fillGC) { Tk_FreeGC(display, polyPtr->fillGC); } } @@ -698,7 +698,7 @@ ComputePolygonBbox( } } - if (polyPtr->outline.gc != None) { + if (polyPtr->outline.gc) { tsoffset = &polyPtr->outline.tsoffset; if (tsoffset) { if (tsoffset->flags & TK_OFFSET_INDEX) { @@ -840,11 +840,11 @@ TkFillPolygon( * allocated. */ - if (gc != None && numPoints>3) { + if (gc && (numPoints > 3)) { XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex, CoordModeOrigin); } - if (outlineGC != None) { + if (outlineGC) { XDrawLines(display, drawable, outlineGC, pointPtr, numPoints, CoordModeOrigin); } @@ -885,9 +885,9 @@ DisplayPolygon( Pixmap stipple = polyPtr->fillStipple; double linewidth = polyPtr->outline.width; - if (((polyPtr->fillGC == None) && (polyPtr->outline.gc == None)) || + if ((!polyPtr->fillGC && !polyPtr->outline.gc) || (polyPtr->numPoints < 1) || - (polyPtr->numPoints < 3 && polyPtr->outline.gc == None)) { + (polyPtr->numPoints < 3 && !polyPtr->outline.gc)) { return; } @@ -898,14 +898,14 @@ DisplayPolygon( if (polyPtr->outline.activeWidth>linewidth) { linewidth = polyPtr->outline.activeWidth; } - if (polyPtr->activeFillStipple != None) { + if (polyPtr->activeFillStipple) { stipple = polyPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { if (polyPtr->outline.disabledWidth>0.0) { linewidth = polyPtr->outline.disabledWidth; } - if (polyPtr->disabledFillStipple != None) { + if (polyPtr->disabledFillStipple) { stipple = polyPtr->disabledFillStipple; } } @@ -915,7 +915,7 @@ DisplayPolygon( * reset the offset when done, since the GC is supposed to be read-only. */ - if ((stipple != None) && (polyPtr->fillGC != None)) { + if (stipple && polyPtr->fillGC) { Tk_TSOffset *tsoffset = &polyPtr->tsoffset; int w=0; int h=0; int flags = tsoffset->flags; @@ -977,11 +977,11 @@ DisplayPolygon( } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); - if (polyPtr->fillGC != None) { + if (polyPtr->fillGC) { XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr, numPoints, Complex, CoordModeOrigin); } - if (polyPtr->outline.gc != None) { + if (polyPtr->outline.gc) { XDrawLines(display, drawable, polyPtr->outline.gc, pointPtr, numPoints, CoordModeOrigin); } @@ -990,7 +990,7 @@ DisplayPolygon( } } Tk_ResetOutlineGC(canvas, itemPtr, &(polyPtr->outline)); - if ((stipple != None) && (polyPtr->fillGC != None)) { + if (stipple && polyPtr->fillGC) { XSetTSOrigin(display, polyPtr->fillGC, 0, 0); } } @@ -1303,7 +1303,7 @@ PolygonToPoint( if (bestDist<=0.0) { goto donepoint; } - if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) { + if (polyPtr->outline.gc && (polyPtr->joinStyle == JoinRound)) { dist = bestDist - radius; if (dist <= 0.0) { bestDist = 0.0; @@ -1313,7 +1313,7 @@ PolygonToPoint( } } - if ((polyPtr->outline.gc == None) || (width <= 1)) { + if (!polyPtr->outline.gc || (width <= 1)) { goto donepoint; } @@ -1520,7 +1520,7 @@ PolygonToArea( goto donearea; } - if (polyPtr->outline.gc == None) { + if (!polyPtr->outline.gc) { goto donearea; } @@ -1830,32 +1830,32 @@ PolygonToPostscript( if (polyPtr->outline.activeWidth>width) { width = polyPtr->outline.activeWidth; } - if (polyPtr->outline.activeColor!=NULL) { + if (polyPtr->outline.activeColor) { color = polyPtr->outline.activeColor; } - if (polyPtr->outline.activeStipple!=None) { + if (polyPtr->outline.activeStipple) { stipple = polyPtr->outline.activeStipple; } - if (polyPtr->activeFillColor!=NULL) { + if (polyPtr->activeFillColor) { fillColor = polyPtr->activeFillColor; } - if (polyPtr->activeFillStipple!=None) { + if (polyPtr->activeFillStipple) { fillStipple = polyPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { if (polyPtr->outline.disabledWidth>0.0) { width = polyPtr->outline.disabledWidth; } - if (polyPtr->outline.disabledColor!=NULL) { + if (polyPtr->outline.disabledColor) { color = polyPtr->outline.disabledColor; } - if (polyPtr->outline.disabledStipple!=None) { + if (polyPtr->outline.disabledStipple) { stipple = polyPtr->outline.disabledStipple; } - if (polyPtr->disabledFillColor!=NULL) { + if (polyPtr->disabledFillColor) { fillColor = polyPtr->disabledFillColor; } - if (polyPtr->disabledFillStipple!=None) { + if (polyPtr->disabledFillStipple) { fillStipple = polyPtr->disabledFillStipple; } } @@ -1873,7 +1873,7 @@ PolygonToPostscript( if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; @@ -1899,7 +1899,7 @@ PolygonToPostscript( if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) { return TCL_ERROR; } - if (fillStipple != None) { + if (fillStipple) { Tcl_AppendResult(interp, "eoclip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) { return TCL_ERROR; @@ -1916,7 +1916,7 @@ PolygonToPostscript( * Now draw the outline, if there is one. */ - if (color != NULL) { + if (color) { if (!polyPtr->smooth || !polyPtr->smooth->postscriptProc) { Tk_CanvasPsPath(interp, canvas, polyPtr->coordPtr, polyPtr->numPoints); diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 24c3c7f..e187871 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -253,9 +253,9 @@ CreateText( textPtr->disabledColor = NULL; textPtr->tkfont = NULL; textPtr->justify = TK_JUSTIFY_LEFT; - textPtr->stipple = None; - textPtr->activeStipple = None; - textPtr->disabledStipple = None; + textPtr->stipple = 0; + textPtr->activeStipple = 0; + textPtr->disabledStipple = 0; textPtr->text = NULL; textPtr->width = 0; textPtr->underline = -1; @@ -265,9 +265,9 @@ CreateText( textPtr->textLayout = NULL; textPtr->leftEdge = 0; textPtr->rightEdge = 0; - textPtr->gc = None; - textPtr->selTextGC = None; - textPtr->cursorOffGC = None; + textPtr->gc = 0; + textPtr->selTextGC = 0; + textPtr->cursorOffGC = 0; /* * Process the arguments to fill in the item record. Only 1 (list) or 2 (x @@ -414,7 +414,7 @@ ConfigureText( state = itemPtr->state; - if (textPtr->activeColor != NULL || textPtr->activeStipple != None) { + if (textPtr->activeColor || textPtr->activeStipple) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -427,29 +427,29 @@ ConfigureText( color = textPtr->color; stipple = textPtr->stipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (textPtr->activeColor!=NULL) { + if (textPtr->activeColor) { color = textPtr->activeColor; } - if (textPtr->activeStipple!=None) { + if (textPtr->activeStipple) { stipple = textPtr->activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (textPtr->disabledColor!=NULL) { + if (textPtr->disabledColor) { color = textPtr->disabledColor; } - if (textPtr->disabledStipple!=None) { + if (textPtr->disabledStipple) { stipple = textPtr->disabledStipple; } } - newGC = newSelGC = None; - if (textPtr->tkfont != NULL) { + newGC = newSelGC = 0; + if (textPtr->tkfont) { gcValues.font = Tk_FontId(textPtr->tkfont); mask = GCFont; - if (color != NULL) { + if (color) { gcValues.foreground = color->pixel; mask |= GCForeground; - if (stipple != None) { + if (stipple) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -457,7 +457,7 @@ ConfigureText( newGC = Tk_GetGC(tkwin, mask, &gcValues); } mask &= ~(GCTile|GCFillStyle|GCStipple); - if (stipple != None) { + if (stipple) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -467,11 +467,11 @@ ConfigureText( } newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues); } - if (textPtr->gc != None) { + if (textPtr->gc) { Tk_FreeGC(Tk_Display(tkwin), textPtr->gc); } textPtr->gc = newGC; - if (textPtr->selTextGC != None) { + if (textPtr->selTextGC) { Tk_FreeGC(Tk_Display(tkwin), textPtr->selTextGC); } textPtr->selTextGC = newSelGC; @@ -486,9 +486,9 @@ ConfigureText( } newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); } else { - newGC = None; + newGC = 0; } - if (textPtr->cursorOffGC != None) { + if (textPtr->cursorOffGC) { Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC); } textPtr->cursorOffGC = newGC; @@ -548,37 +548,37 @@ DeleteText( { TextItem *textPtr = (TextItem *) itemPtr; - if (textPtr->color != NULL) { + if (textPtr->color) { Tk_FreeColor(textPtr->color); } - if (textPtr->activeColor != NULL) { + if (textPtr->activeColor) { Tk_FreeColor(textPtr->activeColor); } - if (textPtr->disabledColor != NULL) { + if (textPtr->disabledColor) { Tk_FreeColor(textPtr->disabledColor); } Tk_FreeFont(textPtr->tkfont); - if (textPtr->stipple != None) { + if (textPtr->stipple) { Tk_FreeBitmap(display, textPtr->stipple); } - if (textPtr->activeStipple != None) { + if (textPtr->activeStipple) { Tk_FreeBitmap(display, textPtr->activeStipple); } - if (textPtr->disabledStipple != None) { + if (textPtr->disabledStipple) { Tk_FreeBitmap(display, textPtr->disabledStipple); } - if (textPtr->text != NULL) { + if (textPtr->text) { ckfree(textPtr->text); } Tk_FreeTextLayout(textPtr->textLayout); - if (textPtr->gc != None) { + if (textPtr->gc) { Tk_FreeGC(display, textPtr->gc); } - if (textPtr->selTextGC != None) { + if (textPtr->selTextGC) { Tk_FreeGC(display, textPtr->selTextGC); } - if (textPtr->cursorOffGC != None) { + if (textPtr->cursorOffGC) { Tk_FreeGC(display, textPtr->cursorOffGC); } } @@ -731,16 +731,16 @@ DisplayCanvText( } stipple = textPtr->stipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (textPtr->activeStipple!=None) { + if (textPtr->activeStipple) { stipple = textPtr->activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (textPtr->disabledStipple!=None) { + if (textPtr->disabledStipple) { stipple = textPtr->disabledStipple; } } - if (textPtr->gc == None) { + if (!textPtr->gc) { return; } @@ -750,7 +750,7 @@ DisplayCanvText( * read-only. */ - if (stipple != None) { + if (stipple) { Tk_CanvasSetOffset(canvas, textPtr->gc, &textPtr->tsoffset); } @@ -830,7 +830,7 @@ DisplayCanvText( drawableX, drawableY, textInfoPtr->insertWidth, height, textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED); - } else if (textPtr->cursorOffGC != None) { + } else if (textPtr->cursorOffGC) { /* * Redraw the background over the area of the cursor, even * though the cursor is turned off. This guarantees that the @@ -874,7 +874,7 @@ DisplayCanvText( Tk_UnderlineTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->underline); - if (stipple != None) { + if (stipple) { XSetTSOrigin(display, textPtr->gc, 0, 0); } } @@ -1447,14 +1447,14 @@ TextToPostscript( if (textPtr->activeColor!=NULL) { color = textPtr->activeColor; } - if (textPtr->activeStipple!=None) { + if (textPtr->activeStipple) { stipple = textPtr->activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (textPtr->disabledColor!=NULL) { + if (textPtr->disabledColor) { color = textPtr->disabledColor; } - if (textPtr->disabledStipple!=None) { + if (textPtr->disabledStipple) { stipple = textPtr->disabledStipple; } } @@ -1462,13 +1462,13 @@ TextToPostscript( if (Tk_CanvasPsFont(interp, canvas, textPtr->tkfont) != TCL_OK) { return TCL_ERROR; } - if (prepass != 0) { + if (prepass) { return TCL_OK; } if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "/StippleText {\n ", NULL); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendResult(interp, "} bind def\n", NULL); @@ -1506,7 +1506,7 @@ TextToPostscript( Tcl_PrintDouble(NULL, y / 2.0, buffer); Tcl_AppendResult(interp, " ", buffer, NULL); sprintf(buffer, " %s %s DrawText\n", - justify, ((stipple == None) ? "false" : "true")); + justify, (stipple ? "true" : "false")); Tcl_AppendResult(interp, buffer, NULL); return TCL_OK; diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index 08aeab7..cacceda 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -959,7 +959,7 @@ void Tk_CreateOutline( Tk_Outline *outline) /* Outline structure to be filled in. */ { - outline->gc = None; + outline->gc = 0; outline->width = 1.0; outline->activeWidth = 0.0; outline->disabledWidth = 0.0; @@ -973,9 +973,9 @@ Tk_CreateOutline( outline->color = NULL; outline->activeColor = NULL; outline->disabledColor = NULL; - outline->stipple = None; - outline->activeStipple = None; - outline->disabledStipple = None; + outline->stipple = 0; + outline->activeStipple = 0; + outline->disabledStipple = 0; } /* @@ -1000,7 +1000,7 @@ Tk_DeleteOutline( Display *display, /* Display containing window. */ Tk_Outline *outline) { - if (outline->gc != None) { + if (outline->gc) { Tk_FreeGC(display, outline->gc); } if ((unsigned int)ABS(outline->dash.number) > sizeof(char *)) { @@ -1012,22 +1012,22 @@ Tk_DeleteOutline( if ((unsigned int)ABS(outline->disabledDash.number) > sizeof(char *)) { ckfree((char *) outline->disabledDash.pattern.pt); } - if (outline->color != NULL) { + if (outline->color) { Tk_FreeColor(outline->color); } - if (outline->activeColor != NULL) { + if (outline->activeColor) { Tk_FreeColor(outline->activeColor); } - if (outline->disabledColor != NULL) { + if (outline->disabledColor) { Tk_FreeColor(outline->disabledColor); } - if (outline->stipple != None) { + if (outline->stipple) { Tk_FreeBitmap(display, outline->stipple); } - if (outline->activeStipple != None) { + if (outline->activeStipple) { Tk_FreeBitmap(display, outline->activeStipple); } - if (outline->disabledStipple != None) { + if (outline->disabledStipple) { Tk_FreeBitmap(display, outline->disabledStipple); } } @@ -1093,26 +1093,26 @@ Tk_ConfigOutlineGC( if (outline->activeWidth>width) { width = outline->activeWidth; } - if (outline->activeDash.number != 0) { + if (outline->activeDash.number) { dash = &(outline->activeDash); } - if (outline->activeColor!=NULL) { + if (outline->activeColor) { color = outline->activeColor; } - if (outline->activeStipple!=None) { + if (outline->activeStipple) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (outline->disabledWidth>0) { width = outline->disabledWidth; } - if (outline->disabledDash.number != 0) { + if (outline->disabledDash.number) { dash = &(outline->disabledDash); } - if (outline->disabledColor!=NULL) { + if (outline->disabledColor) { color = outline->disabledColor; } - if (outline->disabledStipple!=None) { + if (outline->disabledStipple) { stipple = outline->disabledStipple; } } @@ -1125,18 +1125,18 @@ Tk_ConfigOutlineGC( if (color != NULL) { gcValues->foreground = color->pixel; mask = GCForeground|GCLineWidth; - if (stipple != None) { + if (stipple) { gcValues->stipple = stipple; gcValues->fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } } - if (mask && (dash->number != 0)) { + if (mask && dash->number) { gcValues->line_style = LineOnOffDash; gcValues->dash_offset = outline->offset; if ((unsigned int)ABS(dash->number) > sizeof(char *)) { gcValues->dashes = dash->pattern.pt[0]; - } else if (dash->number != 0) { + } else if (dash->number) { gcValues->dashes = dash->pattern.array[0]; } else { gcValues->dashes = (char) (4 * width + 0.5); @@ -1191,30 +1191,30 @@ Tk_ChangeOutlineGC( if (outline->activeWidth > width) { width = outline->activeWidth; } - if (outline->activeDash.number != 0) { + if (outline->activeDash.number) { dash = &(outline->activeDash); } - if (outline->activeColor != NULL) { + if (outline->activeColor) { color = outline->activeColor; } - if (outline->activeStipple != None) { + if (outline->activeStipple) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (outline->disabledWidth > width) { width = outline->disabledWidth; } - if (outline->disabledDash.number != 0) { + if (outline->disabledDash.number) { dash = &(outline->disabledDash); } - if (outline->disabledColor != NULL) { + if (outline->disabledColor) { color = outline->disabledColor; } - if (outline->disabledStipple != None) { + if (outline->disabledStipple) { stipple = outline->disabledStipple; } } - if (color==NULL) { + if (!color) { return 0; } @@ -1236,7 +1236,7 @@ Tk_ChangeOutlineGC( XSetDashes(((TkCanvas *)canvas)->display, outline->gc, outline->offset, p, dash->number); } - if (stipple!=None) { + if (stipple) { int w=0; int h=0; Tk_TSOffset *tsoffset = &outline->tsoffset; int flags = tsoffset->flags; @@ -1310,26 +1310,26 @@ Tk_ResetOutlineGC( if (outline->activeWidth>width) { width = outline->activeWidth; } - if (outline->activeDash.number != 0) { + if (outline->activeDash.number) { dash = &(outline->activeDash); } - if (outline->activeColor!=NULL) { + if (outline->activeColor) { color = outline->activeColor; } - if (outline->activeStipple!=None) { + if (outline->activeStipple) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (outline->disabledWidth>width) { width = outline->disabledWidth; } - if (outline->disabledDash.number != 0) { + if (outline->disabledDash.number) { dash = &(outline->disabledDash); } - if (outline->disabledColor!=NULL) { + if (outline->disabledColor) { color = outline->disabledColor; } - if (outline->disabledStipple!=None) { + if (outline->disabledStipple) { stipple = outline->disabledStipple; } } @@ -1342,7 +1342,7 @@ Tk_ResetOutlineGC( ((dash->number == -1) && (dash->pattern.array[0] != ','))) { if ((unsigned int)ABS(dash->number) > sizeof(char *)) { dashList = dash->pattern.pt[0]; - } else if (dash->number != 0) { + } else if (dash->number) { dashList = dash->pattern.array[0]; } else { dashList = (char) (4 * width + 0.5); @@ -1350,7 +1350,7 @@ Tk_ResetOutlineGC( XSetDashes(((TkCanvas *)canvas)->display, outline->gc, outline->offset, &dashList , 1); } - if (stipple != None) { + if (stipple) { XSetTSOrigin(((TkCanvas *)canvas)->display, outline->gc, 0, 0); return 1; } @@ -1409,10 +1409,10 @@ Tk_CanvasPsOutline( if (outline->activeDash.number > 0) { dash = &(outline->activeDash); } - if (outline->activeColor != NULL) { + if (outline->activeColor) { color = outline->activeColor; } - if (outline->activeStipple != None) { + if (outline->activeStipple) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { @@ -1422,10 +1422,10 @@ Tk_CanvasPsOutline( if (outline->disabledDash.number > 0) { dash = &(outline->disabledDash); } - if (outline->disabledColor != NULL) { + if (outline->disabledColor) { color = outline->disabledColor; } - if (outline->disabledStipple != None) { + if (outline->disabledStipple) { stipple = outline->disabledStipple; } } @@ -1482,7 +1482,7 @@ Tk_CanvasPsOutline( if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple != None) { + if (stipple) { Tcl_AppendResult(interp, "StrokeClip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index b62859c..c5ecf1a 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -583,7 +583,7 @@ DisplayWinItem( * A drawable of None is used by the canvas UnmapNotify handler * to indicate that we should no longer display ourselves. */ - if (state == TK_STATE_HIDDEN || drawable == None) { + if (state == TK_STATE_HIDDEN || !drawable) { if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { Tk_UnmapWindow(winItemPtr->tkwin); } else { diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 8ebe9ba..27a3a32 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -417,9 +417,9 @@ Tk_CanvasObjCmd( canvasPtr->highlightBgColorPtr = NULL; canvasPtr->highlightColorPtr = NULL; canvasPtr->inset = 0; - canvasPtr->pixmapGC = None; - canvasPtr->width = None; - canvasPtr->height = None; + canvasPtr->pixmapGC = 0; + canvasPtr->width = 0; + canvasPtr->height = 0; canvasPtr->confine = 0; canvasPtr->textInfo.selBorder = NULL; canvasPtr->textInfo.selBorderWidth = 0; @@ -463,7 +463,7 @@ Tk_CanvasObjCmd( canvasPtr->scanYOrigin = 0; canvasPtr->hotPtr = NULL; canvasPtr->hotPrevPtr = NULL; - canvasPtr->cursor = None; + canvasPtr->cursor = 0; canvasPtr->takeFocus = NULL; canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin)); canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin)); @@ -1834,7 +1834,7 @@ DestroyCanvas( */ Tcl_DeleteHashTable(&canvasPtr->idTable); - if (canvasPtr->pixmapGC != None) { + if (canvasPtr->pixmapGC) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } #ifndef USE_OLD_TAG_SEARCH @@ -1910,7 +1910,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) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } canvasPtr->pixmapGC = newGC; @@ -2405,7 +2405,7 @@ CanvasEventProc( itemPtr = itemPtr->nextPtr) { if (itemPtr->typePtr->alwaysRedraw & 1) { (*itemPtr->typePtr->displayProc)((Tk_Canvas) canvasPtr, - itemPtr, canvasPtr->display, None, 0, 0, 0, 0); + itemPtr, canvasPtr->display, 0, 0, 0, 0, 0); } } } @@ -4545,7 +4545,7 @@ PickCurrentItem( canvasPtr->pickEvent.xcrossing.display = eventPtr->xmotion.display; canvasPtr->pickEvent.xcrossing.window = eventPtr->xmotion.window; canvasPtr->pickEvent.xcrossing.root = eventPtr->xmotion.root; - canvasPtr->pickEvent.xcrossing.subwindow = None; + canvasPtr->pickEvent.xcrossing.subwindow = 0; canvasPtr->pickEvent.xcrossing.time = eventPtr->xmotion.time; canvasPtr->pickEvent.xcrossing.x = eventPtr->xmotion.x; canvasPtr->pickEvent.xcrossing.y = eventPtr->xmotion.y; diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index c6748a1..4c564e7 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -654,7 +654,7 @@ TkClipInit( Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts); Tk_MakeWindowExist(dispPtr->clipWindow); - if (dispPtr->multipleAtom == None) { + if (!dispPtr->multipleAtom) { /* * Need to invoke selection initialization to make sure that atoms we * depend on below are defined. diff --git a/generic/tkColor.c b/generic/tkColor.c index 76d0baa..1ec4ab1 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -242,7 +242,7 @@ Tk_GetColor( */ tkColPtr->magic = COLOR_MAGIC; - tkColPtr->gc = None; + tkColPtr->gc = 0; tkColPtr->screen = Tk_Screen(tkwin); tkColPtr->colormap = Tk_Colormap(tkwin); tkColPtr->visual = Tk_Visual(tkwin); @@ -323,7 +323,7 @@ Tk_GetColorByValue( tkColPtr = TkpGetColorByValue(tkwin, colorPtr); tkColPtr->magic = COLOR_MAGIC; - tkColPtr->gc = None; + tkColPtr->gc = 0; tkColPtr->screen = Tk_Screen(tkwin); tkColPtr->colormap = valueKey.colormap; tkColPtr->visual = Tk_Visual(tkwin); @@ -414,7 +414,7 @@ Tk_GCForColor( Tcl_Panic("Tk_GCForColor called with bogus color"); } - if (tkColPtr->gc == None) { + if (!tkColPtr->gc) { gcValues.foreground = tkColPtr->color.pixel; tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable, GCForeground, &gcValues); @@ -469,9 +469,9 @@ Tk_FreeColor( * longer any objects referencing it. */ - if (tkColPtr->gc != None) { + if (tkColPtr->gc) { XFreeGC(DisplayOfScreen(screen), tkColPtr->gc); - tkColPtr->gc = None; + tkColPtr->gc = 0; } TkpFreeColor(tkColPtr); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index f2eaa33..5fcbab8 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -802,10 +802,10 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; - newBitmap = None; + newBitmap = 0; } else { newBitmap = Tk_AllocBitmapFromObj(interp, tkwin, valuePtr); - if (newBitmap == None) { + if (!newBitmap) { return TCL_ERROR; } } @@ -854,11 +854,11 @@ DoObjConfig( Tk_Cursor newCursor; if (nullOK && ObjectIsEmpty(valuePtr)) { - newCursor = None; + newCursor = 0; valuePtr = NULL; } else { newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr); - if (newCursor == None) { + if (!newCursor) { return TCL_ERROR; } } @@ -916,7 +916,7 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; - newWin = None; + newWin = 0; } else { if (TkGetWindowFromObj(interp, tkwin, valuePtr, &newWin) != TCL_OK) { @@ -1680,9 +1680,9 @@ FreeResources( break; case TK_OPTION_BITMAP: if (internalFormExists) { - if (*((Pixmap *) internalPtr) != None) { + if (*((Pixmap *) internalPtr)) { Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *) internalPtr)); - *((Pixmap *) internalPtr) = None; + *((Pixmap *) internalPtr) = 0; } } else if (objPtr != NULL) { Tk_FreeBitmapFromObj(tkwin, objPtr); @@ -1700,9 +1700,9 @@ FreeResources( break; case TK_OPTION_CURSOR: if (internalFormExists) { - if (*((Tk_Cursor *) internalPtr) != None) { + if (*((Tk_Cursor *) internalPtr)) { Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr)); - *((Tk_Cursor *) internalPtr) = None; + *((Tk_Cursor *) internalPtr) = 0; } } else if (objPtr != NULL) { Tk_FreeCursorFromObj(tkwin, objPtr); @@ -1954,7 +1954,7 @@ GetObjectForOption( case TK_OPTION_BITMAP: { Pixmap pixmap = *((Pixmap *) internalPtr); - if (pixmap != None) { + if (pixmap) { objPtr = Tcl_NewStringObj( Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1); } @@ -1974,7 +1974,7 @@ GetObjectForOption( case TK_OPTION_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) internalPtr); - if (cursor != None) { + if (cursor) { objPtr = Tcl_NewStringObj( Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1); } diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 410aea9..ced2534 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -149,7 +149,7 @@ Tk_AllocCursorFromObj( cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr)); objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr; if (cursorPtr == NULL) { - return None; + return 0; } cursorPtr->objRefCount++; return cursorPtr->cursor; @@ -187,10 +187,7 @@ Tk_GetCursor( * details on legal syntax. */ { TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string); - if (cursorPtr == NULL) { - return None; - } - return cursorPtr->cursor; + return cursorPtr ? cursorPtr->cursor : 0; } /* @@ -382,7 +379,7 @@ Tk_GetCursorFromData( error: Tcl_DeleteHashEntry(dataHashPtr); - return None; + return 0; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 9f43f90..5eaca77 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -523,16 +523,16 @@ Tk_EntryObjCmd( entryPtr->selectFirst = -1; entryPtr->selectLast = -1; - entryPtr->cursor = None; + entryPtr->cursor = 0; 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 = 0; + entryPtr->selTextGC = 0; + entryPtr->highlightGC = 0; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; @@ -1030,10 +1030,10 @@ DestroyEntry( EntryTextVarProc, (ClientData) entryPtr); entryPtr->flags &= ~ENTRY_VAR_TRACED; } - if (entryPtr->textGC != None) { + if (entryPtr->textGC) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } - if (entryPtr->selTextGC != None) { + if (entryPtr->selTextGC) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler); @@ -1043,7 +1043,7 @@ DestroyEntry( if (entryPtr->type == TK_SPINBOX) { Spinbox *sbPtr = (Spinbox *) entryPtr; - if (sbPtr->listObj != NULL) { + if (sbPtr->listObj) { Tcl_DecrRefCount(sbPtr->listObj); sbPtr->listObj = NULL; } @@ -1423,7 +1423,7 @@ EntryWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = None; + GC gc = 0; unsigned long mask; Tk_3DBorder border; XColor *colorPtr; @@ -1475,18 +1475,18 @@ EntryWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->textGC != None) { + if (entryPtr->textGC) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } entryPtr->textGC = gc; - if (entryPtr->selFgColorPtr != NULL) { + if (entryPtr->selFgColorPtr) { gcValues.foreground = entryPtr->selFgColorPtr->pixel; } gcValues.font = Tk_FontId(entryPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->selTextGC != None) { + if (entryPtr->selTextGC) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } entryPtr->selTextGC = gc; @@ -2451,9 +2451,9 @@ EntryEventProc( } else if ((elem == SEL_BUTTONDOWN) || (elem == SEL_BUTTONUP)) { cursor = sbPtr->bCursor; } else { - cursor = None; + cursor = 0; } - if (cursor != None) { + if (cursor) { Tk_DefineCursor(entryPtr->tkwin, cursor); } else { Tk_UndefineCursor(entryPtr->tkwin); @@ -3591,22 +3591,22 @@ Tk_SpinboxObjCmd( entryPtr->selectFirst = -1; entryPtr->selectLast = -1; - entryPtr->cursor = None; + entryPtr->cursor = 0; 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 = 0; + entryPtr->selTextGC = 0; + entryPtr->highlightGC = 0; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; sbPtr->selElement = SEL_NONE; sbPtr->curElement = SEL_NONE; - sbPtr->bCursor = None; + sbPtr->bCursor = 0; sbPtr->repeatDelay = 400; sbPtr->repeatInterval = 100; sbPtr->fromValue = 0.0; diff --git a/generic/tkEntry.h b/generic/tkEntry.h index 7f8aa1f..2ea7936 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -226,7 +226,7 @@ typedef struct { * value that the users requests. Malloc'ed */ char *valueFormat; /* Sprintf conversion specifier used for the * value. */ - char digitFormat[10]; /* Sprintf conversion specifier computed from + char digitFormat[16]; /* Sprintf conversion specifier computed from * digits and other information; used for the * value. */ diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 747555e..ac5b68c 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -421,11 +421,11 @@ GetTkWindowFromXEvent( } TkSelPropProc(eventPtr); parentXId = ParentXId(eventPtr->xany.display, handlerWindow); - if (parentXId == None) { + if (!parentXId) { return NULL; } winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, parentXId); - if (winPtr == NULL) { + if (!winPtr) { return NULL; } if (!(winPtr->flags & TK_PROP_PROPCHANGE)) { @@ -601,7 +601,7 @@ UpdateButtonEventState( case ButtonRelease: dispPtr = TkGetDisplay(eventPtr->xbutton.display); - dispPtr->mouseButtonWindow = None; + dispPtr->mouseButtonWindow = 0; dispPtr->mouseButtonState &= ~GetButtonMask(eventPtr->xbutton.button); eventPtr->xbutton.state |= dispPtr->mouseButtonState; break; @@ -617,7 +617,7 @@ UpdateButtonEventState( */ dispPtr->mouseButtonState &= ~allButtonsMask; - dispPtr->mouseButtonWindow = None; + dispPtr->mouseButtonWindow = 0; } else { eventPtr->xmotion.state |= dispPtr->mouseButtonState; } @@ -1192,7 +1192,7 @@ ParentXId( XFree(childList); } if (status == 0) { - parent = None; + parent = 0; } return parent; @@ -1365,7 +1365,7 @@ Tk_HandleEvent( * handle CreateNotify events, so we gotta pass 'em through. */ - if ((ip.winPtr != None) + if ((ip.winPtr) && ((mask != SubstructureNotifyMask) || (eventPtr->type == CreateNotify))) { TkBindEventProc(winPtr, eventPtr); @@ -1379,7 +1379,7 @@ Tk_HandleEvent( */ releaseInterpreter: - if (interp != NULL) { + if (interp) { Tcl_Release((ClientData) interp); } @@ -1427,7 +1427,7 @@ TkEventDeadWindow( * to quit (all of the handlers are being deleted). */ - while (winPtr->handlerList != NULL) { + while (winPtr->handlerList) { handlerPtr = winPtr->handlerList; winPtr->handlerList = handlerPtr->nextPtr; for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL; @@ -1436,7 +1436,7 @@ TkEventDeadWindow( ipPtr->nextHandler = NULL; } if (ipPtr->winPtr == winPtr) { - ipPtr->winPtr = None; + ipPtr->winPtr = 0; } } ckfree((char *) handlerPtr); diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 0c3c016..ef1338e 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -487,7 +487,7 @@ CreateFrame( */ className = colormapName = screenName = visualName = useOption = NULL; - colormap = None; + colormap = 0; for (i = 2; i < objc; i += 2) { arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { @@ -591,14 +591,14 @@ CreateFrame( if (visualName != NULL) { visual = Tk_GetVisual(interp, newWin, visualName, &depth, (colormapName == NULL) ? &colormap : NULL); - if (visual == NULL) { + if (!visual) { goto error; } Tk_SetWindowVisual(newWin, visual, depth, colormap); } - if (colormapName != NULL) { + if (colormapName) { colormap = Tk_GetColormap(interp, newWin, colormapName); - if (colormap == None) { + if (!colormap) { goto error; } Tk_SetWindowColormap(newWin, colormap); @@ -637,12 +637,12 @@ CreateFrame( framePtr->type = type; framePtr->colormap = colormap; framePtr->relief = TK_RELIEF_FLAT; - framePtr->cursor = None; + framePtr->cursor = 0; if (framePtr->type == TYPE_LABELFRAME) { Labelframe *labelframePtr = (Labelframe *) framePtr; labelframePtr->labelAnchor = LABELANCHOR_NW; - labelframePtr->textGC = None; + labelframePtr->textGC = 0; } /* @@ -840,11 +840,11 @@ DestroyFrame( if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); - if (labelframePtr->textGC != None) { + if (labelframePtr->textGC) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } } - if (framePtr->colormap != None) { + if (framePtr->colormap) { Tk_FreeColormap(framePtr->display, framePtr->colormap); } ckfree((char *) framePtr); @@ -967,7 +967,7 @@ ConfigureFrame( if (framePtr->border != NULL) { Tk_SetBackgroundFromBorder(framePtr->tkwin, framePtr->border); } else { - Tk_SetWindowBackgroundPixmap(framePtr->tkwin, None); + Tk_SetWindowBackgroundPixmap(framePtr->tkwin, 0); } if (framePtr->highlightWidth < 0) { @@ -1096,7 +1096,7 @@ FrameWorldChanged( gcValues.graphics_exposures = False; gc = Tk_GetGC(tkwin, GCForeground | GCFont | GCGraphicsExposures, &gcValues); - if (labelframePtr->textGC != None) { + if (labelframePtr->textGC) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } labelframePtr->textGC = gc; @@ -1528,8 +1528,8 @@ DisplayFrame( labelframePtr->labelTextX + LABELSPACING, labelframePtr->labelTextY + LABELSPACING, 0, -1); - if (clipRegion != NULL) { - XSetClipMask(framePtr->display, labelframePtr->textGC, None); + if (clipRegion) { + XSetClipMask(framePtr->display, labelframePtr->textGC, 0); TkDestroyRegion(clipRegion); } } else { diff --git a/generic/tkGC.c b/generic/tkGC.c index 800e4d3..c0864d0 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -155,12 +155,12 @@ Tk_GetGC( if (valueMask & GCTile) { valueKey.values.tile = valuePtr->tile; } else { - valueKey.values.tile = None; + valueKey.values.tile = 0; } if (valueMask & GCStipple) { valueKey.values.stipple = valuePtr->stipple; } else { - valueKey.values.stipple = None; + valueKey.values.stipple = 0; } if (valueMask & GCTileStipXOrigin) { valueKey.values.ts_x_origin = valuePtr->ts_x_origin; @@ -175,7 +175,7 @@ Tk_GetGC( if (valueMask & GCFont) { valueKey.values.font = valuePtr->font; } else { - valueKey.values.font = None; + valueKey.values.font = 0; } if (valueMask & GCSubwindowMode) { valueKey.values.subwindow_mode = valuePtr->subwindow_mode; @@ -200,7 +200,7 @@ Tk_GetGC( if (valueMask & GCClipMask) { valueKey.values.clip_mask = valuePtr->clip_mask; } else { - valueKey.values.clip_mask = None; + valueKey.values.clip_mask = 0; } if (valueMask & GCDashOffset) { valueKey.values.dash_offset = valuePtr->dash_offset; @@ -236,8 +236,8 @@ Tk_GetGC( * Tk_MakeWindowExist on the window. */ - freeDrawable = None; - if (Tk_WindowId(tkwin) != None) { + freeDrawable = 0; + if (Tk_WindowId(tkwin)) { d = Tk_WindowId(tkwin); } else if (valueKey.depth == DefaultDepth(valueKey.display, valueKey.screenNum)) { @@ -260,7 +260,7 @@ Tk_GetGC( } Tcl_SetHashValue(valueHashPtr, gcPtr); Tcl_SetHashValue(idHashPtr, gcPtr); - if (freeDrawable != None) { + if (freeDrawable) { Tk_FreePixmap(valueKey.display, freeDrawable); } diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 44a4f8c..3039ea0 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -468,8 +468,8 @@ Tk_Grab( for (numTries = 0; numTries < 10; numTries++) { grabResult = XGrabPointer(dispPtr->display, winPtr->window, True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask - |PointerMotionMask, GrabModeAsync, GrabModeAsync, None, - None, CurrentTime); + |PointerMotionMask, GrabModeAsync, GrabModeAsync, 0, + 0, CurrentTime); if (grabResult != AlreadyGrabbed) { break; } @@ -854,7 +854,7 @@ TkPointerEvent( if (XGrabPointer(dispPtr->display, dispPtr->grabWinPtr->window, True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask, - GrabModeAsync, GrabModeAsync, None, None, + GrabModeAsync, GrabModeAsync, 0, 0, CurrentTime) == 0) { EatGrabEvents(dispPtr, serial); if (XGrabKeyboard(dispPtr->display, winPtr->window, @@ -921,7 +921,7 @@ TkChangeEventWindow( Tk_GetRootCoords((Tk_Window) winPtr, &x, &y); eventPtr->xmotion.x = eventPtr->xmotion.x_root - x; eventPtr->xmotion.y = eventPtr->xmotion.y_root - y; - eventPtr->xmotion.subwindow = None; + eventPtr->xmotion.subwindow = 0; for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { if (childPtr->flags & TK_TOP_HIERARCHY) { @@ -940,7 +940,7 @@ TkChangeEventWindow( } else { eventPtr->xmotion.x = 0; eventPtr->xmotion.y = 0; - eventPtr->xmotion.subwindow = None; + eventPtr->xmotion.subwindow = 0; sameScreen = 0; } if (eventPtr->type == MotionNotify) { @@ -1029,7 +1029,7 @@ TkInOutEvents( */ #define QUEUE(w, t, d) \ - if (w->window != None) { \ + if (w->window) { \ eventPtr->type = t; \ if (focus) { \ eventPtr->xfocus.window = w->window; \ @@ -1145,9 +1145,9 @@ MovePointer2( TkWindow *winPtr; winPtr = sourcePtr; - if ((winPtr == NULL) || (winPtr->window == None)) { + if (!winPtr || !winPtr->window) { winPtr = destPtr; - if ((winPtr == NULL) || (winPtr->window == None)) { + if (!winPtr || !winPtr->window) { return; } } @@ -1338,7 +1338,7 @@ QueueGrabWindowChange( grabEvPtr->header.proc = GrabWinEventProc; grabEvPtr->dispPtr = dispPtr; if (grabWinPtr == NULL) { - grabEvPtr->grabWindow = None; + grabEvPtr->grabWindow = 0; } else { grabEvPtr->grabWindow = grabWinPtr->window; } diff --git a/generic/tkImage.c b/generic/tkImage.c index 6c7c9cd..99a1726 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -759,7 +759,7 @@ Tk_PostscriptImage( gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); - if (newGC != None) { + if (newGC) { XFillRectangle(Tk_Display(tkwin), pmap, newGC, 0, 0, (unsigned int)width, (unsigned int)height); Tk_FreeGC(Tk_Display(tkwin), newGC); @@ -772,7 +772,7 @@ Tk_PostscriptImage( Tk_FreePixmap(Tk_Display(tkwin), pmap); - if (ximage == NULL) { + if (!ximage) { /* * The XGetImage() function is apparently not implemented on this * system. Just ignore it. diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 4f5c6ac..4e0082a 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -381,9 +381,9 @@ ImgBmapConfigureInstance( */ oldBitmap = instancePtr->bitmap; - instancePtr->bitmap = None; + instancePtr->bitmap = 0; oldMask = instancePtr->mask; - instancePtr->mask = None; + instancePtr->mask = 0; if (masterPtr->data != NULL) { instancePtr->bitmap = XCreateBitmapFromData( @@ -400,21 +400,21 @@ ImgBmapConfigureInstance( (unsigned) masterPtr->height); } - if (oldMask != None) { + if (oldMask) { Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask); } - if (oldBitmap != None) { + if (oldBitmap) { Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap); } - if (masterPtr->data != NULL) { + if (masterPtr->data) { gcValues.foreground = instancePtr->fg->pixel; gcValues.graphics_exposures = False; mask = GCForeground|GCGraphicsExposures; - if (instancePtr->bg != NULL) { + if (instancePtr->bg) { gcValues.background = instancePtr->bg->pixel; mask |= GCBackground; - if (instancePtr->mask != None) { + if (instancePtr->mask) { gcValues.clip_mask = instancePtr->mask; mask |= GCClipMask; } @@ -424,9 +424,9 @@ ImgBmapConfigureInstance( } gc = Tk_GetGC(instancePtr->tkwin, mask, &gcValues); } else { - gc = None; + gc = 0; } - if (instancePtr->gc != None) { + if (instancePtr->gc) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } instancePtr->gc = gc; @@ -438,10 +438,10 @@ ImgBmapConfigureInstance( * it clear that this instance cannot be displayed. Then report the error. */ - if (instancePtr->gc != None) { + if (instancePtr->gc) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } - instancePtr->gc = None; + instancePtr->gc = 0; Tcl_AddErrorInfo(masterPtr->interp, "\n (while configuring image \""); Tcl_AddErrorInfo(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); Tcl_AddErrorInfo(masterPtr->interp, "\")"); @@ -834,9 +834,9 @@ ImgBmapGet( instancePtr->tkwin = tkwin; instancePtr->fg = NULL; instancePtr->bg = NULL; - instancePtr->bitmap = None; - instancePtr->mask = None; - instancePtr->gc = None; + instancePtr->bitmap = 0; + instancePtr->mask = 0; + instancePtr->gc = 0; instancePtr->nextPtr = masterPtr->instancePtr; masterPtr->instancePtr = instancePtr; ImgBmapConfigureInstance(instancePtr); @@ -890,7 +890,7 @@ ImgBmapDisplay( * creating the image instance so it can't be displayed. */ - if (instancePtr->gc == None) { + if (!instancePtr->gc) { return; } @@ -900,7 +900,7 @@ ImgBmapDisplay( * image and reset the clip origin, if there's a mask. */ - masking = (instancePtr->mask != None) || (instancePtr->bg == NULL); + masking = instancePtr->mask || !instancePtr->bg; if (masking) { XSetClipOrigin(display, instancePtr->gc, drawableX - imageX, drawableY - imageY); @@ -949,19 +949,19 @@ ImgBmapFree( * instance structure. */ - if (instancePtr->fg != NULL) { + if (instancePtr->fg) { Tk_FreeColor(instancePtr->fg); } - if (instancePtr->bg != NULL) { + if (instancePtr->bg) { Tk_FreeColor(instancePtr->bg); } - if (instancePtr->bitmap != None) { + if (instancePtr->bitmap) { Tk_FreePixmap(display, instancePtr->bitmap); } - if (instancePtr->mask != None) { + if (instancePtr->mask) { Tk_FreePixmap(display, instancePtr->mask); } - if (instancePtr->gc != None) { + if (instancePtr->gc) { Tk_FreeGC(display, instancePtr->gc); } if (instancePtr->masterPtr->instancePtr == instancePtr) { @@ -1000,17 +1000,17 @@ ImgBmapDelete( { BitmapMaster *masterPtr = (BitmapMaster *) masterData; - if (masterPtr->instancePtr != NULL) { + if (masterPtr->instancePtr) { Tcl_Panic("tried to delete bitmap image when instances still exist"); } masterPtr->tkMaster = NULL; - if (masterPtr->imageCmd != NULL) { + if (masterPtr->imageCmd) { Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd); } - if (masterPtr->data != NULL) { + if (masterPtr->data) { ckfree(masterPtr->data); } - if (masterPtr->maskData != NULL) { + if (masterPtr->maskData) { ckfree(masterPtr->maskData); } Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0); @@ -1042,7 +1042,7 @@ ImgBmapCmdDeletedProc( BitmapMaster *masterPtr = (BitmapMaster *) clientData; masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster != NULL) { + if (masterPtr->tkMaster) { Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); } } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 4e1aa01..d1503f6 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2285,7 +2285,7 @@ ImgPhotoConfigureInstance( * has the side effect of allocating a pixmap for us. */ - if ((instancePtr->pixels == None) || (instancePtr->error == NULL) + if (!instancePtr->pixels || !instancePtr->error || (instancePtr->width != masterPtr->width) || (instancePtr->height != masterPtr->height)) { ImgPhotoInstanceSetSize(instancePtr); @@ -2403,7 +2403,7 @@ ImgPhotoGet( Tk_PreserveColormap(instancePtr->display, instancePtr->colormap); instancePtr->refCount = 1; instancePtr->colorTablePtr = NULL; - instancePtr->pixels = None; + instancePtr->pixels = 0; instancePtr->error = NULL; instancePtr->width = 0; instancePtr->height = 0; @@ -2776,7 +2776,7 @@ ImgPhotoDisplay( * the image instance so it can't be displayed. */ - if (instancePtr->pixels == None) { + if (!instancePtr->pixels) { return; } @@ -2834,7 +2834,7 @@ ImgPhotoDisplay( XCopyArea(display, instancePtr->pixels, drawable, instancePtr->gc, imageX, imageY, (unsigned) width, (unsigned) height, drawableX, drawableY); - XSetClipMask(display, instancePtr->gc, None); + XSetClipMask(display, instancePtr->gc, 0); XSetClipOrigin(display, instancePtr->gc, 0, 0); } XFlush(display); @@ -3196,7 +3196,7 @@ ImgPhotoInstanceSetSize( if ((instancePtr->width != masterPtr->width) || (instancePtr->height != masterPtr->height) - || (instancePtr->pixels == None)) { + || !instancePtr->pixels) { newPixmap = Tk_GetPixmap(instancePtr->display, RootWindow(instancePtr->display, instancePtr->visualInfo.screen), @@ -3218,7 +3218,7 @@ ImgPhotoInstanceSetSize( TkSetPixmapColormap(newPixmap, instancePtr->colormap); - if (instancePtr->pixels != None) { + if (instancePtr->pixels) { /* * Copy any common pixels from the old pixmap and free it. */ @@ -3995,19 +3995,19 @@ DisposeInstance( PhotoInstance *instancePtr = (PhotoInstance *) clientData; PhotoInstance *prevPtr; - if (instancePtr->pixels != None) { + if (instancePtr->pixels) { Tk_FreePixmap(instancePtr->display, instancePtr->pixels); } - if (instancePtr->gc != None) { + if (instancePtr->gc) { Tk_FreeGC(instancePtr->display, instancePtr->gc); } - if (instancePtr->imagePtr != NULL) { + if (instancePtr->imagePtr) { XDestroyImage(instancePtr->imagePtr); } - if (instancePtr->error != NULL) { + if (instancePtr->error) { ckfree((char *) instancePtr->error); } - if (instancePtr->colorTablePtr != NULL) { + if (instancePtr->colorTablePtr) { FreeColorTable(instancePtr->colorTablePtr, 1); } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 86fb671..70e4e3c 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -534,15 +534,15 @@ Tk_ListboxObjCmd( 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 = 0; + listPtr->selFgColorPtr = 0; + listPtr->selTextGC = 0; listPtr->fullLines = 1; listPtr->xScrollUnit = 1; listPtr->exportSelection = 1; - listPtr->cursor = None; + listPtr->cursor = 0; listPtr->state = STATE_NORMAL; - listPtr->gray = None; + listPtr->gray = 0; /* * Keep a hold of the associated tkwin until we destroy the listbox, @@ -1474,13 +1474,13 @@ DestroyListbox( * Tk_FreeOptions handle all the standard option-related stuff. */ - if (listPtr->textGC != None) { + if (listPtr->textGC) { Tk_FreeGC(listPtr->display, listPtr->textGC); } - if (listPtr->selTextGC != None) { + if (listPtr->selTextGC) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } - if (listPtr->gray != None) { + if (listPtr->gray) { Tk_FreeBitmap(Tk_Display(listPtr->tkwin), listPtr->gray); } @@ -1765,10 +1765,10 @@ ListboxWorldChanged( } else { gcValues.foreground = listPtr->fgColorPtr->pixel; mask = GCForeground | GCFont; - if (listPtr->gray == None) { + if (!listPtr->gray) { listPtr->gray = Tk_GetBitmap(NULL, listPtr->tkwin, "gray50"); } - if (listPtr->gray != None) { + if (listPtr->gray) { gcValues.fill_style = FillStippled; gcValues.stipple = listPtr->gray; mask |= GCFillStyle | GCStipple; @@ -1777,18 +1777,18 @@ ListboxWorldChanged( gcValues.font = Tk_FontId(listPtr->tkfont); gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); - if (listPtr->textGC != None) { + if (listPtr->textGC) { Tk_FreeGC(listPtr->display, listPtr->textGC); } listPtr->textGC = gc; - if (listPtr->selFgColorPtr != NULL) { + if (listPtr->selFgColorPtr) { gcValues.foreground = listPtr->selFgColorPtr->pixel; } gcValues.font = Tk_FontId(listPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); - if (listPtr->selTextGC != None) { + if (listPtr->selTextGC) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } listPtr->selTextGC = gc; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index b35be24..fa14b7e 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -506,7 +506,7 @@ MenuCmd( Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, (ClientData) menuPtr, MenuCmdDeletedProc); menuPtr->active = -1; - menuPtr->cursorPtr = None; + menuPtr->cursorPtr = 0; menuPtr->masterMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; menuPtr->optionTablesPtr = optionTablesPtr; diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index c49f513..d26f83b 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->gray = None; - menuPtr->disabledGC = None; - menuPtr->activeGC = None; - menuPtr->indicatorGC = None; - menuPtr->disabledImageGC = None; + menuPtr->textGC = 0; + menuPtr->gray = 0; + menuPtr->disabledGC = 0; + menuPtr->activeGC = 0; + menuPtr->indicatorGC = 0; + menuPtr->disabledImageGC = 0; 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 = 0; + mePtr->activeGC = 0; + mePtr->disabledGC = 0; + mePtr->indicatorGC = 0; } /* @@ -106,22 +106,22 @@ void TkMenuFreeDrawOptions( TkMenu *menuPtr) { - if (menuPtr->textGC != None) { + if (menuPtr->textGC) { Tk_FreeGC(menuPtr->display, menuPtr->textGC); } - if (menuPtr->disabledImageGC != None) { + if (menuPtr->disabledImageGC) { Tk_FreeGC(menuPtr->display, menuPtr->disabledImageGC); } - if (menuPtr->gray != None) { + if (menuPtr->gray) { Tk_FreeBitmap(menuPtr->display, menuPtr->gray); } - if (menuPtr->disabledGC != None) { + if (menuPtr->disabledGC) { Tk_FreeGC(menuPtr->display, menuPtr->disabledGC); } - if (menuPtr->activeGC != None) { + if (menuPtr->activeGC) { Tk_FreeGC(menuPtr->display, menuPtr->activeGC); } - if (menuPtr->indicatorGC != None) { + if (menuPtr->indicatorGC) { Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC); } } @@ -147,16 +147,16 @@ void TkMenuEntryFreeDrawOptions( TkMenuEntry *mePtr) { - if (mePtr->textGC != None) { + if (mePtr->textGC) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->textGC); } - if (mePtr->disabledGC != None) { + if (mePtr->disabledGC) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->disabledGC); } - if (mePtr->activeGC != None) { + if (mePtr->activeGC) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->activeGC); } - if (mePtr->indicatorGC != None) { + if (mePtr->indicatorGC) { 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) { Tk_FreeGC(menuPtr->display, menuPtr->textGC); } menuPtr->textGC = newGC; @@ -222,34 +222,34 @@ TkMenuConfigureDrawOptions( } else { gcValues.foreground = gcValues.background; mask = GCForeground; - if (menuPtr->gray == None) { + if (!menuPtr->gray) { menuPtr->gray = Tk_GetBitmap(menuPtr->interp, menuPtr->tkwin, "gray50"); } - if (menuPtr->gray != None) { + if (menuPtr->gray) { gcValues.fill_style = FillStippled; gcValues.stipple = menuPtr->gray; mask = GCForeground|GCFillStyle|GCStipple; } } newGC = Tk_GetGC(menuPtr->tkwin, mask, &gcValues); - if (menuPtr->disabledGC != None) { + if (menuPtr->disabledGC) { Tk_FreeGC(menuPtr->display, menuPtr->disabledGC); } menuPtr->disabledGC = newGC; gcValues.foreground = Tk_3DBorderColor(border)->pixel; - if (menuPtr->gray == None) { + if (!menuPtr->gray) { menuPtr->gray = Tk_GetBitmap(menuPtr->interp, menuPtr->tkwin, "gray50"); } - if (menuPtr->gray != None) { + if (menuPtr->gray) { gcValues.fill_style = FillStippled; gcValues.stipple = menuPtr->gray; newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCFillStyle|GCStipple, &gcValues); } - if (menuPtr->disabledImageGC != None) { + if (menuPtr->disabledImageGC) { 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) { 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) { 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 = 0; + newActiveGC = 0; + newDisabledGC = 0; + newIndicatorGC = 0; } - if (mePtr->textGC != None) { + if (mePtr->textGC) { Tk_FreeGC(menuPtr->display, mePtr->textGC); } mePtr->textGC = newGC; - if (mePtr->activeGC != None) { + if (mePtr->activeGC) { Tk_FreeGC(menuPtr->display, mePtr->activeGC); } mePtr->activeGC = newActiveGC; - if (mePtr->disabledGC != None) { + if (mePtr->disabledGC) { Tk_FreeGC(menuPtr->display, mePtr->disabledGC); } mePtr->disabledGC = newDisabledGC; - if (mePtr->indicatorGC != None) { + if (mePtr->indicatorGC) { Tk_FreeGC(menuPtr->display, mePtr->indicatorGC); } mePtr->indicatorGC = newIndicatorGC; diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 94ac8b2..a24ab98 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -251,7 +251,7 @@ Tk_MenubuttonObjCmd( mbPtr->text = NULL; mbPtr->underline = -1; mbPtr->textVarName = NULL; - mbPtr->bitmap = None; + mbPtr->bitmap = 0; mbPtr->imageString = NULL; mbPtr->image = NULL; mbPtr->state = STATE_NORMAL; @@ -267,11 +267,11 @@ Tk_MenubuttonObjCmd( mbPtr->normalFg = NULL; mbPtr->activeFg = NULL; mbPtr->disabledFg = NULL; - mbPtr->normalTextGC = None; - mbPtr->activeTextGC = None; - mbPtr->gray = None; - mbPtr->disabledGC = None; - mbPtr->stippleGC = None; + mbPtr->normalTextGC = 0; + mbPtr->activeTextGC = 0; + mbPtr->gray = 0; + mbPtr->disabledGC = 0; + mbPtr->stippleGC = 0; mbPtr->leftBearing = 0; mbPtr->rightBearing = 0; mbPtr->widthString = NULL; @@ -288,7 +288,7 @@ Tk_MenubuttonObjCmd( mbPtr->indicatorWidth = 0; mbPtr->indicatorHeight = 0; mbPtr->direction = DIRECTION_FLUSH; - mbPtr->cursor = None; + mbPtr->cursor = 0; mbPtr->takeFocus = NULL; mbPtr->flags = 0; @@ -433,22 +433,22 @@ DestroyMenuButton( if (mbPtr->image != NULL) { Tk_FreeImage(mbPtr->image); } - if (mbPtr->normalTextGC != None) { + if (mbPtr->normalTextGC) { Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC); } - if (mbPtr->activeTextGC != None) { + if (mbPtr->activeTextGC) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } - if (mbPtr->disabledGC != None) { + if (mbPtr->disabledGC) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } - if (mbPtr->stippleGC != None) { + if (mbPtr->stippleGC) { Tk_FreeGC(mbPtr->display, mbPtr->stippleGC); } - if (mbPtr->gray != None) { + if (mbPtr->gray) { Tk_FreeBitmap(mbPtr->display, mbPtr->gray); } - if (mbPtr->textLayout != NULL) { + if (mbPtr->textLayout) { Tk_FreeTextLayout(mbPtr->textLayout); } Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, mbPtr->tkwin); @@ -578,7 +578,7 @@ ConfigureMenuButton( * Recompute the geometry for the button. */ - if ((mbPtr->bitmap != None) || (mbPtr->image != NULL)) { + if (mbPtr->bitmap || mbPtr->image) { if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->widthString, &mbPtr->width) != TCL_OK) { widthError: @@ -683,7 +683,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) { Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC); } mbPtr->normalTextGC = gc; @@ -692,7 +692,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) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } mbPtr->activeTextGC = gc; @@ -703,13 +703,13 @@ TkMenuButtonWorldChanged( * Create the GC that can be used for stippling */ - if (mbPtr->stippleGC == None) { + if (!mbPtr->stippleGC) { gcValues.foreground = gcValues.background; mask = GCForeground; - if (mbPtr->gray == None) { + if (!mbPtr->gray) { mbPtr->gray = Tk_GetBitmap(NULL, mbPtr->tkwin, "gray50"); } - if (mbPtr->gray != None) { + if (mbPtr->gray) { gcValues.fill_style = FillStippled; gcValues.stipple = mbPtr->gray; mask |= GCFillStyle | GCStipple; @@ -723,13 +723,13 @@ TkMenuButtonWorldChanged( */ mask = GCForeground | GCBackground | GCFont; - if (mbPtr->disabledFg != NULL) { + if (mbPtr->disabledFg) { gcValues.foreground = mbPtr->disabledFg->pixel; } else { gcValues.foreground = gcValues.background; } gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->disabledGC != None) { + if (mbPtr->disabledGC) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } mbPtr->disabledGC = gc; diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 0fd57a9..9cfa593 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -254,11 +254,11 @@ Tk_MessageObjCmd( (ClientData) msgPtr, MessageCmdDeletedProc); msgPtr->optionTable = optionTable; msgPtr->relief = TK_RELIEF_FLAT; - msgPtr->textGC = None; + msgPtr->textGC = 0; msgPtr->anchor = TK_ANCHOR_CENTER; msgPtr->aspect = 150; msgPtr->justify = TK_JUSTIFY_LEFT; - msgPtr->cursor = None; + msgPtr->cursor = 0; Tk_SetClass(msgPtr->tkwin, "Message"); Tk_SetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr); @@ -396,13 +396,13 @@ DestroyMessage( * Tk_FreeConfigOptions handle all the standard option-related stuff. */ - if (msgPtr->textGC != None) { + if (msgPtr->textGC) { Tk_FreeGC(msgPtr->display, msgPtr->textGC); } - if (msgPtr->textLayout != NULL) { + if (msgPtr->textLayout) { Tk_FreeTextLayout(msgPtr->textLayout); } - if (msgPtr->textVarName != NULL) { + if (msgPtr->textVarName) { Tcl_UntraceVar(msgPtr->interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, (ClientData) msgPtr); @@ -469,7 +469,7 @@ ConfigureMessage( CONST char *value; value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY); - if (value == NULL) { + if (!value) { Tcl_SetVar(interp, msgPtr->textVarName, msgPtr->string, TCL_GLOBAL_ONLY); } else { @@ -523,20 +523,20 @@ MessageWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = None; + GC gc = 0; Tk_FontMetrics fm; Message *msgPtr; msgPtr = (Message *) instanceData; - if (msgPtr->border != NULL) { + if (msgPtr->border) { Tk_SetBackgroundFromBorder(msgPtr->tkwin, msgPtr->border); } 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) { Tk_FreeGC(msgPtr->display, msgPtr->textGC); } msgPtr->textGC = gc; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index d7a33f7..955b3e0 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -431,16 +431,16 @@ DoConfig( Pixmap newBmp, oldBmp; if (nullValue) { - newBmp = None; + newBmp = 0; } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newBmp = Tk_GetBitmap(interp, tkwin, uid); - if (newBmp == None) { + if (!newBmp) { return TCL_ERROR; } } oldBmp = *((Pixmap *) ptr); - if (oldBmp != None) { + if (oldBmp) { Tk_FreeBitmap(Tk_Display(tkwin), oldBmp); } *((Pixmap *) ptr) = newBmp; @@ -454,12 +454,12 @@ DoConfig( } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newBorder = Tk_Get3DBorder(interp, tkwin, uid); - if (newBorder == NULL) { + if (!newBorder) { return TCL_ERROR; } } oldBorder = *((Tk_3DBorder *) ptr); - if (oldBorder != NULL) { + if (oldBorder) { Tk_Free3DBorder(oldBorder); } *((Tk_3DBorder *) ptr) = newBorder; @@ -476,16 +476,16 @@ DoConfig( Tk_Cursor newCursor, oldCursor; if (nullValue) { - newCursor = None; + newCursor = 0; } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newCursor = Tk_GetCursor(interp, tkwin, uid); - if (newCursor == None) { + if (!newCursor) { return TCL_ERROR; } } oldCursor = *((Tk_Cursor *) ptr); - if (oldCursor != None) { + if (oldCursor) { Tk_FreeCursor(Tk_Display(tkwin), oldCursor); } *((Tk_Cursor *) ptr) = newCursor; @@ -794,7 +794,7 @@ FormatConfigValue( case TK_CONFIG_UID: { Tk_Uid uid = *((Tk_Uid *) ptr); - if (uid != NULL) { + if (uid) { result = uid; } break; @@ -802,7 +802,7 @@ FormatConfigValue( case TK_CONFIG_COLOR: { XColor *colorPtr = *((XColor **) ptr); - if (colorPtr != NULL) { + if (colorPtr) { result = Tk_NameOfColor(colorPtr); } break; @@ -810,7 +810,7 @@ FormatConfigValue( case TK_CONFIG_FONT: { Tk_Font tkfont = *((Tk_Font *) ptr); - if (tkfont != NULL) { + if (tkfont) { result = Tk_NameOfFont(tkfont); } break; @@ -818,7 +818,7 @@ FormatConfigValue( case TK_CONFIG_BITMAP: { Pixmap pixmap = *((Pixmap *) ptr); - if (pixmap != None) { + if (pixmap) { result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); } break; @@ -826,7 +826,7 @@ FormatConfigValue( case TK_CONFIG_BORDER: { Tk_3DBorder border = *((Tk_3DBorder *) ptr); - if (border != NULL) { + if (border) { result = Tk_NameOf3DBorder(border); } break; @@ -838,7 +838,7 @@ FormatConfigValue( case TK_CONFIG_ACTIVE_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) ptr); - if (cursor != None) { + if (cursor) { result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); } break; @@ -995,7 +995,7 @@ Tk_FreeOptions( ptr = widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_STRING: - if (*((char **) ptr) != NULL) { + if (*((char **) ptr)) { ckfree(*((char **) ptr)); *((char **) ptr) = NULL; } @@ -1011,22 +1011,22 @@ Tk_FreeOptions( *((Tk_Font *) ptr) = NULL; break; case TK_CONFIG_BITMAP: - if (*((Pixmap *) ptr) != None) { + if (*((Pixmap *) ptr)) { Tk_FreeBitmap(display, *((Pixmap *) ptr)); - *((Pixmap *) ptr) = None; + *((Pixmap *) ptr) = 0; } break; case TK_CONFIG_BORDER: - if (*((Tk_3DBorder *) ptr) != NULL) { + if (*((Tk_3DBorder *) ptr)) { Tk_Free3DBorder(*((Tk_3DBorder *) ptr)); *((Tk_3DBorder *) ptr) = NULL; } break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: - if (*((Tk_Cursor *) ptr) != None) { + if (*((Tk_Cursor *) ptr)) { Tk_FreeCursor(display, *((Tk_Cursor *) ptr)); - *((Tk_Cursor *) ptr) = None; + *((Tk_Cursor *) ptr) = 0; } } } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 99ed179..f37892c 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 = 0; + pwPtr->cursor = 0; + pwPtr->sashCursor = 0; /* * Keep a hold of the associated tkwin until we destroy the widget, @@ -859,7 +859,7 @@ ConfigureSlaves( index = -1; haveLoc = 0; - if (options.after != None) { + if (options.after) { tkwin = options.after; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -868,7 +868,7 @@ ConfigureSlaves( break; } } - } else if (options.before != None) { + } else if (options.before) { tkwin = options.before; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -1299,7 +1299,7 @@ PanedWindowWorldChanged( gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel; newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues); - if (pwPtr->gc != None) { + if (pwPtr->gc) { Tk_FreeGC(pwPtr->display, pwPtr->gc); } pwPtr->gc = newGC; @@ -2018,10 +2018,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 = 0; } if (masterPtr->slaves[i]->after == slavePtr->tkwin) { - masterPtr->slaves[i]->after = None; + masterPtr->slaves[i]->after = 0; } } diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 2f527ba..c435b12 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -397,7 +397,7 @@ CreateSlave( slavePtr = (Slave *) ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); slavePtr->tkwin = tkwin; - slavePtr->inTkwin = None; + slavePtr->inTkwin = 0; slavePtr->anchor = TK_ANCHOR_NW; slavePtr->borderMode = BM_INSIDE; slavePtr->optionTable = table; diff --git a/generic/tkPointer.c b/generic/tkPointer.c index dd4f7e6..00e1328 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -179,14 +179,13 @@ GenerateEnterLeave( } else { TkWindow *targetPtr; - if ((lastWinPtr == NULL) - || (lastWinPtr->window == None)) { + if (!lastWinPtr || !lastWinPtr->window) { targetPtr = winPtr; } else { targetPtr = lastWinPtr; } - if (targetPtr && (targetPtr->window != None)) { + if (targetPtr && targetPtr->window) { XEvent event; /* @@ -540,7 +539,7 @@ static void UpdateCursor( TkWindow *winPtr) { - Cursor cursor = None; + Cursor cursor = 0; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -550,8 +549,8 @@ UpdateCursor( */ tsdPtr->cursorWinPtr = winPtr; - while (winPtr != NULL) { - if (winPtr->atts.cursor != None) { + while (winPtr) { + if (winPtr->atts.cursor) { cursor = winPtr->atts.cursor; break; } else if (winPtr->flags & TK_TOP_HIERARCHY) { diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index c9cd7cb..6ed4488 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -259,10 +259,10 @@ CreateRectOval( rectOvalPtr->fillColor = NULL; rectOvalPtr->activeFillColor = NULL; rectOvalPtr->disabledFillColor = NULL; - rectOvalPtr->fillStipple = None; - rectOvalPtr->activeFillStipple = None; - rectOvalPtr->disabledFillStipple = None; - rectOvalPtr->fillGC = None; + rectOvalPtr->fillStipple = 0; + rectOvalPtr->activeFillStipple = 0; + rectOvalPtr->disabledFillStipple = 0; + rectOvalPtr->fillGC = 0; /* * Process the arguments to fill in the item record. @@ -429,11 +429,11 @@ ConfigureRectOval( */ if (rectOvalPtr->outline.activeWidth > rectOvalPtr->outline.width || - rectOvalPtr->outline.activeDash.number != 0 || - rectOvalPtr->outline.activeColor != NULL || - rectOvalPtr->outline.activeStipple != None || - rectOvalPtr->activeFillColor != NULL || - rectOvalPtr->activeFillStipple != None) { + rectOvalPtr->outline.activeDash.number || + rectOvalPtr->outline.activeColor || + rectOvalPtr->outline.activeStipple || + rectOvalPtr->activeFillColor || + rectOvalPtr->activeFillStipple) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -467,15 +467,15 @@ ConfigureRectOval( mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(rectOvalPtr->outline)); if (mask && \ - rectOvalPtr->outline.width != 0 && \ - rectOvalPtr->outline.color != NULL) { + rectOvalPtr->outline.width && \ + rectOvalPtr->outline.color) { gcValues.cap_style = CapProjecting; mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = None; + newGC = 0; } - if (rectOvalPtr->outline.gc != None) { + if (rectOvalPtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->outline.gc); } rectOvalPtr->outline.gc = newGC; @@ -494,23 +494,23 @@ ConfigureRectOval( if (rectOvalPtr->activeFillColor!=NULL) { color = rectOvalPtr->activeFillColor; } - if (rectOvalPtr->activeFillStipple!=None) { + if (rectOvalPtr->activeFillStipple) { stipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { - if (rectOvalPtr->disabledFillColor!=NULL) { + if (rectOvalPtr->disabledFillColor) { color = rectOvalPtr->disabledFillColor; } - if (rectOvalPtr->disabledFillStipple!=None) { + if (rectOvalPtr->disabledFillStipple) { stipple = rectOvalPtr->disabledFillStipple; } } - if (color == NULL) { - newGC = None; + if (!color) { + newGC = 0; } else { gcValues.foreground = color->pixel; - if (stipple != None) { + if (stipple) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask = GCForeground|GCStipple|GCFillStyle; @@ -528,7 +528,7 @@ ConfigureRectOval( #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (rectOvalPtr->fillGC != None) { + if (rectOvalPtr->fillGC) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->fillGC); } rectOvalPtr->fillGC = newGC; @@ -583,25 +583,25 @@ DeleteRectOval( RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; Tk_DeleteOutline(display, &(rectOvalPtr->outline)); - if (rectOvalPtr->fillColor != NULL) { + if (rectOvalPtr->fillColor) { Tk_FreeColor(rectOvalPtr->fillColor); } - if (rectOvalPtr->activeFillColor != NULL) { + if (rectOvalPtr->activeFillColor) { Tk_FreeColor(rectOvalPtr->activeFillColor); } - if (rectOvalPtr->disabledFillColor != NULL) { + if (rectOvalPtr->disabledFillColor) { Tk_FreeColor(rectOvalPtr->disabledFillColor); } - if (rectOvalPtr->fillStipple != None) { + if (rectOvalPtr->fillStipple) { Tk_FreeBitmap(display, rectOvalPtr->fillStipple); } - if (rectOvalPtr->activeFillStipple != None) { + if (rectOvalPtr->activeFillStipple) { Tk_FreeBitmap(display, rectOvalPtr->activeFillStipple); } - if (rectOvalPtr->disabledFillStipple != None) { + if (rectOvalPtr->disabledFillStipple) { Tk_FreeBitmap(display, rectOvalPtr->disabledFillStipple); } - if (rectOvalPtr->fillGC != None) { + if (rectOvalPtr->fillGC) { Tk_FreeGC(display, rectOvalPtr->fillGC); } } @@ -670,7 +670,7 @@ ComputeRectOvalBbox( rectOvalPtr->bbox[0] = tmpX; } - if (rectOvalPtr->outline.gc == None) { + if (!rectOvalPtr->outline.gc) { /* * 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 @@ -783,17 +783,17 @@ DisplayRectOval( } fillStipple = rectOvalPtr->fillStipple; if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)rectOvalPtr) { - if (rectOvalPtr->activeFillStipple != None) { + if (rectOvalPtr->activeFillStipple) { fillStipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { - if (rectOvalPtr->disabledFillStipple != None) { + if (rectOvalPtr->disabledFillStipple) { fillStipple = rectOvalPtr->disabledFillStipple; } } - if (rectOvalPtr->fillGC != None) { - if (fillStipple != None) { + if (rectOvalPtr->fillGC) { + if (fillStipple) { Tk_TSOffset *tsoffset; int w = 0, h = 0; @@ -831,12 +831,12 @@ DisplayRectOval( x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), 0, 360*64); } - if (fillStipple != None) { + if (fillStipple) { XSetTSOrigin(display, rectOvalPtr->fillGC, 0, 0); } } - if (rectOvalPtr->outline.gc != None) { + if (rectOvalPtr->outline.gc) { Tk_ChangeOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline)); if (rectOvalPtr->header.typePtr == &tkRectangleType) { XDrawRectangle(display, drawable, rectOvalPtr->outline.gc, @@ -907,7 +907,7 @@ RectToPoint( y1 = rectPtr->bbox[1]; x2 = rectPtr->bbox[2]; y2 = rectPtr->bbox[3]; - if (rectPtr->outline.gc != None) { + if (rectPtr->outline.gc) { inc = width/2.0; x1 -= inc; y1 -= inc; @@ -923,7 +923,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 || !rectPtr->outline.gc) { return 0.0; } xDiff = pointPtr[0] - x1; @@ -1019,8 +1019,8 @@ OvalToPoint( } - filled = ovalPtr->fillGC != None; - if (ovalPtr->outline.gc == None) { + filled = ovalPtr->fillGC != 0; + if (!ovalPtr->outline.gc) { width = 0.0; filled = 1; } @@ -1075,7 +1075,7 @@ RectToArea( } halfWidth = width/2.0; - if (rectPtr->outline.gc == None) { + if (!rectPtr->outline.gc) { halfWidth = 0.0; } @@ -1085,7 +1085,7 @@ RectToArea( || (areaPtr[1] >= (rectPtr->bbox[3] + halfWidth))) { return -1; } - if ((rectPtr->fillGC == None) && (rectPtr->outline.gc != None) + if (!rectPtr->fillGC && rectPtr->outline.gc && (areaPtr[0] >= (rectPtr->bbox[0] + halfWidth)) && (areaPtr[1] >= (rectPtr->bbox[1] + halfWidth)) && (areaPtr[2] <= (rectPtr->bbox[2] - halfWidth)) @@ -1154,7 +1154,7 @@ OvalToArea( */ halfWidth = width/2.0; - if (ovalPtr->outline.gc == None) { + if (!ovalPtr->outline.gc) { halfWidth = 0.0; } oval[0] = ovalPtr->bbox[0] - halfWidth; @@ -1171,8 +1171,8 @@ OvalToArea( * return "outside". */ - if ((result == 0) && (ovalPtr->outline.gc != None) - && (ovalPtr->fillGC == None)) { + if ((result == 0) && ovalPtr->outline.gc + && !ovalPtr->fillGC) { double centerX, centerY, height; double xDelta1, yDelta1, xDelta2, yDelta2; @@ -1335,20 +1335,20 @@ RectOvalToPostscript( if (rectOvalPtr->outline.activeColor!=NULL) { color = rectOvalPtr->outline.activeColor; } - if (rectOvalPtr->activeFillColor!=NULL) { + if (rectOvalPtr->activeFillColor) { fillColor = rectOvalPtr->activeFillColor; } - if (rectOvalPtr->activeFillStipple!=None) { + if (rectOvalPtr->activeFillStipple) { fillStipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { if (rectOvalPtr->outline.disabledColor!=NULL) { color = rectOvalPtr->outline.disabledColor; } - if (rectOvalPtr->disabledFillColor!=NULL) { + if (rectOvalPtr->disabledFillColor) { fillColor = rectOvalPtr->disabledFillColor; } - if (rectOvalPtr->disabledFillStipple!=None) { + if (rectOvalPtr->disabledFillStipple) { fillStipple = rectOvalPtr->disabledFillStipple; } } @@ -1357,12 +1357,12 @@ RectOvalToPostscript( * First draw the filled area of the rectangle. */ - if (fillColor != NULL) { + if (fillColor) { Tcl_AppendResult(interp, pathCmd, NULL); if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) { return TCL_ERROR; } - if (fillStipple != None) { + if (fillStipple) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) { return TCL_ERROR; @@ -1379,7 +1379,7 @@ RectOvalToPostscript( * Now draw the outline, if there is one. */ - if (color != NULL) { + if (color) { Tcl_AppendResult(interp, pathCmd, "0 setlinejoin 2 setlinecap\n", NULL); if (Tk_CanvasPsOutline(canvas, itemPtr, diff --git a/generic/tkScale.c b/generic/tkScale.c index 69a7d91..32cb1b2 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -264,11 +264,11 @@ Tk_ScaleObjCmd( scalePtr->activeBorder = NULL; scalePtr->sliderRelief = TK_RELIEF_RAISED; scalePtr->troughColorPtr = NULL; - scalePtr->troughGC = None; - scalePtr->copyGC = None; + scalePtr->troughGC = 0; + scalePtr->copyGC = 0; scalePtr->tkfont = NULL; scalePtr->textColorPtr = NULL; - scalePtr->textGC = None; + scalePtr->textGC = 0; scalePtr->relief = TK_RELIEF_FLAT; scalePtr->highlightWidth = 0; scalePtr->highlightBorder = NULL; @@ -285,7 +285,7 @@ Tk_ScaleObjCmd( scalePtr->vertTroughX = 0; scalePtr->vertLabelX = 0; scalePtr->fontHeight = 0; - scalePtr->cursor = None; + scalePtr->cursor = 0; scalePtr->takeFocusPtr = NULL; scalePtr->flags = NEVER_SET; @@ -514,13 +514,13 @@ DestroyScale( TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, (ClientData) scalePtr); } - if (scalePtr->troughGC != None) { + if (scalePtr->troughGC) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); } - if (scalePtr->copyGC != None) { + if (scalePtr->copyGC) { Tk_FreeGC(scalePtr->display, scalePtr->copyGC); } - if (scalePtr->textGC != None) { + if (scalePtr->textGC) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } Tk_FreeConfigOptions((char *) scalePtr, scalePtr->optionTable, @@ -727,7 +727,7 @@ ScaleWorldChanged( gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); - if (scalePtr->troughGC != None) { + if (scalePtr->troughGC) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); } scalePtr->troughGC = gc; @@ -735,12 +735,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) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } scalePtr->textGC = gc; - if (scalePtr->copyGC == None) { + if (!scalePtr->copyGC) { gcValues.graphics_exposures = False; scalePtr->copyGC = Tk_GetGC(scalePtr->tkwin, GCGraphicsExposures, &gcValues); diff --git a/generic/tkScale.h b/generic/tkScale.h index a2c5f2b..a19695f 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -78,7 +78,7 @@ typedef struct TkScale { * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ - char format[10]; /* Sprintf conversion specifier computed from + char format[16]; /* Sprintf conversion specifier computed from * digits and other information. */ double bigIncrement; /* Amount to use for large increments to scale * value. (0 means we pick a value). */ diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index ba42c20..67fdd2b 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -188,7 +188,7 @@ Tk_ScrollbarCmd( scrollPtr->lastUnit = 0; scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; - scrollPtr->cursor = None; + scrollPtr->cursor = 0; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 7c96b94..2f74172 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -130,7 +130,7 @@ Tk_CreateSelHandler( register TkSelHandler *selPtr; TkWindow *winPtr = (TkWindow *) tkwin; - if (winPtr->dispPtr->multipleAtom == None) { + if (!winPtr->dispPtr->multipleAtom) { TkSelInit(tkwin); } @@ -362,7 +362,7 @@ Tk_OwnSelection( ClientData clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ - if (dispPtr->multipleAtom == None) { + if (!dispPtr->multipleAtom) { TkSelInit(tkwin); } Tk_MakeWindowExist(tkwin); @@ -471,7 +471,7 @@ Tk_ClearSelection( ClientData clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ - if (dispPtr->multipleAtom == None) { + if (!dispPtr->multipleAtom) { TkSelInit(tkwin); } @@ -494,7 +494,7 @@ Tk_ClearSelection( clearData = infoPtr->clearData; ckfree((char *) infoPtr); } - XSetSelectionOwner(winPtr->display, selection, None, CurrentTime); + XSetSelectionOwner(winPtr->display, selection, 0, CurrentTime); if (clearProc != NULL) { (*clearProc)(clearData); @@ -561,7 +561,7 @@ Tk_GetSelection( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - if (dispPtr->multipleAtom == None) { + if (!dispPtr->multipleAtom) { TkSelInit(tkwin); } diff --git a/generic/tkSquare.c b/generic/tkSquare.c index a35832a..305d756 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -166,7 +166,7 @@ SquareObjCmd( squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, (ClientData) squarePtr, SquareDeletedProc); - squarePtr->gc = None; + squarePtr->gc = 0; squarePtr->optionTable = optionTable; if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin) @@ -332,7 +332,7 @@ SquareConfigure( Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); - if ((squarePtr->gc == None) && (doubleBuffer)) { + if (!squarePtr->gc && doubleBuffer) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; @@ -394,10 +394,10 @@ SquareObjEventProc( squarePtr->updatePending = 1; } } else if (eventPtr->type == DestroyNotify) { - if (squarePtr->tkwin != NULL) { + if (squarePtr->tkwin) { Tk_FreeConfigOptions((char *) squarePtr, squarePtr->optionTable, squarePtr->tkwin); - if (squarePtr->gc != None) { + if (squarePtr->gc) { Tk_FreeGC(squarePtr->display, squarePtr->gc); } squarePtr->tkwin = NULL; @@ -472,7 +472,7 @@ SquareDisplay( { Square *squarePtr = (Square *) clientData; Tk_Window tkwin = squarePtr->tkwin; - Pixmap pm = None; + Pixmap pm = 0; Drawable d; int borderWidth, size, relief; Tk_3DBorder bgBorder, fgBorder; diff --git a/generic/tkTest.c b/generic/tkTest.c index d06769d..8f54781 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -1047,7 +1047,7 @@ TestobjconfigObjCmd( recordPtr->index = 0; recordPtr->colorPtr = NULL; recordPtr->tkfont = NULL; - recordPtr->bitmap = None; + recordPtr->bitmap = 0; recordPtr->border = NULL; recordPtr->relief = TK_RELIEF_FLAT; recordPtr->cursor = NULL; @@ -1985,7 +1985,7 @@ TestpropCmd( w, propName, 0, 100000, False, AnyPropertyType, &actualType, &actualFormat, &length, &bytesAfter, &property); - if ((result == Success) && (actualType != None)) { + if ((result == Success) && actualType) { if ((actualFormat == 8) && (actualType == XA_STRING)) { for (p = property; ((unsigned long)(p-property)) < length; p++) { if (*p == 0) { diff --git a/generic/tkText.c b/generic/tkText.c index 8edf82d..425687f 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -568,7 +568,7 @@ CreateWidget( textPtr->state = TK_TEXT_STATE_NORMAL; textPtr->relief = TK_RELIEF_FLAT; - textPtr->cursor = None; + textPtr->cursor = 0; textPtr->charWidth = 1; textPtr->charHeight = 10; textPtr->wrapMode = TEXT_WRAPMODE_CHAR; @@ -2186,28 +2186,28 @@ ConfigureText( textPtr->selTagPtr->fgColor = textPtr->selFgColorPtr; textPtr->selTagPtr->affectsDisplay = 0; textPtr->selTagPtr->affectsDisplayGeometry = 0; - if ((textPtr->selTagPtr->elideString != NULL) - || (textPtr->selTagPtr->tkfont != None) - || (textPtr->selTagPtr->justifyString != NULL) - || (textPtr->selTagPtr->lMargin1String != NULL) - || (textPtr->selTagPtr->lMargin2String != NULL) - || (textPtr->selTagPtr->offsetString != NULL) - || (textPtr->selTagPtr->rMarginString != NULL) - || (textPtr->selTagPtr->spacing1String != NULL) - || (textPtr->selTagPtr->spacing2String != NULL) - || (textPtr->selTagPtr->spacing3String != NULL) - || (textPtr->selTagPtr->tabStringPtr != NULL) + if (textPtr->selTagPtr->elideString + || textPtr->selTagPtr->tkfont + || textPtr->selTagPtr->justifyString + || textPtr->selTagPtr->lMargin1String + || textPtr->selTagPtr->lMargin2String + || textPtr->selTagPtr->offsetString + || textPtr->selTagPtr->rMarginString + || textPtr->selTagPtr->spacing1String + || textPtr->selTagPtr->spacing2String + || textPtr->selTagPtr->spacing3String + || textPtr->selTagPtr->tabStringPtr || (textPtr->selTagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { textPtr->selTagPtr->affectsDisplay = 1; textPtr->selTagPtr->affectsDisplayGeometry = 1; } - if ((textPtr->selTagPtr->border != NULL) - || (textPtr->selTagPtr->reliefString != NULL) - || (textPtr->selTagPtr->bgStipple != None) - || (textPtr->selTagPtr->fgColor != NULL) - || (textPtr->selTagPtr->fgStipple != None) - || (textPtr->selTagPtr->overstrikeString != NULL) - || (textPtr->selTagPtr->underlineString != NULL)) { + if (textPtr->selTagPtr->border + || textPtr->selTagPtr->reliefString + || textPtr->selTagPtr->bgStipple + || textPtr->selTagPtr->fgColor + || textPtr->selTagPtr->fgStipple + || textPtr->selTagPtr->overstrikeString + || textPtr->selTagPtr->underlineString) { textPtr->selTagPtr->affectsDisplay = 1; } TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1); diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 1f39112..cc304de 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -632,7 +632,7 @@ TkTextCreateDInfo( dInfoPtr = (TextDInfo *) ckalloc(sizeof(TextDInfo)); Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int)); dInfoPtr->dLinePtr = NULL; - dInfoPtr->copyGC = None; + dInfoPtr->copyGC = 0; gcValues.graphics_exposures = True; dInfoPtr->scrollGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); @@ -696,19 +696,19 @@ TkTextFreeDInfo( FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK); Tcl_DeleteHashTable(&dInfoPtr->styleTable); - if (dInfoPtr->copyGC != None) { + if (dInfoPtr->copyGC) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC); if (dInfoPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayText, (ClientData) textPtr); } - if (dInfoPtr->lineUpdateTimer != NULL) { + if (dInfoPtr->lineUpdateTimer) { Tcl_DeleteTimerHandler(dInfoPtr->lineUpdateTimer); textPtr->refCount--; dInfoPtr->lineUpdateTimer = NULL; } - if (dInfoPtr->scrollbarTimer != NULL) { + if (dInfoPtr->scrollbarTimer) { Tcl_DeleteTimerHandler(dInfoPtr->scrollbarTimer); textPtr->refCount--; dInfoPtr->scrollbarTimer = NULL; @@ -827,70 +827,70 @@ GetStyle( styleValues.relief = tagPtr->relief; reliefPrio = tagPtr->priority; } - if ((tagPtr->bgStipple != None) + if ((tagPtr->bgStipple) && (tagPtr->priority > bgStipplePrio)) { styleValues.bgStipple = tagPtr->bgStipple; bgStipplePrio = tagPtr->priority; } - if ((tagPtr->fgColor != None) && (tagPtr->priority > fgPrio)) { + if ((tagPtr->fgColor) && (tagPtr->priority > fgPrio)) { styleValues.fgColor = tagPtr->fgColor; fgPrio = tagPtr->priority; } - if ((tagPtr->tkfont != None) && (tagPtr->priority > fontPrio)) { + if ((tagPtr->tkfont) && (tagPtr->priority > fontPrio)) { styleValues.tkfont = tagPtr->tkfont; fontPrio = tagPtr->priority; } - if ((tagPtr->fgStipple != None) + if ((tagPtr->fgStipple) && (tagPtr->priority > fgStipplePrio)) { styleValues.fgStipple = tagPtr->fgStipple; fgStipplePrio = tagPtr->priority; } - if ((tagPtr->justifyString != NULL) + if ((tagPtr->justifyString) && (tagPtr->priority > justifyPrio)) { styleValues.justify = tagPtr->justify; justifyPrio = tagPtr->priority; } - if ((tagPtr->lMargin1String != NULL) + if ((tagPtr->lMargin1String) && (tagPtr->priority > lMargin1Prio)) { styleValues.lMargin1 = tagPtr->lMargin1; lMargin1Prio = tagPtr->priority; } - if ((tagPtr->lMargin2String != NULL) + if ((tagPtr->lMargin2String) && (tagPtr->priority > lMargin2Prio)) { styleValues.lMargin2 = tagPtr->lMargin2; lMargin2Prio = tagPtr->priority; } - if ((tagPtr->offsetString != NULL) + if ((tagPtr->offsetString) && (tagPtr->priority > offsetPrio)) { styleValues.offset = tagPtr->offset; offsetPrio = tagPtr->priority; } - if ((tagPtr->overstrikeString != NULL) + if ((tagPtr->overstrikeString) && (tagPtr->priority > overstrikePrio)) { styleValues.overstrike = tagPtr->overstrike; overstrikePrio = tagPtr->priority; } - if ((tagPtr->rMarginString != NULL) + if ((tagPtr->rMarginString) && (tagPtr->priority > rMarginPrio)) { styleValues.rMargin = tagPtr->rMargin; rMarginPrio = tagPtr->priority; } - if ((tagPtr->spacing1String != NULL) + if ((tagPtr->spacing1String) && (tagPtr->priority > spacing1Prio)) { styleValues.spacing1 = tagPtr->spacing1; spacing1Prio = tagPtr->priority; } - if ((tagPtr->spacing2String != NULL) + if ((tagPtr->spacing2String) && (tagPtr->priority > spacing2Prio)) { styleValues.spacing2 = tagPtr->spacing2; spacing2Prio = tagPtr->priority; } - if ((tagPtr->spacing3String != NULL) + if ((tagPtr->spacing3String) && (tagPtr->priority > spacing3Prio)) { styleValues.spacing3 = tagPtr->spacing3; spacing3Prio = tagPtr->priority; } - if ((tagPtr->tabStringPtr != NULL) + if ((tagPtr->tabStringPtr) && (tagPtr->priority > tabPrio)) { styleValues.tabArrayPtr = tagPtr->tabArrayPtr; tabPrio = tagPtr->priority; @@ -900,12 +900,12 @@ GetStyle( styleValues.tabStyle = tagPtr->tabStyle; tabStylePrio = tagPtr->priority; } - if ((tagPtr->underlineString != NULL) + if ((tagPtr->underlineString) && (tagPtr->priority > underlinePrio)) { styleValues.underline = tagPtr->underline; underlinePrio = tagPtr->priority; } - if ((tagPtr->elideString != NULL) + if ((tagPtr->elideString) && (tagPtr->priority > elidePrio)) { styleValues.elide = tagPtr->elide; elidePrio = tagPtr->priority; @@ -916,7 +916,7 @@ GetStyle( wrapPrio = tagPtr->priority; } } - if (tagPtrs != NULL) { + if (tagPtrs) { ckfree((char *) tagPtrs); } @@ -941,20 +941,20 @@ GetStyle( if (styleValues.border != NULL) { gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel; mask = GCForeground; - if (styleValues.bgStipple != None) { + if (styleValues.bgStipple) { gcValues.stipple = styleValues.bgStipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } stylePtr->bgGC = Tk_GetGC(textPtr->tkwin, mask, &gcValues); } else { - stylePtr->bgGC = None; + stylePtr->bgGC = 0; } mask = GCFont; gcValues.font = Tk_FontId(styleValues.tkfont); mask |= GCForeground; gcValues.foreground = styleValues.fgColor->pixel; - if (styleValues.fgStipple != None) { + if (styleValues.fgStipple) { gcValues.stipple = styleValues.fgStipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -994,10 +994,10 @@ FreeStyle( { stylePtr->refCount--; if (stylePtr->refCount == 0) { - if (stylePtr->bgGC != None) { + if (stylePtr->bgGC) { Tk_FreeGC(textPtr->display, stylePtr->bgGC); } - if (stylePtr->fgGC != None) { + if (stylePtr->fgGC) { Tk_FreeGC(textPtr->display, stylePtr->fgGC); } Tcl_DeleteHashEntry(stylePtr->hPtr); @@ -2578,7 +2578,7 @@ DisplayLineBackground( if ((chunkPtr->nextPtr == NULL) && (rightX < maxX)) { rightX = maxX; } - if (chunkPtr->stylePtr->bgGC != None) { + if (chunkPtr->stylePtr->bgGC) { /* * Not visible - bail out now. */ @@ -4335,7 +4335,7 @@ DisplayText( dlPtr->spaceAbove, dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, NULL, - (Drawable) None, dlPtr->y + dlPtr->spaceAbove); + 0, dlPtr->y + dlPtr->spaceAbove); } } @@ -4970,7 +4970,7 @@ TkTextRelayoutWindow( gcValues.graphics_exposures = False; newGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); - if (dInfoPtr->copyGC != None) { + if (dInfoPtr->copyGC) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } dInfoPtr->copyGC = newGC; @@ -7708,7 +7708,7 @@ CharDisplayProc( */ if (!sValuePtr->elide && (numBytes > offsetBytes) - && (stylePtr->fgGC != None)) { + && stylePtr->fgGC) { #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 a310dd7..5bf1899 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -489,29 +489,29 @@ TkTextTagCmd( tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; - if ((tagPtr->elideString != NULL) - || (tagPtr->tkfont != None) - || (tagPtr->justifyString != NULL) - || (tagPtr->lMargin1String != NULL) - || (tagPtr->lMargin2String != NULL) - || (tagPtr->offsetString != NULL) - || (tagPtr->rMarginString != NULL) - || (tagPtr->spacing1String != NULL) - || (tagPtr->spacing2String != NULL) - || (tagPtr->spacing3String != NULL) - || (tagPtr->tabStringPtr != NULL) + if (tagPtr->elideString + || tagPtr->tkfont + || tagPtr->justifyString + || tagPtr->lMargin1String + || tagPtr->lMargin2String + || tagPtr->offsetString + || tagPtr->rMarginString + || tagPtr->spacing1String + || tagPtr->spacing2String + || tagPtr->spacing3String + || tagPtr->tabStringPtr || (tagPtr->tabStyle != TK_TEXT_TABSTYLE_NONE) || (tagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { tagPtr->affectsDisplay = 1; tagPtr->affectsDisplayGeometry = 1; } - if ((tagPtr->border != NULL) - || (tagPtr->reliefString != NULL) - || (tagPtr->bgStipple != None) - || (tagPtr->fgColor != NULL) - || (tagPtr->fgStipple != None) - || (tagPtr->overstrikeString != NULL) - || (tagPtr->underlineString != NULL)) { + if (tagPtr->border + || tagPtr->reliefString + || tagPtr->bgStipple + || tagPtr->fgColor + || tagPtr->fgStipple + || tagPtr->overstrikeString + || tagPtr->underlineString) { tagPtr->affectsDisplay = 1; } if (!newTag) { @@ -987,10 +987,10 @@ TkTextCreateTag( tagPtr->borderWidthPtr = NULL; tagPtr->reliefString = NULL; tagPtr->relief = TK_RELIEF_FLAT; - tagPtr->bgStipple = None; + tagPtr->bgStipple = 0; tagPtr->fgColor = NULL; tagPtr->tkfont = NULL; - tagPtr->fgStipple = None; + tagPtr->fgStipple = 0; tagPtr->justifyString = NULL; tagPtr->justify = TK_JUSTIFY_LEFT; tagPtr->lMargin1String = NULL; @@ -1556,7 +1556,7 @@ TkTextPickCurrent( textPtr->pickEvent.xcrossing.display = eventPtr->xmotion.display; textPtr->pickEvent.xcrossing.window = eventPtr->xmotion.window; textPtr->pickEvent.xcrossing.root = eventPtr->xmotion.root; - textPtr->pickEvent.xcrossing.subwindow = None; + textPtr->pickEvent.xcrossing.subwindow = 0; textPtr->pickEvent.xcrossing.time = eventPtr->xmotion.time; textPtr->pickEvent.xcrossing.x = eventPtr->xmotion.x; textPtr->pickEvent.xcrossing.y = eventPtr->xmotion.y; diff --git a/generic/tkVisual.c b/generic/tkVisual.c index ec8be11..fe3e447 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -398,18 +398,18 @@ Tk_GetColormap( */ other = Tk_NameToWindow(interp, string, tkwin); - if (other == NULL) { - return None; + if (!other) { + return 0; } if (Tk_Screen(other) != Tk_Screen(tkwin)) { Tcl_AppendResult(interp, "can't use colormap for ", string, ": not on same screen", NULL); - return None; + return 0; } if (Tk_Visual(other) != Tk_Visual(tkwin)) { Tcl_AppendResult(interp, "can't use colormap for ", string, ": incompatible visuals", NULL); - return None; + return 0; } colormap = Tk_Colormap(other); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 4ac2849..c122128 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -73,7 +73,7 @@ static const XWindowChanges defChanges = { EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \ VisibilityChangeMask|PropertyChangeMask|ColormapChangeMask static const XSetWindowAttributes defAtts= { - None, /* background_pixmap */ + 0, /* background_pixmap */ 0, /* background_pixel */ CopyFromParent, /* border_pixmap */ 0, /* border_pixel */ @@ -87,7 +87,7 @@ static const XSetWindowAttributes defAtts= { 0, /* do_not_propagate_mask */ False, /* override_redirect */ CopyFromParent, /* colormap */ - None /* cursor */ + 0 /* cursor */ }; /* @@ -504,9 +504,9 @@ GetScreen( dispPtr->lastEventTime = CurrentTime; dispPtr->bindInfoStale = 1; - dispPtr->cursorFont = None; - dispPtr->warpWindow = None; - dispPtr->multipleAtom = None; + dispPtr->cursorFont = 0; + dispPtr->warpWindow = 0; + dispPtr->multipleAtom = 0; /* * By default we do want to collapse motion events in @@ -667,7 +667,7 @@ TkAllocWindow( winPtr->visual = DefaultVisual(dispPtr->display, screenNum); winPtr->depth = DefaultDepth(dispPtr->display, screenNum); } - winPtr->window = None; + winPtr->window = 0; winPtr->childList = NULL; winPtr->lastChildPtr = NULL; winPtr->parentPtr = NULL; @@ -1403,7 +1403,7 @@ Tk_DestroyWindow( winPtr->pathName != NULL && !(winPtr->flags & TK_ANONYMOUS_WINDOW)) { halfdeadPtr->flags |= HD_DESTROY_EVENT; - if (winPtr->window == None) { + if (!winPtr->window) { Tk_MakeWindowExist(tkwin); } event.type = DestroyNotify; @@ -1449,7 +1449,7 @@ Tk_DestroyWindow( } else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) { TkWmRemoveFromColormapWindows(winPtr); } - if (winPtr->window != None) { + if (winPtr->window) { #if defined(MAC_OSX_TK) || defined(__WIN32__) XDestroyWindow(winPtr->display, winPtr->window); #else @@ -1469,7 +1469,7 @@ Tk_DestroyWindow( TkFreeWindowId(dispPtr, winPtr->window); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, (char *) winPtr->window)); - winPtr->window = None; + winPtr->window = 0; } dispPtr->destroyCount--; UnlinkWindow(winPtr); @@ -1642,7 +1642,7 @@ Tk_MapWindow( if (winPtr->flags & TK_MAPPED) { return; } - if (winPtr->window == None) { + if (!winPtr->window) { Tk_MakeWindowExist(tkwin); } /* @@ -1704,21 +1704,21 @@ Tk_MakeWindowExist( Tk_ClassCreateProc *createProc; int isNew; - if (winPtr->window != None) { + if (winPtr->window) { return; } if ((winPtr->parentPtr == NULL) || (winPtr->flags & TK_TOP_HIERARCHY)) { parent = XRootWindow(winPtr->display, winPtr->screenNum); } else { - if (winPtr->parentPtr->window == None) { + if (!winPtr->parentPtr->window) { Tk_MakeWindowExist((Tk_Window) winPtr->parentPtr); } parent = winPtr->parentPtr->window; } createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc); - if (createProc != NULL && parent != None) { + if (createProc != NULL && parent) { winPtr->window = (*createProc)(tkwin, parent, winPtr->instanceData); } else { winPtr->window = TkpMakeWindow(winPtr, parent); @@ -1744,7 +1744,7 @@ Tk_MakeWindowExist( for (winPtr2 = winPtr->nextPtr; winPtr2 != NULL; winPtr2 = winPtr2->nextPtr) { - if ((winPtr2->window != None) + if (winPtr2->window && !(winPtr2->flags & (TK_TOP_HIERARCHY|TK_REPARENTED))) { XWindowChanges changes; changes.sibling = winPtr2->window; @@ -1863,7 +1863,7 @@ Tk_ConfigureWindow( Tcl_Panic("Can't set sibling or stack mode from Tk_ConfigureWindow."); } - if (winPtr->window != None) { + if (winPtr->window) { XConfigureWindow(winPtr->display, winPtr->window, valueMask, valuePtr); TkDoConfigureNotify(winPtr); @@ -1882,7 +1882,7 @@ Tk_MoveWindow( winPtr->changes.x = x; winPtr->changes.y = y; - if (winPtr->window != None) { + if (winPtr->window) { XMoveWindow(winPtr->display, winPtr->window, x, y); TkDoConfigureNotify(winPtr); } else { @@ -1900,7 +1900,7 @@ Tk_ResizeWindow( winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; - if (winPtr->window != None) { + if (winPtr->window) { XResizeWindow(winPtr->display, winPtr->window, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); @@ -1922,7 +1922,7 @@ Tk_MoveResizeWindow( winPtr->changes.y = y; winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; - if (winPtr->window != None) { + if (winPtr->window) { XMoveResizeWindow(winPtr->display, winPtr->window, x, y, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); @@ -1940,7 +1940,7 @@ Tk_SetWindowBorderWidth( register TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.border_width = width; - if (winPtr->window != None) { + if (winPtr->window) { XSetWindowBorderWidth(winPtr->display, winPtr->window, (unsigned) width); TkDoConfigureNotify(winPtr); @@ -2007,7 +2007,7 @@ Tk_ChangeWindowAttributes( winPtr->atts.cursor = attsPtr->cursor; } - if (winPtr->window != None) { + if (winPtr->window) { XChangeWindowAttributes(winPtr->display, winPtr->window, valueMask, attsPtr); } else { @@ -2025,7 +2025,7 @@ Tk_SetWindowBackground( winPtr->atts.background_pixel = pixel; - if (winPtr->window != None) { + if (winPtr->window) { XSetWindowBackground(winPtr->display, winPtr->window, pixel); } else { winPtr->dirtyAtts = (winPtr->dirtyAtts & (unsigned) ~CWBackPixmap) @@ -2042,7 +2042,7 @@ Tk_SetWindowBackgroundPixmap( winPtr->atts.background_pixmap = pixmap; - if (winPtr->window != None) { + if (winPtr->window) { XSetWindowBackgroundPixmap(winPtr->display, winPtr->window, pixmap); } else { @@ -2060,7 +2060,7 @@ Tk_SetWindowBorder( winPtr->atts.border_pixel = pixel; - if (winPtr->window != None) { + if (winPtr->window) { XSetWindowBorder(winPtr->display, winPtr->window, pixel); } else { winPtr->dirtyAtts = (winPtr->dirtyAtts & (unsigned) ~CWBorderPixmap) @@ -2077,7 +2077,7 @@ Tk_SetWindowBorderPixmap( winPtr->atts.border_pixmap = pixmap; - if (winPtr->window != None) { + if (winPtr->window) { XSetWindowBorderPixmap(winPtr->display, winPtr->window, pixmap); } else { @@ -2099,7 +2099,7 @@ Tk_DefineCursor( winPtr->atts.cursor = (Cursor) cursor; #endif - if (winPtr->window != None) { + if (winPtr->window) { XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor); } else { winPtr->dirtyAtts = winPtr->dirtyAtts | CWCursor; @@ -2110,7 +2110,7 @@ void Tk_UndefineCursor( Tk_Window tkwin) /* Window to manipulate. */ { - Tk_DefineCursor(tkwin, None); + Tk_DefineCursor(tkwin, 0); } void @@ -2122,7 +2122,7 @@ Tk_SetWindowColormap( winPtr->atts.colormap = colormap; - if (winPtr->window != None) { + if (winPtr->window) { XSetWindowColormap(winPtr->display, winPtr->window, colormap); if (!(winPtr->flags & TK_WIN_MANAGED)) { TkWmAddToColormapWindows(winPtr); @@ -2162,7 +2162,7 @@ Tk_SetWindowVisual( { register TkWindow *winPtr = (TkWindow *) tkwin; - if (winPtr->window != None) { + if (winPtr->window) { /* Too late! */ return 0; } @@ -2222,7 +2222,7 @@ TkDoConfigureNotify( if (winPtr->changes.stack_mode == Above) { event.xconfigure.above = winPtr->changes.sibling; } else { - event.xconfigure.above = None; + event.xconfigure.above = 0; } event.xconfigure.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); @@ -2585,7 +2585,7 @@ Tk_RestackWindow( * will be handled properly when the window is finally created. */ - if (winPtr->window != None) { + if (winPtr->window) { XWindowChanges changes; unsigned int mask; @@ -2593,7 +2593,7 @@ Tk_RestackWindow( changes.stack_mode = Above; for (otherPtr = winPtr->nextPtr; otherPtr != NULL; otherPtr = otherPtr->nextPtr) { - if ((otherPtr->window != None) + if (otherPtr->window && !(otherPtr->flags & (TK_TOP_HIERARCHY|TK_REPARENTED))){ changes.sibling = otherPtr->window; changes.stack_mode = Below; diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index ae43ae6..48aeb5c 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1151,7 +1151,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) { TkSetRegion(Tk_Display(entryPtr->core.tkwin), gc, clip); } return gc; @@ -1256,7 +1256,7 @@ static void EntryDisplay(void *clientData, Drawable d) gc = EntryGetGC(entryPtr, es.insertColorObj, clipRegion); XFillRectangle(Tk_Display(tkwin), d, gc, cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight); - XSetClipMask(Tk_Display(tkwin), gc, None); + XSetClipMask(Tk_Display(tkwin), gc, 0); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -1267,7 +1267,7 @@ static void EntryDisplay(void *clientData, Drawable d) Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, leftIndex, rightIndex); - XSetClipMask(Tk_Display(tkwin), gc, None); + XSetClipMask(Tk_Display(tkwin), gc, 0); Tk_FreeGC(Tk_Display(tkwin), gc); /* Overwrite the selected portion (if any) in the -selectforeground color: @@ -1278,7 +1278,7 @@ static void EntryDisplay(void *clientData, Drawable d) Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, selFirst, selLast); - XSetClipMask(Tk_Display(tkwin), gc, None); + XSetClipMask(Tk_Display(tkwin), gc, 0); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -1286,7 +1286,7 @@ static void EntryDisplay(void *clientData, Drawable d) * it from the Xft guts (if they're being used). */ #ifdef HAVE_XFT - TkUnixSetXftClipRegion(None); + TkUnixSetXftClipRegion(0); #endif TkDestroyRegion(clipRegion); } diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 1037840..9b80c59 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -183,10 +183,10 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) if (clipRegion != NULL) { #ifdef HAVE_XFT - TkUnixSetXftClipRegion(None); + TkUnixSetXftClipRegion(0); #endif - XSetClipMask(Tk_Display(tkwin), gc1, None); - XSetClipMask(Tk_Display(tkwin), gc2, None); + XSetClipMask(Tk_Display(tkwin), gc1, 0); + XSetClipMask(Tk_Display(tkwin), gc2, 0); TkDestroyRegion(clipRegion); } Tk_FreeGC(Tk_Display(tkwin), gc1); @@ -305,7 +305,7 @@ static void StippleOver( Pixmap stipple = Tk_AllocBitmapFromObj(NULL, tkwin, image->stippleObj); XColor *color = Tk_GetColorFromObj(tkwin, image->backgroundObj); - if (stipple != None) { + if (stipple) { unsigned long mask = GCFillStyle | GCStipple | GCForeground; XGCValues gcvalues; GC gc; diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 48d3fb9..95bee0a 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -103,10 +103,10 @@ TkpDisplayMenuButton( border = mbPtr->normalBorder; } - if (mbPtr->image != None) { + if (mbPtr->image) { Tk_SizeOfImage(mbPtr->image, &width, &height); haveImage = 1; - } else if (mbPtr->bitmap != None) { + } else if (mbPtr->bitmap) { Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height); haveImage = 1; } @@ -194,7 +194,7 @@ TkpDisplayMenuButton( if (mbPtr->image != NULL) { Tk_RedrawImage(mbPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); - } else if (mbPtr->bitmap != None) { + } else if (mbPtr->bitmap) { XSetClipOrigin(mbPtr->display, gc, imageXOffset, imageYOffset); XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap, gc, 0, 0, (unsigned) width, (unsigned) height, @@ -214,7 +214,7 @@ TkpDisplayMenuButton( if (mbPtr->image != NULL) { Tk_RedrawImage(mbPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); - } else if (mbPtr->bitmap != None) { + } else if (mbPtr->bitmap) { XSetClipOrigin(mbPtr->display, gc, x, y); XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap, gc, 0, 0, (unsigned) width, (unsigned) height, @@ -369,10 +369,10 @@ TkpComputeMenuButtonGeometry( txtHeight = 0; avgWidth = 0; - if (mbPtr->image != None) { + if (mbPtr->image) { Tk_SizeOfImage(mbPtr->image, &width, &height); haveImage = 1; - } else if (mbPtr->bitmap != None) { + } else if (mbPtr->bitmap) { Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height); haveImage = 1; } diff --git a/win/stubs.c b/win/stubs.c index 4564639..7e791b5 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -397,7 +397,7 @@ XGetWindowProperty( unsigned long *bytes_after_return, unsigned char **prop_return) { - *actual_type_return = None; + *actual_type_return = 0; *actual_format_return = 0; *nitems_return = 0; *bytes_after_return = 0; diff --git a/win/tkWin3d.c b/win/tkWin3d.c index df6aa95..aa026e8 100644 --- a/win/tkWin3d.c +++ b/win/tkWin3d.c @@ -127,7 +127,7 @@ Tk_3DVerticalBevel( HDC dc = TkWinGetDrawableDC(display, drawable, &state); int half; - if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) { + if (!borderPtr->lightGC && (relief != TK_RELIEF_FLAT)) { TkpGetShadows(borderPtr, tkwin); } @@ -222,7 +222,7 @@ Tk_3DHorizontalBevel( HDC dc = TkWinGetDrawableDC(display, drawable, &state); int topColor, bottomColor; - if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) { + if (!borderPtr->lightGC && (relief != TK_RELIEF_FLAT)) { TkpGetShadows(borderPtr, tkwin); } @@ -339,7 +339,7 @@ TkpGetShadows( int r, g, b; XGCValues gcValues; - if (borderPtr->lightGC != None) { + if (borderPtr->lightGC) { return; } @@ -465,10 +465,10 @@ TkpGetShadows( return; } - if (borderPtr->shadow == None) { + if (!borderPtr->shadow) { borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin, Tk_GetUid("gray50")); - if (borderPtr->shadow == None) { + if (!borderPtr->shadow) { Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border"); } } @@ -540,7 +540,7 @@ TkWinGetBorderPixels( { WinBorder *borderPtr = (WinBorder *) border; - if (borderPtr->info.lightGC == None) { + if (!borderPtr->info.lightGC) { TkpGetShadows(&borderPtr->info, tkwin); } switch (which) { diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 9e1960d..0a11a20 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -433,10 +433,10 @@ TkpDisplayButton( * Display image or bitmap or text for button. */ - if (butPtr->image != None) { + if (butPtr->image) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; - } else if (butPtr->bitmap != None) { + } else if (butPtr->bitmap) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } @@ -839,7 +839,7 @@ TkpComputeButtonGeometry( if (butPtr->image != NULL) { Tk_SizeOfImage(butPtr->image, &imgWidth, &imgHeight); haveImage = 1; - } else if (butPtr->bitmap != None) { + } else if (butPtr->bitmap) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &imgWidth, &imgHeight); haveImage = 1; diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index d0bae8f..7f48703 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -246,7 +246,7 @@ #define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL #define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL #define DEF_MENU_ENTRY_BG (char *) NULL -#define DEF_MENU_ENTRY_BITMAP None +#define DEF_MENU_ENTRY_BITMAP 0 #define DEF_MENU_ENTRY_COLUMN_BREAK "0" #define DEF_MENU_ENTRY_COMMAND (char *) NULL #define DEF_MENU_ENTRY_COMPOUND "none" diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 1897bc8..e94c893 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -631,7 +631,7 @@ XFillRectangles( TkWinDCState state; HBRUSH brush, oldBrush; - if (d == None) { + if (!d) { return BadDrawable; } @@ -641,7 +641,7 @@ XFillRectangles( if ((gc->fill_style == FillStippled || gc->fill_style == FillOpaqueStippled) - && gc->stipple != None) { + && gc->stipple) { TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple; HBRUSH stipple; HBITMAP oldBitmap, bitmap; @@ -756,7 +756,7 @@ RenderObject( if ((gc->fill_style == FillStippled || gc->fill_style == FillOpaqueStippled) - && gc->stipple != None) { + && gc->stipple) { TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple; HDC dcMem; @@ -882,7 +882,7 @@ XDrawLines( TkWinDCState state; HDC dc; - if (d == None) { + if (!d) { return BadDrawable; } @@ -927,7 +927,7 @@ XFillPolygon( TkWinDCState state; HDC dc; - if (d == None) { + if (!d) { return BadDrawable; } @@ -969,7 +969,7 @@ XDrawRectangle( HBRUSH oldBrush; HDC dc; - if (d == None) { + if (!d) { return BadDrawable; } @@ -1085,7 +1085,7 @@ DrawOrFillArc( int xstart, ystart, xend, yend; double radian_start, radian_end, xr, yr; - if (d == None) { + if (!d) { return BadDrawable; } diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index a0670cc..539349f 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -242,7 +242,7 @@ TkpUseWindow( */ /* - if (winPtr->window != None) { + if (winPtr->window) { Tcl_AppendResult(interp, "can't modify container after widget is created", NULL); return TCL_ERROR; @@ -298,7 +298,7 @@ TkpUseWindow( * order to avoid bug 1096074 in future. */ - char msg[256]; + char msg[260]; sprintf(msg, "Unable to get information of window \"%.80s\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string); if (IDCANCEL == MessageBox(hwnd, msg, "Tk Warning", diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 1292772..b60a918 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -519,7 +519,7 @@ TkpGetFontFromAttributes( tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr; window = Tk_WindowId(tkwin); - hwnd = (window == None) ? NULL : TkWinGetHWND(window); + hwnd = window ? TkWinGetHWND(window) : NULL; hdc = GetDC(hwnd); /* @@ -631,7 +631,7 @@ TkpGetFontFamilies( Window window; window = Tk_WindowId(tkwin); - hwnd = (window == None) ? NULL : TkWinGetHWND(window); + hwnd = window ? TkWinGetHWND(window) : NULL; hdc = GetDC(hwnd); /* @@ -1095,7 +1095,7 @@ Tk_DrawChars( fontPtr = (WinFont *) gc->font; display->request++; - if (drawable == None) { + if (!drawable) { return; } @@ -1103,14 +1103,14 @@ Tk_DrawChars( SetROP2(dc, tkpWinRopModes[gc->function]); - if ((gc->clip_mask != None) && + if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) { SelectClipRgn(dc, (HRGN)((TkpClipMask*)gc->clip_mask)->value.region); } if ((gc->fill_style == FillStippled || gc->fill_style == FillOpaqueStippled) - && gc->stipple != None) { + && gc->stipple) { TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple; HBRUSH oldBrush, stipple; HBITMAP oldBitmap, bitmap; @@ -1395,7 +1395,7 @@ InitFont( char buf[LF_FACESIZE * sizeof(WCHAR)]; window = Tk_WindowId(tkwin); - hwnd = (window == None) ? NULL : TkWinGetHWND(window); + hwnd = window ? TkWinGetHWND(window) : NULL; hdc = GetDC(hwnd); oldFont = SelectObject(hdc, hFont); diff --git a/win/tkWinInt.h b/win/tkWinInt.h index abac7b0..b6f7a98 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -41,6 +41,11 @@ #define SPI_SETKEYBOARDCUES 0x100B #endif +#if defined(_WIN32) && !defined(ControlMask) /* prevent conflicting define against windows.h, bug [9e31fd9449] */ +# define ControlMask (1<<2) +#endif + + /* * The TkWinDCState is used to save the state of a device context so that it * can be restored later. diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 9a35266..6240ceb 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -2345,7 +2345,7 @@ DrawMenuEntryLabel( XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) - && (menuPtr->disabledImageGC != None)) { + && menuPtr->disabledImageGC) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), @@ -2990,7 +2990,7 @@ MenuSelectEvent( Tk_MakeWindowExist(menuPtr->tkwin); event.event = Tk_WindowId(menuPtr->tkwin); event.root = XRootWindow(menuPtr->display, 0); - event.subwindow = None; + event.subwindow = 0; event.time = TkpGetMS(); root.msgpos = GetMessagePos(); diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index 51f0f59..60e218d 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.c @@ -115,7 +115,7 @@ Tk_GetPixmap( if (newTwdPtr->bitmap.handle == NULL) { ckfree((char *) newTwdPtr); - return None; + return 0; } return (Pixmap) newTwdPtr; diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index dcddb8f..d5706ac 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -387,7 +387,7 @@ XGetInputFocus( { Tk_Window tkwin = Tk_HWNDToWindow(GetFocus()); - *focus_return = tkwin ? Tk_WindowId(tkwin) : None; + *focus_return = tkwin ? Tk_WindowId(tkwin) : 0; *revert_to_return = RevertToParent; display->request++; return Success; @@ -418,7 +418,7 @@ XSetInputFocus( Time time) { display->request++; - if (focus != None) { + if (focus) { SetFocus(Tk_GetHWND(focus)); } return Success; @@ -465,7 +465,7 @@ TkpChangeFocus( } } - if (winPtr->window == None) { + if (!winPtr->window) { Tcl_Panic("ChangeXFocus got null X window"); } diff --git a/win/tkWinPort.h b/win/tkWinPort.h index b94628e..aec5a66 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -118,7 +118,7 @@ */ #define TkpDefineNativeBitmaps() -#define TkpCreateNativeBitmap(display, source) None -#define TkpGetNativeAppBitmap(display, name, w, h) None +#define TkpCreateNativeBitmap(display, source) 0 +#define TkpGetNativeAppBitmap(display, name, w, h) 0 #endif /* _WINPORT */ diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index fc9685d..f30a957 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -238,7 +238,7 @@ CreateProc( for (winPtr = ((TkWindow*)tkwin)->nextPtr; winPtr != NULL; winPtr = winPtr->nextPtr) { - if ((winPtr->window != None) && !(winPtr->flags & TK_TOP_HIERARCHY)) { + if ((winPtr->window) && !(winPtr->flags & TK_TOP_HIERARCHY)) { TkWinSetWindowPos(scrollPtr->hwnd, Tk_GetHWND(winPtr->window), Below); break; diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 3dfc078..0675bc6 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -228,7 +228,7 @@ TkpScanWindowId( if (tkwin) { *idPtr = Tk_WindowId(tkwin); } else { - *idPtr = None; + *idPtr = 0; } return TCL_OK; } @@ -259,7 +259,7 @@ TkpMakeWindow( int style; HWND hwnd; - if (parent != None) { + if (parent) { parentWin = Tk_GetHWND(parent); style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; } else { @@ -657,7 +657,7 @@ XConfigureWindow( if (valueMask & CWStackMode) { HWND sibling; - if ((valueMask & CWSibling) && (values->sibling != None)) { + if ((valueMask & CWSibling) && values->sibling) { sibling = Tk_GetHWND(values->sibling); } else { sibling = NULL; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 2c3b0e4..8e6683f 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -1035,7 +1035,7 @@ WinSetIcon( "\" isn't a top-level window", NULL); return TCL_ERROR; } - if (Tk_WindowId(tkw) == None) { + if (!Tk_WindowId(tkw)) { Tk_MakeWindowExist(tkw); } @@ -1198,7 +1198,7 @@ TkWinGetIcon( } } - if (Tk_WindowId(tkwin) == None) { + if (!Tk_WindowId(tkwin)) { Tk_MakeWindowExist(tkwin); } @@ -1977,11 +1977,11 @@ TkWmNewWindow( wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; wmPtr->hints.initial_state = NormalState; - wmPtr->hints.icon_pixmap = None; - wmPtr->hints.icon_window = None; + wmPtr->hints.icon_pixmap = 0; + wmPtr->hints.icon_window = 0; wmPtr->hints.icon_x = wmPtr->hints.icon_y = 0; - wmPtr->hints.icon_mask = None; - wmPtr->hints.window_group = None; + wmPtr->hints.icon_mask = 0; + wmPtr->hints.window_group = 0; /* * Default the maximum dimensions to the size of the display. @@ -2062,7 +2062,7 @@ UpdateWrapper( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - if (winPtr->window == None) { + if (!winPtr->window) { /* * Ensure existence of the window to update the wrapper for. */ @@ -2683,7 +2683,7 @@ TkWmDeadWindow( VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, (ClientData) wmPtr2->winPtr); wmPtr2->masterPtr = NULL; - if ((wmPtr2->wrapper != None) + if (wmPtr2->wrapper && !(wmPtr2->flags & (WM_NEVER_MAPPED))) { UpdateWrapper(wmPtr2->winPtr); } @@ -3474,7 +3474,7 @@ WmColormapwindowsCmd( if (winPtr2 == winPtr) { gotToplevel = 1; } - if (winPtr2->window == None) { + if (!winPtr2->window) { Tk_MakeWindowExist((Tk_Window) winPtr2); } cmapList[i] = winPtr2; @@ -3750,7 +3750,7 @@ WmFrameCmd( Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (Tk_WindowId((Tk_Window) winPtr) == None) { + if (!Tk_WindowId((Tk_Window) winPtr)) { Tk_MakeWindowExist((Tk_Window) winPtr); } hwnd = wmPtr->wrapper; @@ -4044,9 +4044,9 @@ WmIconbitmapCmd( string = Tcl_GetString(objv[objc-1]); if (*string == '\0') { - if (wmPtr->hints.icon_pixmap != None) { + if (wmPtr->hints.icon_pixmap) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); - wmPtr->hints.icon_pixmap = None; + wmPtr->hints.icon_pixmap = 0; } wmPtr->hints.flags &= ~IconPixmapHint; if (WinSetIcon(interp, NULL, (Tk_Window) useWinPtr) != TCL_OK) { @@ -4098,7 +4098,7 @@ WmIconbitmapCmd( Pixmap pixmap; Tcl_ResetResult(interp); pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, string); - if (pixmap == None) { + if (!pixmap) { return TCL_ERROR; } wmPtr->hints.icon_pixmap = pixmap; @@ -4217,13 +4217,13 @@ WmIconmaskCmd( } argv3 = Tcl_GetString(objv[3]); if (*argv3 == '\0') { - if (wmPtr->hints.icon_mask != None) { + if (wmPtr->hints.icon_mask) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask); } wmPtr->hints.flags &= ~IconMaskHint; } else { pixmap = Tk_GetBitmap(interp, tkwin, argv3); - if (pixmap == None) { + if (!pixmap) { return TCL_ERROR; } wmPtr->hints.icon_mask = pixmap; @@ -6388,7 +6388,7 @@ Tk_GetRootCoords( * If the window is mapped, let Windows figure out the translation. */ - if (winPtr->window != None) { + if (winPtr->window) { HWND hwnd = Tk_GetHWND(winPtr->window); POINT point; @@ -6816,7 +6816,7 @@ TkWmRestackToplevel( * (mapping it may give it a reparent window). */ - if (winPtr->window == None) { + if (!winPtr->window) { Tk_MakeWindowExist((Tk_Window) winPtr); } if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) { @@ -6826,7 +6826,7 @@ TkWmRestackToplevel( ? winPtr->wmInfoPtr->wrapper : Tk_GetHWND(winPtr->window); if (otherPtr != NULL) { - if (otherPtr->window == None) { + if (!otherPtr->window) { Tk_MakeWindowExist((Tk_Window) otherPtr); } if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) { @@ -6877,7 +6877,7 @@ TkWmAddToColormapWindows( TkWindow **oldPtr, **newPtr; int count, i; - if (winPtr->window == None) { + if (!winPtr->window) { return; } @@ -7312,7 +7312,7 @@ GenerateConfigureNotify( event.xconfigure.y = winPtr->changes.y; event.xconfigure.width = winPtr->changes.width; event.xconfigure.height = winPtr->changes.height; - event.xconfigure.above = None; + event.xconfigure.above = 0; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } @@ -8586,7 +8586,7 @@ TkpWinToplevelDetachWindow( SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); winPtr->flags &= ~TK_EMBEDDED; winPtr->privatePtr = NULL; - wmPtr->wrapper = None; + wmPtr->wrapper = 0; if (state >= 0 && state <= 3) { wmPtr->hints.initial_state = state; } diff --git a/win/tkWinX.c b/win/tkWinX.c index af28e41..ce639a0 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -573,10 +573,10 @@ TkWinDisplayChanged( screen->root_visual->bits_per_rgb = screen->root_depth; ReleaseDC(NULL, dc); - if (screen->cmap != None) { + if (screen->cmap) { XFreeColormap(display, screen->cmap); } - screen->cmap = XCreateColormap(display, None, screen->root_visual, + screen->cmap = XCreateColormap(display, 0, screen->root_visual, AllocNone); } @@ -636,7 +636,7 @@ TkpOpenDisplay( twdPtr = (TkWinDrawable*) ckalloc(sizeof(TkWinDrawable)); if (twdPtr == NULL) { - return None; + return 0; } twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = NULL; @@ -649,7 +649,7 @@ TkpOpenDisplay( screen->white_pixel = RGB(255, 255, 255); screen->black_pixel = RGB(0, 0, 0); - screen->cmap = None; + screen->cmap = 0; display->screens = screen; display->nscreens = 1; @@ -704,10 +704,10 @@ TkpCloseDisplay( if (display->screens->root_visual != NULL) { ckfree((char *) display->screens->root_visual); } - if (display->screens->root != None) { + if (display->screens->root) { ckfree((char *) display->screens->root); } - if (display->screens->cmap != None) { + if (display->screens->cmap) { XFreeColormap(display, display->screens->cmap); } ckfree((char *) display->screens); @@ -1018,7 +1018,7 @@ GenerateXEvent( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd); - if (!winPtr || winPtr->window == None) { + if (!winPtr || !winPtr->window) { return; } @@ -1146,7 +1146,7 @@ GenerateXEvent( */ event.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum); - event.xbutton.subwindow = None; + event.xbutton.subwindow = 0; event.xbutton.x = clientPoint.x; event.xbutton.y = clientPoint.y; event.xbutton.x_root = root.point.x; @@ -1654,7 +1654,7 @@ HandleIMEComposition( event.xkey.display = winPtr->display; event.xkey.window = winPtr->window; event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum); - event.xkey.subwindow = None; + event.xkey.subwindow = 0; event.xkey.state = TkWinGetModifierState(); event.xkey.time = TkpGetMS(); event.xkey.same_screen = True; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 6359891..65b7240 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -453,7 +453,7 @@ InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d) { Window win = Tk_WindowId(tkwin); - if (win != None) { + if (win) { elementData->hwnd = Tk_GetHWND(win); } else { elementData->hwnd = elementData->procs->stubWindow; diff --git a/xlib/X11/X.h b/xlib/X11/X.h index daf2283..ad8f630 100644 --- a/xlib/X11/X.h +++ b/xlib/X11/X.h @@ -73,7 +73,9 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ -#define None 0L /* universal null resource or null atom */ +#ifndef _WIN32 /* prevent conflicting define against windows.h, bug [9e31fd9449] */ +# define None 0L /* universal null resource or null atom */ +#endif #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ @@ -179,7 +181,9 @@ are reserved in the protocol for errors and replies. */ #define ShiftMask (1<<0) #define LockMask (1<<1) -#define ControlMask (1<<2) +#ifndef _WIN32 /* prevent conflicting define against windows.h, bug [9e31fd9449] */ +# define ControlMask (1<<2) +#endif #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) @@ -294,7 +298,7 @@ are reserved in the protocol for errors and replies. */ /* Used in SetInputFocus, GetInputFocus */ -#define RevertToNone (int)None +#define RevertToNone 0 #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 @@ -50,7 +50,7 @@ static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; - if (clip_mask == None) { + if (!clip_mask) { clip_mask = (TkpClipMask*) ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; #ifdef MAC_OSX_TK @@ -78,14 +78,14 @@ static TkpClipMask *AllocClipMask(GC gc) { */ static void FreeClipMask(GC gc) { - if (gc->clip_mask != None) { + if (gc->clip_mask) { #ifdef MAC_OSX_TK if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) { TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region); } #endif ckfree((char*) gc->clip_mask); - gc->clip_mask = None; + gc->clip_mask = 0; } } @@ -126,7 +126,7 @@ XCreateGC( gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); if (!gp) { - return None; + return 0; } #define InitField(name,maskbit,default) \ @@ -145,11 +145,11 @@ XCreateGC( InitField(fill_style, GCFillStyle, FillSolid); InitField(fill_rule, GCFillRule, WindingRule); InitField(arc_mode, GCArcMode, ArcPieSlice); - InitField(tile, GCTile, None); - InitField(stipple, GCStipple, None); + InitField(tile, GCTile, 0); + InitField(stipple, GCStipple, 0); InitField(ts_x_origin, GCTileStipXOrigin, 0); InitField(ts_y_origin, GCTileStipYOrigin, 0); - InitField(font, GCFont, None); + InitField(font, GCFont, 0); InitField(subwindow_mode, GCSubwindowMode, ClipByChildren); InitField(graphics_exposures, GCGraphicsExposures, True); InitField(clip_x_origin, GCClipXOrigin, 0); @@ -158,7 +158,7 @@ XCreateGC( InitField(dashes, GCDashList, 4); (&(gp->dashes))[1] = 0; - gp->clip_mask = None; + gp->clip_mask = 0; if (mask & GCClipMask) { TkpClipMask *clip_mask = AllocClipMask(gp); @@ -269,7 +269,7 @@ int XFreeGC( Display *d, GC gc) { - if (gc != None) { + if (gc) { FreeClipMask(gc); TkpFreeGCCache(gc); ckfree((char *) gc); @@ -465,7 +465,7 @@ TkSetRegion( GC gc, TkRegion r) { - if (r == None) { + if (!r) { Tcl_Panic("must not pass None to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { TkpClipMask *clip_mask = AllocClipMask(gc); @@ -484,7 +484,7 @@ XSetClipMask( GC gc, Pixmap pixmap) { - if (pixmap == None) { + if (!pixmap) { FreeClipMask(gc); } else { TkpClipMask *clip_mask = AllocClipMask(gc); diff --git a/xlib/ximage.c b/xlib/ximage.c index aaab946..f7bf1cc 100644 --- a/xlib/ximage.c +++ b/xlib/ximage.c @@ -47,7 +47,7 @@ XCreateBitmapFromData( pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1); gc = XCreateGC(display, pix, 0, NULL); if (gc == NULL) { - return None; + return 0; } ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width, height, 8, (width + 7) / 8); |