diff options
Diffstat (limited to 'generic')
45 files changed, 582 insertions, 585 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index 8c8136c..ce97a2e 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -235,7 +235,7 @@ Tk_Get3DBorder( borderPtr->bgColorPtr = bgColorPtr; borderPtr->darkColorPtr = NULL; borderPtr->lightColorPtr = NULL; - borderPtr->shadow = 0; + borderPtr->shadow = None; borderPtr->bgGC = 0; borderPtr->darkGC = 0; borderPtr->lightGC = 0; @@ -374,7 +374,7 @@ Tk_3DBorderGC( { TkBorder * borderPtr = (TkBorder *) border; - if (!borderPtr->lightGC && (which != TK_3D_FLAT_GC)) { + if ((borderPtr->lightGC == None) && (which != TK_3D_FLAT_GC)) { TkpGetShadows(borderPtr, tkwin); } if (which == TK_3D_FLAT_GC) { @@ -391,7 +391,7 @@ Tk_3DBorderGC( * compilers happy. */ - return 0; + return (GC) None; } /* @@ -427,29 +427,29 @@ Tk_Free3DBorder( prevPtr = Tcl_GetHashValue(borderPtr->hashPtr); TkpFreeBorder(borderPtr); - if (borderPtr->bgColorPtr) { + if (borderPtr->bgColorPtr != NULL) { Tk_FreeColor(borderPtr->bgColorPtr); } - if (borderPtr->darkColorPtr) { + if (borderPtr->darkColorPtr != NULL) { Tk_FreeColor(borderPtr->darkColorPtr); } - if (borderPtr->lightColorPtr) { + if (borderPtr->lightColorPtr != NULL) { Tk_FreeColor(borderPtr->lightColorPtr); } - if (borderPtr->shadow) { + if (borderPtr->shadow != None) { Tk_FreeBitmap(display, borderPtr->shadow); } - if (borderPtr->bgGC) { + if (borderPtr->bgGC != None) { Tk_FreeGC(display, borderPtr->bgGC); } - if (borderPtr->darkGC) { + if (borderPtr->darkGC != None) { Tk_FreeGC(display, borderPtr->darkGC); } - if (borderPtr->lightGC) { + if (borderPtr->lightGC != None) { Tk_FreeGC(display, borderPtr->lightGC); } if (prevPtr == borderPtr) { - if (!borderPtr->nextPtr) { + if (borderPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(borderPtr->hashPtr); } else { Tcl_SetHashValue(borderPtr->hashPtr, borderPtr->nextPtr); @@ -765,7 +765,7 @@ Tk_Draw3DPolygon( int i, lightOnLeft, dx, dy, parallel, pointsSeen; Display *display = Tk_Display(tkwin); - if (!borderPtr->lightGC) { + if (borderPtr->lightGC == None) { TkpGetShadows(borderPtr, tkwin); } diff --git a/generic/tkBind.c b/generic/tkBind.c index c67ddcc..c8f2610 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -596,7 +596,7 @@ static const TkStateMap visNotify[] = { }; static const TkStateMap configureRequestDetail[] = { - {0, "None"}, + {None, "None"}, {Above, "Above"}, {Below, "Below"}, {BottomIf, "BottomIf"}, diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 1dd11bf..88f3e2b 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -219,7 +219,7 @@ Tk_AllocBitmapFromObj( bitmapPtr = GetBitmap(interp, tkwin, Tcl_GetString(objPtr)); objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; if (bitmapPtr == NULL) { - return 0; + return None; } bitmapPtr->objRefCount++; return bitmapPtr->bitmap; @@ -261,7 +261,7 @@ Tk_GetBitmap( TkBitmap *bitmapPtr = GetBitmap(interp, tkwin, string); if (bitmapPtr == NULL) { - return 0; + return None; } return bitmapPtr->bitmap; } @@ -385,7 +385,7 @@ GetBitmap( bitmap = TkpGetNativeAppBitmap(Tk_Display(tkwin), string, &width, &height); - if (!bitmap) { + if (bitmap == None) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bitmap \"%s\" not defined", string)); @@ -401,7 +401,7 @@ GetBitmap( if (predefPtr->native) { bitmap = TkpCreateNativeBitmap(Tk_Display(tkwin), predefPtr->source); - if (!bitmap) { + if (bitmap == None) { Tcl_Panic("native bitmap creation failed"); } } else { diff --git a/generic/tkButton.c b/generic/tkButton.c index 8e60428..1cf6247 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 = 0; + butPtr->bitmap = None; 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 = 0; - butPtr->activeTextGC = 0; - butPtr->disabledGC = 0; - butPtr->stippleGC = 0; - butPtr->gray = 0; - butPtr->copyGC = 0; + butPtr->normalTextGC = NULL; + butPtr->activeTextGC = NULL; + butPtr->disabledGC = NULL; + butPtr->stippleGC = NULL; + butPtr->gray = None; + butPtr->copyGC = NULL; butPtr->widthPtr = NULL; butPtr->width = 0; butPtr->heightPtr = NULL; @@ -740,7 +740,7 @@ ButtonCreate( butPtr->onValuePtr = NULL; butPtr->offValuePtr = NULL; butPtr->tristateValuePtr = NULL; - butPtr->cursor = 0; + butPtr->cursor = NULL; butPtr->takeFocusPtr = NULL; butPtr->commandPtr = NULL; butPtr->flags = 0; @@ -972,37 +972,37 @@ DestroyButton( NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, butPtr); } - if (butPtr->image) { + if (butPtr->image != NULL) { Tk_FreeImage(butPtr->image); } - if (butPtr->selectImage) { + if (butPtr->selectImage != NULL) { Tk_FreeImage(butPtr->selectImage); } - if (butPtr->tristateImage) { + if (butPtr->tristateImage != NULL) { Tk_FreeImage(butPtr->tristateImage); } - if (butPtr->normalTextGC) { + if (butPtr->normalTextGC != None) { Tk_FreeGC(butPtr->display, butPtr->normalTextGC); } - if (butPtr->activeTextGC) { + if (butPtr->activeTextGC != None) { Tk_FreeGC(butPtr->display, butPtr->activeTextGC); } - if (butPtr->disabledGC) { + if (butPtr->disabledGC != None) { Tk_FreeGC(butPtr->display, butPtr->disabledGC); } - if (butPtr->stippleGC) { + if (butPtr->stippleGC != None) { Tk_FreeGC(butPtr->display, butPtr->stippleGC); } - if (butPtr->gray) { + if (butPtr->gray != None) { Tk_FreeBitmap(butPtr->display, butPtr->gray); } - if (butPtr->copyGC) { + if (butPtr->copyGC != None) { Tk_FreeGC(butPtr->display, butPtr->copyGC); } - if (butPtr->textLayout) { + if (butPtr->textLayout != NULL) { Tk_FreeTextLayout(butPtr->textLayout); } - if (butPtr->selVarNamePtr) { + if (butPtr->selVarNamePtr != NULL) { Tcl_UntraceVar2(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, butPtr); @@ -1187,7 +1187,7 @@ ConfigureButton( * don't go to zero and cause image data to be discarded. */ - if (butPtr->imagePtr) { + if (butPtr->imagePtr != NULL) { image = Tk_GetImage(butPtr->interp, butPtr->tkwin, Tcl_GetString(butPtr->imagePtr), ButtonImageProc, butPtr); @@ -1201,7 +1201,7 @@ ConfigureButton( Tk_FreeImage(butPtr->image); } butPtr->image = image; - if (butPtr->selectImagePtr) { + if (butPtr->selectImagePtr != NULL) { image = Tk_GetImage(butPtr->interp, butPtr->tkwin, Tcl_GetString(butPtr->selectImagePtr), ButtonSelectImageProc, butPtr); @@ -1211,7 +1211,7 @@ ConfigureButton( } else { image = NULL; } - if (butPtr->selectImage) { + if (butPtr->selectImage != NULL) { Tk_FreeImage(butPtr->selectImage); } butPtr->selectImage = image; @@ -1231,7 +1231,7 @@ ConfigureButton( butPtr->tristateImage = image; haveImage = 0; - if (butPtr->imagePtr || butPtr->bitmap) { + if (butPtr->imagePtr != NULL || butPtr->bitmap != None) { haveImage = 1; } if ((!haveImage || butPtr->compound != COMPOUND_NONE) @@ -1246,14 +1246,14 @@ ConfigureButton( namePtr = butPtr->textVarNamePtr; valuePtr = Tcl_ObjGetVar2(interp, namePtr, NULL, TCL_GLOBAL_ONLY); - if (!valuePtr) { + if (valuePtr == NULL) { if (Tcl_ObjSetVar2(interp, namePtr, NULL, butPtr->textPtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) { continue; } } else { - if (butPtr->textPtr) { + if (butPtr->textPtr != NULL) { Tcl_DecrRefCount(butPtr->textPtr); } butPtr->textPtr = valuePtr; @@ -1261,7 +1261,7 @@ ConfigureButton( } } - if (butPtr->bitmap || butPtr->imagePtr) { + if ((butPtr->bitmap != None) || (butPtr->imagePtr != NULL)) { /* * The button must display the contents of an image or bitmap. */ @@ -1367,17 +1367,17 @@ TkButtonWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->normalTextGC) { + if (butPtr->normalTextGC != None) { Tk_FreeGC(butPtr->display, butPtr->normalTextGC); } butPtr->normalTextGC = newGC; - if (butPtr->activeFg) { + if (butPtr->activeFg != NULL) { 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) { + if (butPtr->activeTextGC != None) { Tk_FreeGC(butPtr->display, butPtr->activeTextGC); } butPtr->activeTextGC = newGC; @@ -1389,13 +1389,13 @@ TkButtonWorldChanged( * Create the GC that can be used for stippling */ - if (!butPtr->stippleGC) { + if (butPtr->stippleGC == None) { gcValues.foreground = gcValues.background; mask = GCForeground; - if (!butPtr->gray) { + if (butPtr->gray == None) { butPtr->gray = Tk_GetBitmap(NULL, butPtr->tkwin, "gray50"); } - if (butPtr->gray) { + if (butPtr->gray != None) { gcValues.fill_style = FillStippled; gcValues.stipple = butPtr->gray; mask |= GCFillStyle | GCStipple; @@ -1409,18 +1409,18 @@ TkButtonWorldChanged( */ mask = GCForeground | GCBackground | GCFont; - if (butPtr->disabledFg) { + if (butPtr->disabledFg != NULL) { gcValues.foreground = butPtr->disabledFg->pixel; } else { gcValues.foreground = gcValues.background; } newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues); - if (butPtr->disabledGC) { + if (butPtr->disabledGC != None) { Tk_FreeGC(butPtr->display, butPtr->disabledGC); } butPtr->disabledGC = newGC; - if (!butPtr->copyGC) { + if (butPtr->copyGC == None) { butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues); } diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index f163c60..cd9ab33 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -286,11 +286,11 @@ CreateArc( arcPtr->fillColor = NULL; arcPtr->activeFillColor = NULL; arcPtr->disabledFillColor = NULL; - arcPtr->fillStipple = 0; - arcPtr->activeFillStipple = 0; - arcPtr->disabledFillStipple = 0; + arcPtr->fillStipple = None; + arcPtr->activeFillStipple = None; + arcPtr->disabledFillStipple = None; arcPtr->style = PIESLICE_STYLE; - arcPtr->fillGC = 0; + arcPtr->fillGC = NULL; /* * Process the arguments to fill in the item record. @@ -437,11 +437,11 @@ ConfigureArc( */ if (arcPtr->outline.activeWidth > arcPtr->outline.width || - arcPtr->outline.activeDash.number || - arcPtr->outline.activeColor || - arcPtr->outline.activeStipple || - arcPtr->activeFillColor || - arcPtr->activeFillStipple) { + arcPtr->outline.activeDash.number != 0 || + arcPtr->outline.activeColor != NULL || + arcPtr->outline.activeStipple != None || + arcPtr->activeFillColor != NULL || + arcPtr->activeFillStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -478,9 +478,9 @@ ConfigureArc( mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = 0; + newGC = NULL; } - if (arcPtr->outline.gc) { + if (arcPtr->outline.gc != None) { Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc); } arcPtr->outline.gc = newGC; @@ -496,23 +496,23 @@ ConfigureArc( color = arcPtr->fillColor; stipple = arcPtr->fillStipple; if (Canvas(canvas)->currentItemPtr == itemPtr) { - if (arcPtr->activeFillColor) { + if (arcPtr->activeFillColor!=NULL) { color = arcPtr->activeFillColor; } - if (arcPtr->activeFillStipple) { + if (arcPtr->activeFillStipple!=None) { stipple = arcPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { - if (arcPtr->disabledFillColor) { + if (arcPtr->disabledFillColor!=NULL) { color = arcPtr->disabledFillColor; } - if (arcPtr->disabledFillStipple) { + if (arcPtr->disabledFillStipple!=None) { stipple = arcPtr->disabledFillStipple; } } - if ((arcPtr->style == ARC_STYLE) || !color) { - newGC = 0; + if ((arcPtr->style == ARC_STYLE) || (!color)) { + newGC = NULL; } else { gcValues.foreground = color->pixel; if (arcPtr->style == CHORD_STYLE) { @@ -521,14 +521,14 @@ ConfigureArc( gcValues.arc_mode = ArcPieSlice; } mask = GCForeground|GCArcMode; - if (stipple) { + if (stipple != None) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (arcPtr->fillGC) { + if (arcPtr->fillGC != None) { Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC); } arcPtr->fillGC = newGC; @@ -583,25 +583,25 @@ DeleteArc( if (arcPtr->numOutlinePoints != 0) { ckfree(arcPtr->outlinePtr); } - if (arcPtr->fillColor) { + if (arcPtr->fillColor != NULL) { Tk_FreeColor(arcPtr->fillColor); } - if (arcPtr->activeFillColor) { + if (arcPtr->activeFillColor != NULL) { Tk_FreeColor(arcPtr->activeFillColor); } - if (arcPtr->disabledFillColor) { + if (arcPtr->disabledFillColor != NULL) { Tk_FreeColor(arcPtr->disabledFillColor); } - if (arcPtr->fillStipple) { + if (arcPtr->fillStipple != None) { Tk_FreeBitmap(display, arcPtr->fillStipple); } - if (arcPtr->activeFillStipple) { + if (arcPtr->activeFillStipple != None) { Tk_FreeBitmap(display, arcPtr->activeFillStipple); } - if (arcPtr->disabledFillStipple) { + if (arcPtr->disabledFillStipple != None) { Tk_FreeBitmap(display, arcPtr->disabledFillStipple); } - if (arcPtr->fillGC) { + if (arcPtr->fillGC != None) { Tk_FreeGC(display, arcPtr->fillGC); } } @@ -732,7 +732,7 @@ ComputeArcBbox( * drawn) and add one extra pixel just for safety. */ - if (!arcPtr->outline.gc) { + if (arcPtr->outline.gc == None) { tmp = 1; } else { tmp = (int) ((width + 1.0)/2.0 + 1); @@ -789,20 +789,20 @@ DisplayArc( if (arcPtr->outline.activeWidth>lineWidth) { lineWidth = arcPtr->outline.activeWidth; } - if (arcPtr->outline.activeDash.number) { + if (arcPtr->outline.activeDash.number != 0) { dashnumber = arcPtr->outline.activeDash.number; } - if (arcPtr->activeFillStipple) { + if (arcPtr->activeFillStipple != None) { stipple = arcPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { if (arcPtr->outline.disabledWidth > 0) { lineWidth = arcPtr->outline.disabledWidth; } - if (arcPtr->outline.disabledDash.number) { + if (arcPtr->outline.disabledDash.number != 0) { dashnumber = arcPtr->outline.disabledDash.number; } - if (arcPtr->disabledFillStipple) { + if (arcPtr->disabledFillStipple != None) { stipple = arcPtr->disabledFillStipple; } } @@ -831,8 +831,8 @@ DisplayArc( * window servers to crash and should be a no-op anyway. */ - if ((arcPtr->fillGC) && (extent != 0)) { - if (stipple) { + if ((arcPtr->fillGC != None) && (extent != 0)) { + if (stipple != None) { int w = 0; int h = 0; Tk_TSOffset *tsoffset = &arcPtr->tsoffset; @@ -861,14 +861,14 @@ DisplayArc( } XFillArc(display, drawable, arcPtr->fillGC, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), start, extent); - if (stipple) { + if (stipple != None) { XSetTSOrigin(display, arcPtr->fillGC, 0, 0); } } - if (arcPtr->outline.gc) { + if (arcPtr->outline.gc != None) { Tk_ChangeOutlineGC(canvas, itemPtr, &(arcPtr->outline)); - if (extent) { + if (extent != 0) { XDrawArc(display, drawable, arcPtr->outline.gc, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), start, extent); } @@ -880,7 +880,7 @@ DisplayArc( * outline is dashed, because then polygons don't work. */ - if (lineWidth < 1.5 || dashnumber) { + if (lineWidth < 1.5 || dashnumber != 0) { Tk_CanvasDrawableCoords(canvas, arcPtr->center1[0], arcPtr->center1[1], &x1, &y1); Tk_CanvasDrawableCoords(canvas, arcPtr->center2[0], @@ -903,13 +903,13 @@ DisplayArc( } else { if (arcPtr->style == CHORD_STYLE) { TkFillPolygon(canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS, - display, drawable, arcPtr->outline.gc, 0); + display, drawable, arcPtr->outline.gc, NULL); } else if (arcPtr->style == PIESLICE_STYLE) { TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS, - display, drawable, arcPtr->outline.gc, 0); + display, drawable, arcPtr->outline.gc, NULL); TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS, PIE_OUTLINE2_PTS, display, drawable, - arcPtr->outline.gc, 0); + arcPtr->outline.gc, NULL); } } @@ -1015,12 +1015,12 @@ ArcToPoint( return dist; } - if (arcPtr->fillGC || !arcPtr->outline.gc) { + if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) { filled = 1; } else { filled = 0; } - if (!arcPtr->outline.gc) { + if (arcPtr->outline.gc == None) { width = 0.0; } @@ -1142,12 +1142,12 @@ ArcToArea( } } - if ((arcPtr->fillGC) || !arcPtr->outline.gc) { + if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) { filled = 1; } else { filled = 0; } - if (!arcPtr->outline.gc) { + if (arcPtr->outline.gc == None) { width = 0.0; } @@ -1842,29 +1842,29 @@ ArcToPostscript( fillColor = arcPtr->fillColor; fillStipple = arcPtr->fillStipple; if (Canvas(canvas)->currentItemPtr == itemPtr) { - if (arcPtr->outline.activeColor) { + if (arcPtr->outline.activeColor!=NULL) { color = arcPtr->outline.activeColor; } - if (arcPtr->outline.activeStipple) { + if (arcPtr->outline.activeStipple!=None) { stipple = arcPtr->outline.activeStipple; } - if (arcPtr->activeFillColor) { + if (arcPtr->activeFillColor!=NULL) { fillColor = arcPtr->activeFillColor; } - if (arcPtr->activeFillStipple) { + if (arcPtr->activeFillStipple!=None) { fillStipple = arcPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { - if (arcPtr->outline.disabledColor) { + if (arcPtr->outline.disabledColor!=NULL) { color = arcPtr->outline.disabledColor; } - if (arcPtr->outline.disabledStipple) { + if (arcPtr->outline.disabledStipple!=None) { stipple = arcPtr->outline.disabledStipple; } - if (arcPtr->disabledFillColor) { + if (arcPtr->disabledFillColor!=NULL) { fillColor = arcPtr->disabledFillColor; } - if (arcPtr->disabledFillStipple) { + if (arcPtr->disabledFillStipple!=None) { fillStipple = arcPtr->disabledFillStipple; } } @@ -1881,7 +1881,7 @@ ArcToPostscript( * arc. */ - if (arcPtr->fillGC) { + if (arcPtr->fillGC != None) { Tcl_AppendPrintfToObj(psObj, "matrix currentmatrix\n" "%.15g %.15g translate %.15g %.15g scale\n", @@ -1922,7 +1922,7 @@ ArcToPostscript( * If there's an outline for the arc, draw it. */ - if (arcPtr->outline.gc) { + if (arcPtr->outline.gc != None) { Tcl_AppendPrintfToObj(psObj, "matrix currentmatrix\n" "%.15g %.15g translate %.15g %.15g scale\n", diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 3e4d811..42ea262 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -180,16 +180,16 @@ TkcCreateBitmap( */ bmapPtr->anchor = TK_ANCHOR_CENTER; - bmapPtr->bitmap = 0; - bmapPtr->activeBitmap = 0; - bmapPtr->disabledBitmap = 0; + bmapPtr->bitmap = None; + bmapPtr->activeBitmap = None; + bmapPtr->disabledBitmap = None; bmapPtr->fgColor = NULL; bmapPtr->activeFgColor = NULL; bmapPtr->disabledFgColor = NULL; bmapPtr->bgColor = NULL; bmapPtr->activeBgColor = NULL; bmapPtr->disabledBgColor = NULL; - bmapPtr->gc = 0; + bmapPtr->gc = NULL; /* * Process the arguments to fill in the item record. Only 1 (list) or 2 (x @@ -331,9 +331,9 @@ ConfigureBitmap( state = itemPtr->state; - if (bmapPtr->activeFgColor || - bmapPtr->activeBgColor || - bmapPtr->activeBitmap) { + if (bmapPtr->activeFgColor!=NULL || + bmapPtr->activeBgColor!=NULL || + bmapPtr->activeBitmap!=None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -350,33 +350,33 @@ ConfigureBitmap( bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; if (Canvas(canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeFgColor) { + if (bmapPtr->activeFgColor!=NULL) { fgColor = bmapPtr->activeFgColor; } - if (bmapPtr->activeBgColor) { + if (bmapPtr->activeBgColor!=NULL) { bgColor = bmapPtr->activeBgColor; } - if (bmapPtr->activeBitmap) { + if (bmapPtr->activeBitmap!=None) { bitmap = bmapPtr->activeBitmap; } } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledFgColor) { + if (bmapPtr->disabledFgColor!=NULL) { fgColor = bmapPtr->disabledFgColor; } - if (bmapPtr->disabledBgColor) { + if (bmapPtr->disabledBgColor!=NULL) { bgColor = bmapPtr->disabledBgColor; } - if (bmapPtr->disabledBitmap) { + if (bmapPtr->disabledBitmap!=None) { bitmap = bmapPtr->disabledBitmap; } } if (!bitmap) { - newGC = 0; + newGC = NULL; } else { gcValues.foreground = fgColor->pixel; mask = GCForeground; - if (bgColor) { + if (bgColor != NULL) { gcValues.background = bgColor->pixel; mask |= GCBackground; } else { @@ -385,7 +385,7 @@ ConfigureBitmap( } newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (bmapPtr->gc) { + if (bmapPtr->gc != None) { Tk_FreeGC(Tk_Display(tkwin), bmapPtr->gc); } bmapPtr->gc = newGC; @@ -419,34 +419,34 @@ DeleteBitmap( { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; - if (bmapPtr->bitmap) { + if (bmapPtr->bitmap != None) { Tk_FreeBitmap(display, bmapPtr->bitmap); } - if (bmapPtr->activeBitmap) { + if (bmapPtr->activeBitmap != None) { Tk_FreeBitmap(display, bmapPtr->activeBitmap); } - if (bmapPtr->disabledBitmap) { + if (bmapPtr->disabledBitmap != None) { Tk_FreeBitmap(display, bmapPtr->disabledBitmap); } - if (bmapPtr->fgColor) { + if (bmapPtr->fgColor != NULL) { Tk_FreeColor(bmapPtr->fgColor); } - if (bmapPtr->activeFgColor) { + if (bmapPtr->activeFgColor != NULL) { Tk_FreeColor(bmapPtr->activeFgColor); } - if (bmapPtr->disabledFgColor) { + if (bmapPtr->disabledFgColor != NULL) { Tk_FreeColor(bmapPtr->disabledFgColor); } - if (bmapPtr->bgColor) { + if (bmapPtr->bgColor != NULL) { Tk_FreeColor(bmapPtr->bgColor); } - if (bmapPtr->activeBgColor) { + if (bmapPtr->activeBgColor != NULL) { Tk_FreeColor(bmapPtr->activeBgColor); } - if (bmapPtr->disabledBgColor) { + if (bmapPtr->disabledBgColor != NULL) { Tk_FreeColor(bmapPtr->disabledBgColor); } - if (bmapPtr->gc) { + if (bmapPtr->gc != NULL) { Tk_FreeGC(display, bmapPtr->gc); } } @@ -485,11 +485,11 @@ ComputeBitmapBbox( } bitmap = bmapPtr->bitmap; if (Canvas(canvas)->currentItemPtr == (Tk_Item *)bmapPtr) { - if (bmapPtr->activeBitmap) { + if (bmapPtr->activeBitmap!=None) { bitmap = bmapPtr->activeBitmap; } - } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledBitmap) { + } else if (state==TK_STATE_DISABLED) { + if (bmapPtr->disabledBitmap!=None) { bitmap = bmapPtr->disabledBitmap; } } @@ -497,7 +497,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) { + if (state==TK_STATE_HIDDEN || bitmap == None) { bmapPtr->header.x1 = bmapPtr->header.x2 = x; bmapPtr->header.y1 = bmapPtr->header.y2 = y; return; @@ -595,16 +595,16 @@ DisplayBitmap( } bitmap = bmapPtr->bitmap; if (Canvas(canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeBitmap) { + if (bmapPtr->activeBitmap!=None) { bitmap = bmapPtr->activeBitmap; } } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledBitmap) { + if (bmapPtr->disabledBitmap!=None) { bitmap = bmapPtr->disabledBitmap; } } - if (bitmap) { + if (bitmap != None) { if (x > bmapPtr->header.x1) { bmapX = x - bmapPtr->header.x1; bmapWidth = bmapPtr->header.x2 - x; @@ -864,28 +864,28 @@ BitmapToPostscript( bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; if (Canvas(canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeFgColor) { + if (bmapPtr->activeFgColor!=NULL) { fgColor = bmapPtr->activeFgColor; } - if (bmapPtr->activeBgColor) { + if (bmapPtr->activeBgColor!=NULL) { bgColor = bmapPtr->activeBgColor; } - if (bmapPtr->activeBitmap) { + if (bmapPtr->activeBitmap!=None) { bitmap = bmapPtr->activeBitmap; } } else if (state == TK_STATE_DISABLED) { - if (bmapPtr->disabledFgColor) { + if (bmapPtr->disabledFgColor!=NULL) { fgColor = bmapPtr->disabledFgColor; } - if (bmapPtr->disabledBgColor) { + if (bmapPtr->disabledBgColor!=NULL) { bgColor = bmapPtr->disabledBgColor; } - if (bmapPtr->disabledBitmap) { + if (bmapPtr->disabledBitmap!=None) { bitmap = bmapPtr->disabledBitmap; } } - if (!bitmap) { + if (bitmap == None) { return TCL_OK; } diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index c88bb37..899741a 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -432,16 +432,16 @@ ComputeImageBbox( Tk_Image image; Tk_State state = imgPtr->header.state; - if (state == TK_STATE_NULL) { + if(state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } image = imgPtr->image; if (Canvas(canvas)->currentItemPtr == (Tk_Item *)imgPtr) { - if (imgPtr->activeImage) { + if (imgPtr->activeImage != NULL) { image = imgPtr->activeImage; } } else if (state == TK_STATE_DISABLED) { - if (imgPtr->disabledImage) { + if (imgPtr->disabledImage != NULL) { image = imgPtr->disabledImage; } } @@ -449,7 +449,7 @@ ComputeImageBbox( x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5)); y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5)); - if ((state == TK_STATE_HIDDEN) || !image) { + if ((state == TK_STATE_HIDDEN) || (image == None)) { 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 7179c85..f862238 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -296,7 +296,7 @@ CreateLine( linePtr->coordPtr = NULL; linePtr->capStyle = CapButt; linePtr->joinStyle = JoinRound; - linePtr->arrowGC = 0; + linePtr->arrowGC = NULL; linePtr->arrow = ARROWS_NONE; linePtr->arrowShapeA = (float)8.0; linePtr->arrowShapeB = (float)10.0; @@ -493,9 +493,9 @@ ConfigureLine( } if (linePtr->outline.activeWidth > linePtr->outline.width || - linePtr->outline.activeDash.number || - linePtr->outline.activeColor || - linePtr->outline.activeStipple) { + linePtr->outline.activeDash.number != 0 || + linePtr->outline.activeColor != NULL || + linePtr->outline.activeStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -521,7 +521,7 @@ ConfigureLine( #endif arrowGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = arrowGC = 0; + newGC = arrowGC = NULL; } if (linePtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc); @@ -552,7 +552,7 @@ ConfigureLine( * line's endpoints (they were shortened when the arrowheads were added). */ - if (linePtr->firstArrowPtr && (linePtr->arrow != ARROWS_FIRST) + if ((linePtr->firstArrowPtr != NULL) && (linePtr->arrow != ARROWS_FIRST) && (linePtr->arrow != ARROWS_BOTH)) { linePtr->coordPtr[0] = linePtr->firstArrowPtr[0]; linePtr->coordPtr[1] = linePtr->firstArrowPtr[1]; @@ -608,16 +608,16 @@ DeleteLine( LineItem *linePtr = (LineItem *) itemPtr; Tk_DeleteOutline(display, &linePtr->outline); - if (linePtr->coordPtr) { + if (linePtr->coordPtr != NULL) { ckfree(linePtr->coordPtr); } - if (linePtr->arrowGC) { + if (linePtr->arrowGC != None) { Tk_FreeGC(display, linePtr->arrowGC); } - if (linePtr->firstArrowPtr) { + if (linePtr->firstArrowPtr != NULL) { ckfree(linePtr->firstArrowPtr); } - if (linePtr->lastArrowPtr) { + if (linePtr->lastArrowPtr != NULL) { ckfree(linePtr->lastArrowPtr); } } @@ -654,7 +654,7 @@ ComputeLineBbox( state = Canvas(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; @@ -667,7 +667,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; } @@ -2277,7 +2277,7 @@ 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) { @@ -2287,7 +2287,7 @@ LineToPostscript( 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) { @@ -2407,8 +2407,8 @@ LineToPostscript( * Output polygons for the arrowheads, if there are any. */ - if (linePtr->firstArrowPtr) { - if (stipple) { + if (linePtr->firstArrowPtr != NULL) { + if (stipple != None) { Tcl_AppendToObj(psObj, "grestore gsave\n", -1); } if (ArrowheadPostscript(interp, canvas, linePtr, @@ -2417,7 +2417,7 @@ LineToPostscript( } } if (linePtr->lastArrowPtr != NULL) { - if (stipple) { + if (stipple != None) { Tcl_AppendToObj(psObj, "grestore gsave\n", -1); } if (ArrowheadPostscript(interp, canvas, linePtr, @@ -2482,11 +2482,11 @@ ArrowheadPostscript( stipple = linePtr->outline.stipple; if (Canvas(canvas)->currentItemPtr == (Tk_Item *) linePtr) { - if (linePtr->outline.activeStipple) { + if (linePtr->outline.activeStipple!=None) { stipple = linePtr->outline.activeStipple; } } else if (state == TK_STATE_DISABLED) { - if (linePtr->outline.activeStipple) { + if (linePtr->outline.activeStipple!=None) { stipple = linePtr->outline.disabledStipple; } } diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index 9cd7f84..5ab3a28 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -961,7 +961,7 @@ void Tk_CreateOutline( Tk_Outline *outline) /* Outline structure to be filled in. */ { - outline->gc = 0; + outline->gc = NULL; outline->width = 1.0; outline->activeWidth = 0.0; outline->disabledWidth = 0.0; @@ -975,9 +975,9 @@ Tk_CreateOutline( outline->color = NULL; outline->activeColor = NULL; outline->disabledColor = NULL; - outline->stipple = 0; - outline->activeStipple = 0; - outline->disabledStipple = 0; + outline->stipple = None; + outline->activeStipple = None; + outline->disabledStipple = None; } /* @@ -1002,7 +1002,7 @@ Tk_DeleteOutline( Display *display, /* Display containing window. */ Tk_Outline *outline) { - if (outline->gc) { + if (outline->gc != None) { Tk_FreeGC(display, outline->gc); } if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) { @@ -1014,22 +1014,22 @@ Tk_DeleteOutline( if ((unsigned) ABS(outline->disabledDash.number) > sizeof(char *)) { ckfree(outline->disabledDash.pattern.pt); } - if (outline->color) { + if (outline->color != NULL) { Tk_FreeColor(outline->color); } - if (outline->activeColor) { + if (outline->activeColor != NULL) { Tk_FreeColor(outline->activeColor); } - if (outline->disabledColor) { + if (outline->disabledColor != NULL) { Tk_FreeColor(outline->disabledColor); } - if (outline->stipple) { + if (outline->stipple != None) { Tk_FreeBitmap(display, outline->stipple); } - if (outline->activeStipple) { + if (outline->activeStipple != None) { Tk_FreeBitmap(display, outline->activeStipple); } - if (outline->disabledStipple) { + if (outline->disabledStipple != None) { Tk_FreeBitmap(display, outline->disabledStipple); } } @@ -1095,26 +1095,26 @@ Tk_ConfigOutlineGC( if (outline->activeWidth>width) { width = outline->activeWidth; } - if (outline->activeDash.number) { + if (outline->activeDash.number != 0) { dash = &(outline->activeDash); } - if (outline->activeColor) { + if (outline->activeColor!=NULL) { color = outline->activeColor; } - if (outline->activeStipple) { + if (outline->activeStipple!=None) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (outline->disabledWidth>0) { width = outline->disabledWidth; } - if (outline->disabledDash.number) { + if (outline->disabledDash.number != 0) { dash = &(outline->disabledDash); } - if (outline->disabledColor) { + if (outline->disabledColor!=NULL) { color = outline->disabledColor; } - if (outline->disabledStipple) { + if (outline->disabledStipple!=None) { stipple = outline->disabledStipple; } } @@ -1127,18 +1127,18 @@ Tk_ConfigOutlineGC( if (color != NULL) { gcValues->foreground = color->pixel; mask = GCForeground|GCLineWidth; - if (stipple) { + if (stipple != None) { gcValues->stipple = stipple; gcValues->fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } } - if (mask && dash->number) { + if (mask && (dash->number != 0)) { 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) { + } else if (dash->number != 0) { gcValues->dashes = dash->pattern.array[0]; } else { gcValues->dashes = (char) (4 * width + 0.5); @@ -1193,30 +1193,30 @@ Tk_ChangeOutlineGC( if (outline->activeWidth > width) { width = outline->activeWidth; } - if (outline->activeDash.number) { + if (outline->activeDash.number != 0) { dash = &(outline->activeDash); } - if (outline->activeColor) { + if (outline->activeColor != NULL) { color = outline->activeColor; } - if (outline->activeStipple) { + if (outline->activeStipple != None) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (outline->disabledWidth > width) { width = outline->disabledWidth; } - if (outline->disabledDash.number) { + if (outline->disabledDash.number != 0) { dash = &(outline->disabledDash); } - if (outline->disabledColor) { + if (outline->disabledColor != NULL) { color = outline->disabledColor; } - if (outline->disabledStipple) { + if (outline->disabledStipple != None) { stipple = outline->disabledStipple; } } - if (!color) { + if (color==NULL) { return 0; } @@ -1237,7 +1237,7 @@ Tk_ChangeOutlineGC( XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, p, dash->number); } - if (stipple) { + if (stipple!=None) { int w = 0; int h = 0; Tk_TSOffset *tsoffset = &outline->tsoffset; int flags = tsoffset->flags; @@ -1312,26 +1312,26 @@ Tk_ResetOutlineGC( if (outline->activeWidth>width) { width = outline->activeWidth; } - if (outline->activeDash.number) { + if (outline->activeDash.number != 0) { dash = &(outline->activeDash); } - if (outline->activeColor) { + if (outline->activeColor!=NULL) { color = outline->activeColor; } - if (outline->activeStipple) { + if (outline->activeStipple!=None) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (outline->disabledWidth>width) { width = outline->disabledWidth; } - if (outline->disabledDash.number) { + if (outline->disabledDash.number != 0) { dash = &(outline->disabledDash); } - if (outline->disabledColor) { + if (outline->disabledColor!=NULL) { color = outline->disabledColor; } - if (outline->disabledStipple) { + if (outline->disabledStipple!=None) { stipple = outline->disabledStipple; } } @@ -1344,7 +1344,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) { + } else if (dash->number != 0) { dashList = dash->pattern.array[0]; } else { dashList = (char) (4 * width + 0.5); @@ -1352,7 +1352,7 @@ Tk_ResetOutlineGC( XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, &dashList , 1); } - if (stipple) { + if (stipple != None) { XSetTSOrigin(Canvas(canvas)->display, outline->gc, 0, 0); return 1; } @@ -1405,10 +1405,10 @@ Tk_CanvasPsOutline( if (outline->activeDash.number > 0) { dash = &outline->activeDash; } - if (outline->activeColor) { + if (outline->activeColor != NULL) { color = outline->activeColor; } - if (outline->activeStipple) { + if (outline->activeStipple != None) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { @@ -1418,10 +1418,10 @@ Tk_CanvasPsOutline( if (outline->disabledDash.number > 0) { dash = &outline->disabledDash; } - if (outline->disabledColor) { + if (outline->disabledColor != NULL) { color = outline->disabledColor; } - if (outline->disabledStipple) { + if (outline->disabledStipple != None) { stipple = outline->disabledStipple; } } diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 51d54ec..f73546f 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -579,7 +579,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) { + if (state == TK_STATE_HIDDEN || drawable == None) { if (canvasTkwin == Tk_Parent(winItemPtr->tkwin)) { Tk_UnmapWindow(winItemPtr->tkwin); } else { diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 1671c5f..134ff8d 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -678,9 +678,9 @@ Tk_CanvasObjCmd( canvasPtr->highlightBgColorPtr = NULL; canvasPtr->highlightColorPtr = NULL; canvasPtr->inset = 0; - canvasPtr->pixmapGC = 0; - canvasPtr->width = 0; - canvasPtr->height = 0; + canvasPtr->pixmapGC = NULL; + canvasPtr->width = None; + canvasPtr->height = None; canvasPtr->confine = 0; canvasPtr->textInfo.selBorder = NULL; canvasPtr->textInfo.selBorderWidth = 0; @@ -724,7 +724,7 @@ Tk_CanvasObjCmd( canvasPtr->scanYOrigin = 0; canvasPtr->hotPtr = NULL; canvasPtr->hotPrevPtr = NULL; - canvasPtr->cursor = 0; + canvasPtr->cursor = NULL; canvasPtr->takeFocus = NULL; canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin)); canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin)); @@ -2189,7 +2189,7 @@ DestroyCanvas( */ Tcl_DeleteHashTable(&canvasPtr->idTable); - if (canvasPtr->pixmapGC) { + if (canvasPtr->pixmapGC != None) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } #ifndef USE_OLD_TAG_SEARCH @@ -2265,7 +2265,7 @@ ConfigureCanvas( gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; newGC = Tk_GetGC(canvasPtr->tkwin, GCFunction|GCGraphicsExposures|GCForeground, &gcValues); - if (canvasPtr->pixmapGC) { + if (canvasPtr->pixmapGC != None) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } canvasPtr->pixmapGC = newGC; @@ -4901,7 +4901,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 = 0; + canvasPtr->pickEvent.xcrossing.subwindow = None; 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 0f51caa..b902625 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -659,7 +659,7 @@ TkClipInit( Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts); Tk_MakeWindowExist(dispPtr->clipWindow); - if (!dispPtr->multipleAtom) { + if (dispPtr->multipleAtom == None) { /* * 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 229e3b2..0798067 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -436,7 +436,7 @@ Tk_GCForColor( Tcl_Panic("Tk_GCForColor called with bogus color"); } - if (!tkColPtr->gc) { + if (tkColPtr->gc == None) { gcValues.foreground = tkColPtr->color.pixel; tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable, GCForeground, &gcValues); @@ -491,7 +491,7 @@ Tk_FreeColor( * longer any objects referencing it. */ - if (tkColPtr->gc) { + if (tkColPtr->gc != None) { XFreeGC(DisplayOfScreen(screen), tkColPtr->gc); tkColPtr->gc = 0; } diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 4e246c0..2465d5b 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -748,10 +748,10 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; - newBitmap = 0; + newBitmap = None; } else { newBitmap = Tk_AllocBitmapFromObj(interp, tkwin, valuePtr); - if (!newBitmap) { + if (newBitmap == None) { return TCL_ERROR; } } @@ -804,7 +804,7 @@ DoObjConfig( valuePtr = NULL; } else { newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr); - if (!newCursor) { + if (newCursor == None) { return TCL_ERROR; } } @@ -1646,9 +1646,9 @@ FreeResources( break; case TK_OPTION_BITMAP: if (internalFormExists) { - if (*((Pixmap *) internalPtr)) { + if (*((Pixmap *) internalPtr) != None) { Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *) internalPtr)); - *((Pixmap *) internalPtr) = 0; + *((Pixmap *) internalPtr) = None; } } else if (objPtr != NULL) { Tk_FreeBitmapFromObj(tkwin, objPtr); @@ -1666,7 +1666,7 @@ FreeResources( break; case TK_OPTION_CURSOR: if (internalFormExists) { - if (*((Tk_Cursor *) internalPtr)) { + if (*((Tk_Cursor *) internalPtr) != None) { Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr)); *((Tk_Cursor *) internalPtr) = 0; } @@ -1919,7 +1919,7 @@ GetObjectForOption( case TK_OPTION_BITMAP: { Pixmap pixmap = *((Pixmap *) internalPtr); - if (pixmap) { + if (pixmap != None) { objPtr = Tcl_NewStringObj( Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1); } @@ -1939,7 +1939,7 @@ GetObjectForOption( case TK_OPTION_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) internalPtr); - if (cursor) { + if (cursor != None) { objPtr = Tcl_NewStringObj( Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1); } diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 6d109c7..18a0d72 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -188,11 +188,7 @@ Tk_GetCursor( * details on legal syntax. */ { TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string); - - if (cursorPtr == NULL) { - return 0; - } - return cursorPtr->cursor; + return cursorPtr ? cursorPtr->cursor : NULL; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 4851da1..9df8da6 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -524,16 +524,16 @@ Tk_EntryObjCmd( entryPtr->selectFirst = -1; entryPtr->selectLast = -1; - entryPtr->cursor = 0; + entryPtr->cursor = NULL; entryPtr->exportSelection = 1; entryPtr->justify = TK_JUSTIFY_LEFT; entryPtr->relief = TK_RELIEF_FLAT; entryPtr->state = STATE_NORMAL; entryPtr->displayString = entryPtr->string; entryPtr->inset = XPAD; - entryPtr->textGC = 0; - entryPtr->selTextGC = 0; - entryPtr->highlightGC = 0; + entryPtr->textGC = NULL; + entryPtr->selTextGC = NULL; + entryPtr->highlightGC = NULL; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; @@ -1033,10 +1033,10 @@ DestroyEntry( EntryTextVarProc, entryPtr); entryPtr->flags &= ~ENTRY_VAR_TRACED; } - if (entryPtr->textGC) { + if (entryPtr->textGC != None) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } - if (entryPtr->selTextGC) { + if (entryPtr->selTextGC != None) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler); @@ -1046,7 +1046,7 @@ DestroyEntry( if (entryPtr->type == TK_SPINBOX) { Spinbox *sbPtr = (Spinbox *) entryPtr; - if (sbPtr->listObj) { + if (sbPtr->listObj != NULL) { Tcl_DecrRefCount(sbPtr->listObj); sbPtr->listObj = NULL; } @@ -1430,7 +1430,7 @@ EntryWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = 0; + GC gc = NULL; unsigned long mask; Tk_3DBorder border; XColor *colorPtr; @@ -1482,18 +1482,18 @@ EntryWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->textGC) { + if (entryPtr->textGC != None) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } entryPtr->textGC = gc; - if (entryPtr->selFgColorPtr) { + if (entryPtr->selFgColorPtr != NULL) { gcValues.foreground = entryPtr->selFgColorPtr->pixel; } gcValues.font = Tk_FontId(entryPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->selTextGC) { + if (entryPtr->selTextGC != None) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } entryPtr->selTextGC = gc; @@ -2457,7 +2457,7 @@ EntryEventProc( } else if ((elem == SEL_BUTTONDOWN) || (elem == SEL_BUTTONUP)) { cursor = sbPtr->bCursor; } else { - cursor = 0; + cursor = NULL; } if (cursor) { Tk_DefineCursor(entryPtr->tkwin, cursor); @@ -3633,22 +3633,22 @@ Tk_SpinboxObjCmd( entryPtr->selectFirst = -1; entryPtr->selectLast = -1; - entryPtr->cursor = 0; + entryPtr->cursor = NULL; entryPtr->exportSelection = 1; entryPtr->justify = TK_JUSTIFY_LEFT; entryPtr->relief = TK_RELIEF_FLAT; entryPtr->state = STATE_NORMAL; entryPtr->displayString = entryPtr->string; entryPtr->inset = XPAD; - entryPtr->textGC = 0; - entryPtr->selTextGC = 0; - entryPtr->highlightGC = 0; + entryPtr->textGC = NULL; + entryPtr->selTextGC = NULL; + entryPtr->highlightGC = NULL; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; sbPtr->selElement = SEL_NONE; sbPtr->curElement = SEL_NONE; - sbPtr->bCursor = 0; + sbPtr->bCursor = NULL; sbPtr->repeatDelay = 400; sbPtr->repeatInterval = 100; sbPtr->fromValue = 0.0; diff --git a/generic/tkEntry.h b/generic/tkEntry.h index 12c0374..52535c8 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -221,7 +221,7 @@ typedef struct { * value that the users requests. Malloc'ed */ char *valueFormat; /* Sprintf conversion specifier used for the * value. */ - char digitFormat[16]; /* Sprintf conversion specifier computed from + char digitFormat[10]; /* Sprintf conversion specifier computed from * digits and other information; used for the * value. */ diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 8320ec9..b68ba54 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -416,11 +416,11 @@ GetTkWindowFromXEvent( } TkSelPropProc(eventPtr); parentXId = ParentXId(eventPtr->xany.display, handlerWindow); - if (!parentXId) { + if (parentXId == None) { return NULL; } winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, parentXId); - if (!winPtr) { + if (winPtr == NULL) { return NULL; } if (!(winPtr->flags & TK_PROP_PROPCHANGE)) { @@ -596,7 +596,7 @@ UpdateButtonEventState( case ButtonRelease: dispPtr = TkGetDisplay(eventPtr->xbutton.display); - dispPtr->mouseButtonWindow = 0; + dispPtr->mouseButtonWindow = None; dispPtr->mouseButtonState &= ~GetButtonMask(eventPtr->xbutton.button); eventPtr->xbutton.state |= dispPtr->mouseButtonState; break; @@ -612,7 +612,7 @@ UpdateButtonEventState( */ dispPtr->mouseButtonState &= ~allButtonsMask; - dispPtr->mouseButtonWindow = 0; + dispPtr->mouseButtonWindow = None; } else { eventPtr->xmotion.state |= dispPtr->mouseButtonState; } @@ -1185,7 +1185,7 @@ ParentXId( XFree(childList); } if (status == 0) { - parent = 0; + parent = None; } return parent; @@ -1368,7 +1368,7 @@ Tk_HandleEvent( * handle CreateNotify events, so we gotta pass 'em through. */ - if ((ip.winPtr) + if ((ip.winPtr != None) && ((mask != SubstructureNotifyMask) || (eventPtr->type == CreateNotify))) { TkBindEventProc(winPtr, eventPtr); @@ -1382,7 +1382,7 @@ Tk_HandleEvent( */ releaseInterpreter: - if (interp) { + if (interp != NULL) { Tcl_Release(interp); } @@ -1430,7 +1430,7 @@ TkEventDeadWindow( * to quit (all of the handlers are being deleted). */ - while (winPtr->handlerList) { + while (winPtr->handlerList != NULL) { handlerPtr = winPtr->handlerList; winPtr->handlerList = handlerPtr->nextPtr; for (ipPtr = tsdPtr->pendingPtr; ipPtr != NULL; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 9520d65..81b6405 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -513,7 +513,7 @@ CreateFrame( */ className = colormapName = screenName = visualName = useOption = NULL; - colormap = 0; + colormap = None; for (i = 2; i < objc; i += 2) { arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { @@ -617,14 +617,14 @@ CreateFrame( if (visualName != NULL) { visual = Tk_GetVisual(interp, newWin, visualName, &depth, (colormapName == NULL) ? &colormap : NULL); - if (!visual) { + if (visual == NULL) { goto error; } Tk_SetWindowVisual(newWin, visual, depth, colormap); } - if (colormapName) { + if (colormapName != NULL) { colormap = Tk_GetColormap(interp, newWin, colormapName); - if (!colormap) { + if (colormap == None) { goto error; } Tk_SetWindowColormap(newWin, colormap); @@ -662,13 +662,13 @@ CreateFrame( framePtr->type = type; framePtr->colormap = colormap; framePtr->relief = TK_RELIEF_FLAT; - framePtr->cursor = 0; + framePtr->cursor = NULL; if (framePtr->type == TYPE_LABELFRAME) { Labelframe *labelframePtr = (Labelframe *) framePtr; labelframePtr->labelAnchor = LABELANCHOR_NW; - labelframePtr->textGC = 0; + labelframePtr->textGC = NULL; } /* @@ -864,11 +864,11 @@ DestroyFrame( if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); - if (labelframePtr->textGC) { + if (labelframePtr->textGC != None) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } } - if (framePtr->colormap) { + if (framePtr->colormap != None) { Tk_FreeColormap(framePtr->display, framePtr->colormap); } ckfree(framePtr); @@ -990,7 +990,7 @@ ConfigureFrame( if (framePtr->border != NULL) { Tk_SetBackgroundFromBorder(framePtr->tkwin, framePtr->border); } else { - Tk_SetWindowBackgroundPixmap(framePtr->tkwin, 0); + Tk_SetWindowBackgroundPixmap(framePtr->tkwin, None); } if (framePtr->highlightWidth < 0) { @@ -1120,7 +1120,7 @@ FrameWorldChanged( gcValues.graphics_exposures = False; gc = Tk_GetGC(tkwin, GCForeground | GCFont | GCGraphicsExposures, &gcValues); - if (labelframePtr->textGC) { + if (labelframePtr->textGC != None) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } labelframePtr->textGC = gc; @@ -1563,8 +1563,8 @@ DisplayFrame( labelframePtr->labelTextX + LABELSPACING, labelframePtr->labelTextY + LABELSPACING, 0, -1); - if (clipRegion) { - XSetClipMask(framePtr->display, labelframePtr->textGC, 0); + if (clipRegion != NULL) { + XSetClipMask(framePtr->display, labelframePtr->textGC, None); TkDestroyRegion(clipRegion); } } else { diff --git a/generic/tkGC.c b/generic/tkGC.c index f896fc4..c424e30 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 = 0; + valueKey.values.tile = None; } if (valueMask & GCStipple) { valueKey.values.stipple = valuePtr->stipple; } else { - valueKey.values.stipple = 0; + valueKey.values.stipple = None; } 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 = 0; + valueKey.values.font = None; } 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 = 0; + valueKey.values.clip_mask = None; } if (valueMask & GCDashOffset) { valueKey.values.dash_offset = valuePtr->dash_offset; @@ -236,8 +236,8 @@ Tk_GetGC( * Tk_MakeWindowExist on the window. */ - freeDrawable = 0; - if (Tk_WindowId(tkwin)) { + freeDrawable = None; + if (Tk_WindowId(tkwin) != None) { 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) { + if (freeDrawable != None) { Tk_FreePixmap(valueKey.display, freeDrawable); } diff --git a/generic/tkGrab.c b/generic/tkGrab.c index c67b27b..00d4511 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -478,8 +478,8 @@ Tk_Grab( for (numTries = 0; numTries < 10; numTries++) { grabResult = XGrabPointer(dispPtr->display, winPtr->window, True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask - |PointerMotionMask, GrabModeAsync, GrabModeAsync, 0, - 0, CurrentTime); + |PointerMotionMask, GrabModeAsync, GrabModeAsync, None, + None, CurrentTime); if (grabResult != AlreadyGrabbed) { break; } @@ -870,7 +870,7 @@ TkPointerEvent( if (XGrabPointer(dispPtr->display, dispPtr->grabWinPtr->window, True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask, - GrabModeAsync, GrabModeAsync, 0, 0, + GrabModeAsync, GrabModeAsync, None, None, CurrentTime) == 0) { EatGrabEvents(dispPtr, serial); if (XGrabKeyboard(dispPtr->display, winPtr->window, @@ -937,7 +937,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 = 0; + eventPtr->xmotion.subwindow = None; for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { if (childPtr->flags & TK_TOP_HIERARCHY) { @@ -956,7 +956,7 @@ TkChangeEventWindow( } else { eventPtr->xmotion.x = 0; eventPtr->xmotion.y = 0; - eventPtr->xmotion.subwindow = 0; + eventPtr->xmotion.subwindow = None; sameScreen = 0; } if (eventPtr->type == MotionNotify) { @@ -1045,7 +1045,7 @@ TkInOutEvents( */ #define QUEUE(w, t, d) \ - if (w->window) { \ + if (w->window != None) { \ eventPtr->type = t; \ if (focus) { \ eventPtr->xfocus.window = w->window; \ @@ -1161,9 +1161,9 @@ MovePointer2( TkWindow *winPtr; winPtr = sourcePtr; - if (!winPtr || !winPtr->window) { + if ((winPtr == NULL) || (winPtr->window == None)) { winPtr = destPtr; - if (!winPtr || !winPtr->window) { + if ((winPtr == NULL) || (winPtr->window == None)) { return; } } @@ -1355,7 +1355,7 @@ QueueGrabWindowChange( grabEvPtr->header.proc = GrabWinEventProc; grabEvPtr->dispPtr = dispPtr; if (grabWinPtr == NULL) { - grabEvPtr->grabWindow = 0; + grabEvPtr->grabWindow = None; } else { grabEvPtr->grabWindow = grabWinPtr->window; } diff --git a/generic/tkImage.c b/generic/tkImage.c index d579c55..359d6c6 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -775,7 +775,7 @@ Tk_PostscriptImage( gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); - if (newGC) { + if (newGC != None) { XFillRectangle(Tk_Display(tkwin), pmap, newGC, 0, 0, (unsigned) width, (unsigned) height); Tk_FreeGC(Tk_Display(tkwin), newGC); @@ -788,7 +788,7 @@ Tk_PostscriptImage( Tk_FreePixmap(Tk_Display(tkwin), pmap); - if (!ximage) { + if (ximage == NULL) { /* * The XGetImage() function is apparently not implemented on this * system. Just ignore it. diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 371c9e0..aa977c4 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -384,9 +384,9 @@ ImgBmapConfigureInstance( */ oldBitmap = instancePtr->bitmap; - instancePtr->bitmap = 0; + instancePtr->bitmap = None; oldMask = instancePtr->mask; - instancePtr->mask = 0; + instancePtr->mask = None; if (masterPtr->data != NULL) { instancePtr->bitmap = XCreateBitmapFromData( @@ -417,7 +417,7 @@ ImgBmapConfigureInstance( if (instancePtr->bg) { gcValues.background = instancePtr->bg->pixel; mask |= GCBackground; - if (instancePtr->mask) { + if (instancePtr->mask != None) { gcValues.clip_mask = instancePtr->mask; mask |= GCClipMask; } @@ -427,7 +427,7 @@ ImgBmapConfigureInstance( } gc = Tk_GetGC(instancePtr->tkwin, mask, &gcValues); } else { - gc = 0; + gc = NULL; } if (instancePtr->gc) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); @@ -444,7 +444,7 @@ ImgBmapConfigureInstance( if (instancePtr->gc) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } - instancePtr->gc = 0; + instancePtr->gc = NULL; Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf( "\n (while configuring image \"%s\")", Tk_NameOfImage( masterPtr->tkMaster))); @@ -846,9 +846,9 @@ ImgBmapGet( instancePtr->tkwin = tkwin; instancePtr->fg = NULL; instancePtr->bg = NULL; - instancePtr->bitmap = 0; - instancePtr->mask = 0; - instancePtr->gc = 0; + instancePtr->bitmap = None; + instancePtr->mask = None; + instancePtr->gc = NULL; instancePtr->nextPtr = masterPtr->instancePtr; masterPtr->instancePtr = instancePtr; ImgBmapConfigureInstance(instancePtr); @@ -902,7 +902,7 @@ ImgBmapDisplay( * creating the image instance so it can't be displayed. */ - if (!instancePtr->gc) { + if (instancePtr->gc == None) { return; } @@ -912,7 +912,7 @@ ImgBmapDisplay( * image and reset the clip origin, if there's a mask. */ - masking = instancePtr->mask || !instancePtr->bg; + masking = (instancePtr->mask != None) || (instancePtr->bg == NULL); if (masking) { XSetClipOrigin(display, instancePtr->gc, drawableX - imageX, drawableY - imageY); @@ -961,19 +961,19 @@ ImgBmapFree( * instance structure. */ - if (instancePtr->fg) { + if (instancePtr->fg != NULL) { Tk_FreeColor(instancePtr->fg); } - if (instancePtr->bg) { + if (instancePtr->bg != NULL) { Tk_FreeColor(instancePtr->bg); } - if (instancePtr->bitmap) { + if (instancePtr->bitmap != None) { Tk_FreePixmap(display, instancePtr->bitmap); } - if (instancePtr->mask) { + if (instancePtr->mask != None) { Tk_FreePixmap(display, instancePtr->mask); } - if (instancePtr->gc) { + if (instancePtr->gc != None) { Tk_FreeGC(display, instancePtr->gc); } if (instancePtr->masterPtr->instancePtr == instancePtr) { @@ -1012,17 +1012,17 @@ ImgBmapDelete( { BitmapMaster *masterPtr = masterData; - if (masterPtr->instancePtr) { + if (masterPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); } masterPtr->tkMaster = NULL; - if (masterPtr->imageCmd) { + if (masterPtr->imageCmd != NULL) { Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd); } - if (masterPtr->data) { + if (masterPtr->data != NULL) { ckfree(masterPtr->data); } - if (masterPtr->maskData) { + if (masterPtr->maskData != NULL) { ckfree(masterPtr->maskData); } Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0); @@ -1054,7 +1054,7 @@ ImgBmapCmdDeletedProc( BitmapMaster *masterPtr = clientData; masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster) { + if (masterPtr->tkMaster != NULL) { Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); } } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 371fe42..b2584da 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -542,15 +542,15 @@ Tk_ListboxObjCmd( listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS); listPtr->relief = TK_RELIEF_RAISED; - listPtr->textGC = 0; - listPtr->selFgColorPtr = 0; - listPtr->selTextGC = 0; + listPtr->textGC = NULL; + listPtr->selFgColorPtr = NULL; + listPtr->selTextGC = NULL; listPtr->fullLines = 1; listPtr->xScrollUnit = 1; listPtr->exportSelection = 1; - listPtr->cursor = 0; + listPtr->cursor = NULL; listPtr->state = STATE_NORMAL; - listPtr->gray = 0; + listPtr->gray = None; listPtr->justify = TK_JUSTIFY_LEFT; /* @@ -1488,13 +1488,13 @@ DestroyListbox( * Tk_FreeOptions handle all the standard option-related stuff. */ - if (listPtr->textGC) { + if (listPtr->textGC != None) { Tk_FreeGC(listPtr->display, listPtr->textGC); } - if (listPtr->selTextGC) { + if (listPtr->selTextGC != None) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } - if (listPtr->gray) { + if (listPtr->gray != None) { Tk_FreeBitmap(Tk_Display(listPtr->tkwin), listPtr->gray); } @@ -1779,10 +1779,10 @@ ListboxWorldChanged( } else { gcValues.foreground = listPtr->fgColorPtr->pixel; mask = GCForeground | GCFont; - if (!listPtr->gray) { + if (listPtr->gray == None) { listPtr->gray = Tk_GetBitmap(NULL, listPtr->tkwin, "gray50"); } - if (listPtr->gray) { + if (listPtr->gray != None) { gcValues.fill_style = FillStippled; gcValues.stipple = listPtr->gray; mask |= GCFillStyle | GCStipple; @@ -1791,18 +1791,18 @@ ListboxWorldChanged( gcValues.font = Tk_FontId(listPtr->tkfont); gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); - if (listPtr->textGC) { + if (listPtr->textGC != None) { Tk_FreeGC(listPtr->display, listPtr->textGC); } listPtr->textGC = gc; - if (listPtr->selFgColorPtr) { + if (listPtr->selFgColorPtr != NULL) { gcValues.foreground = listPtr->selFgColorPtr->pixel; } gcValues.font = Tk_FontId(listPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); - if (listPtr->selTextGC) { + if (listPtr->selTextGC != None) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } listPtr->selTextGC = gc; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 7bc680c..a31666d 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -455,7 +455,7 @@ Tk_MenuObjCmd( Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, MenuCmdDeletedProc); menuPtr->active = -1; - menuPtr->cursorPtr = 0; + menuPtr->cursorPtr = NULL; menuPtr->masterMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; TkMenuInitializeDrawingFields(menuPtr); diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index df501c3..e9b1c98 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -43,12 +43,12 @@ void TkMenuInitializeDrawingFields( TkMenu *menuPtr) /* The menu we are initializing. */ { - menuPtr->textGC = 0; - menuPtr->gray = 0; - menuPtr->disabledGC = 0; - menuPtr->activeGC = 0; - menuPtr->indicatorGC = 0; - menuPtr->disabledImageGC = 0; + menuPtr->textGC = NULL; + menuPtr->gray = None; + menuPtr->disabledGC = NULL; + menuPtr->activeGC = NULL; + menuPtr->indicatorGC = NULL; + menuPtr->disabledImageGC = NULL; menuPtr->totalWidth = menuPtr->totalHeight = 0; } @@ -79,10 +79,10 @@ TkMenuInitializeEntryDrawingFields( mePtr->y = 0; mePtr->indicatorSpace = 0; mePtr->labelWidth = 0; - mePtr->textGC = 0; - mePtr->activeGC = 0; - mePtr->disabledGC = 0; - mePtr->indicatorGC = 0; + mePtr->textGC = NULL; + mePtr->activeGC = NULL; + mePtr->disabledGC = NULL; + mePtr->indicatorGC = NULL; } /* @@ -106,22 +106,22 @@ void TkMenuFreeDrawOptions( TkMenu *menuPtr) { - if (menuPtr->textGC) { + if (menuPtr->textGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->textGC); } - if (menuPtr->disabledImageGC) { + if (menuPtr->disabledImageGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->disabledImageGC); } - if (menuPtr->gray) { + if (menuPtr->gray != None) { Tk_FreeBitmap(menuPtr->display, menuPtr->gray); } - if (menuPtr->disabledGC) { + if (menuPtr->disabledGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->disabledGC); } - if (menuPtr->activeGC) { + if (menuPtr->activeGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->activeGC); } - if (menuPtr->indicatorGC) { + if (menuPtr->indicatorGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC); } } @@ -147,16 +147,16 @@ void TkMenuEntryFreeDrawOptions( TkMenuEntry *mePtr) { - if (mePtr->textGC) { + if (mePtr->textGC != None) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->textGC); } - if (mePtr->disabledGC) { + if (mePtr->disabledGC != None) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->disabledGC); } - if (mePtr->activeGC) { + if (mePtr->activeGC != None) { Tk_FreeGC(mePtr->menuPtr->display, mePtr->activeGC); } - if (mePtr->indicatorGC) { + if (mePtr->indicatorGC != None) { 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) { + if (menuPtr->textGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->textGC); } menuPtr->textGC = newGC; @@ -222,34 +222,34 @@ TkMenuConfigureDrawOptions( } else { gcValues.foreground = gcValues.background; mask = GCForeground; - if (!menuPtr->gray) { + if (menuPtr->gray == None) { menuPtr->gray = Tk_GetBitmap(menuPtr->interp, menuPtr->tkwin, "gray50"); } - if (menuPtr->gray) { + if (menuPtr->gray != None) { gcValues.fill_style = FillStippled; gcValues.stipple = menuPtr->gray; mask = GCForeground|GCFillStyle|GCStipple; } } newGC = Tk_GetGC(menuPtr->tkwin, mask, &gcValues); - if (menuPtr->disabledGC) { + if (menuPtr->disabledGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->disabledGC); } menuPtr->disabledGC = newGC; gcValues.foreground = Tk_3DBorderColor(border)->pixel; - if (!menuPtr->gray) { + if (menuPtr->gray == None) { menuPtr->gray = Tk_GetBitmap(menuPtr->interp, menuPtr->tkwin, "gray50"); } - if (menuPtr->gray) { + if (menuPtr->gray != None) { gcValues.fill_style = FillStippled; gcValues.stipple = menuPtr->gray; newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCFillStyle|GCStipple, &gcValues); } - if (menuPtr->disabledImageGC) { + if (menuPtr->disabledImageGC != None) { 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) { + if (menuPtr->activeGC != None) { 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) { + if (menuPtr->indicatorGC != None) { Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC); } menuPtr->indicatorGC = newGC; @@ -385,24 +385,24 @@ TkMenuConfigureEntryDrawOptions( GCForeground|GCBackground|GCFont|GCGraphicsExposures, &gcValues); } else { - newGC = 0; - newActiveGC = 0; - newDisabledGC = 0; - newIndicatorGC = 0; + newGC = NULL; + newActiveGC = NULL; + newDisabledGC = NULL; + newIndicatorGC = NULL; } - if (mePtr->textGC) { + if (mePtr->textGC != None) { Tk_FreeGC(menuPtr->display, mePtr->textGC); } mePtr->textGC = newGC; - if (mePtr->activeGC) { + if (mePtr->activeGC != None) { Tk_FreeGC(menuPtr->display, mePtr->activeGC); } mePtr->activeGC = newActiveGC; - if (mePtr->disabledGC) { + if (mePtr->disabledGC != None) { Tk_FreeGC(menuPtr->display, mePtr->disabledGC); } mePtr->disabledGC = newDisabledGC; - if (mePtr->indicatorGC) { + if (mePtr->indicatorGC != None) { Tk_FreeGC(menuPtr->display, mePtr->indicatorGC); } mePtr->indicatorGC = newIndicatorGC; diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 4bb2b43..f0927c9 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -263,7 +263,7 @@ Tk_MenubuttonObjCmd( mbPtr->text = NULL; mbPtr->underline = -1; mbPtr->textVarName = NULL; - mbPtr->bitmap = 0; + mbPtr->bitmap = None; mbPtr->imageString = NULL; mbPtr->image = NULL; mbPtr->state = STATE_NORMAL; @@ -279,11 +279,11 @@ Tk_MenubuttonObjCmd( mbPtr->normalFg = NULL; mbPtr->activeFg = NULL; mbPtr->disabledFg = NULL; - mbPtr->normalTextGC = 0; - mbPtr->activeTextGC = 0; - mbPtr->gray = 0; - mbPtr->disabledGC = 0; - mbPtr->stippleGC = 0; + mbPtr->normalTextGC = NULL; + mbPtr->activeTextGC = NULL; + mbPtr->gray = None; + mbPtr->disabledGC = NULL; + mbPtr->stippleGC = NULL; mbPtr->leftBearing = 0; mbPtr->rightBearing = 0; mbPtr->widthString = NULL; @@ -300,7 +300,7 @@ Tk_MenubuttonObjCmd( mbPtr->indicatorWidth = 0; mbPtr->indicatorHeight = 0; mbPtr->direction = DIRECTION_FLUSH; - mbPtr->cursor = 0; + mbPtr->cursor = NULL; mbPtr->takeFocus = NULL; mbPtr->flags = 0; @@ -443,22 +443,22 @@ DestroyMenuButton( if (mbPtr->image != NULL) { Tk_FreeImage(mbPtr->image); } - if (mbPtr->normalTextGC) { + if (mbPtr->normalTextGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC); } - if (mbPtr->activeTextGC) { + if (mbPtr->activeTextGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } - if (mbPtr->disabledGC) { + if (mbPtr->disabledGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } - if (mbPtr->stippleGC) { + if (mbPtr->stippleGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->stippleGC); } - if (mbPtr->gray) { + if (mbPtr->gray != None) { Tk_FreeBitmap(mbPtr->display, mbPtr->gray); } - if (mbPtr->textLayout) { + if (mbPtr->textLayout != NULL) { Tk_FreeTextLayout(mbPtr->textLayout); } Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, mbPtr->tkwin); @@ -587,7 +587,7 @@ ConfigureMenuButton( * Recompute the geometry for the button. */ - if (mbPtr->bitmap || mbPtr->image) { + if ((mbPtr->bitmap != None) || (mbPtr->image != NULL)) { if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->widthString, &mbPtr->width) != TCL_OK) { widthError: @@ -690,7 +690,7 @@ TkMenuButtonWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->normalTextGC) { + if (mbPtr->normalTextGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC); } mbPtr->normalTextGC = gc; @@ -699,7 +699,7 @@ TkMenuButtonWorldChanged( gcValues.background = Tk_3DBorderColor(mbPtr->activeBorder)->pixel; mask = GCForeground | GCBackground | GCFont; gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->activeTextGC) { + if (mbPtr->activeTextGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } mbPtr->activeTextGC = gc; @@ -710,13 +710,13 @@ TkMenuButtonWorldChanged( * Create the GC that can be used for stippling */ - if (!mbPtr->stippleGC) { + if (mbPtr->stippleGC == None) { gcValues.foreground = gcValues.background; mask = GCForeground; - if (!mbPtr->gray) { + if (mbPtr->gray == None) { mbPtr->gray = Tk_GetBitmap(NULL, mbPtr->tkwin, "gray50"); } - if (mbPtr->gray) { + if (mbPtr->gray != None) { gcValues.fill_style = FillStippled; gcValues.stipple = mbPtr->gray; mask |= GCFillStyle | GCStipple; @@ -730,13 +730,13 @@ TkMenuButtonWorldChanged( */ mask = GCForeground | GCBackground | GCFont; - if (mbPtr->disabledFg) { + if (mbPtr->disabledFg != NULL) { gcValues.foreground = mbPtr->disabledFg->pixel; } else { gcValues.foreground = gcValues.background; } gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->disabledGC) { + if (mbPtr->disabledGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } mbPtr->disabledGC = gc; diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 24a55e9..e44da06 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -256,11 +256,11 @@ Tk_MessageObjCmd( MessageCmdDeletedProc); msgPtr->optionTable = optionTable; msgPtr->relief = TK_RELIEF_FLAT; - msgPtr->textGC = 0; + msgPtr->textGC = NULL; msgPtr->anchor = TK_ANCHOR_CENTER; msgPtr->aspect = 150; msgPtr->justify = TK_JUSTIFY_LEFT; - msgPtr->cursor = 0; + msgPtr->cursor = NULL; Tk_SetClass(msgPtr->tkwin, "Message"); Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr); @@ -398,13 +398,13 @@ DestroyMessage( * Tk_FreeConfigOptions handle all the standard option-related stuff. */ - if (msgPtr->textGC) { + if (msgPtr->textGC != None) { Tk_FreeGC(msgPtr->display, msgPtr->textGC); } - if (msgPtr->textLayout) { + if (msgPtr->textLayout != NULL) { Tk_FreeTextLayout(msgPtr->textLayout); } - if (msgPtr->textVarName) { + if (msgPtr->textVarName != NULL) { Tcl_UntraceVar2(msgPtr->interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, msgPtr); @@ -471,7 +471,7 @@ ConfigureMessage( const char *value; value = Tcl_GetVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY); - if (!value) { + if (value == NULL) { Tcl_SetVar2(interp, msgPtr->textVarName, NULL, msgPtr->string, TCL_GLOBAL_ONLY); } else { @@ -525,18 +525,18 @@ MessageWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = 0; + GC gc = NULL; Tk_FontMetrics fm; Message *msgPtr = instanceData; - if (msgPtr->border) { + if (msgPtr->border != NULL) { 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) { + if (msgPtr->textGC != None) { Tk_FreeGC(msgPtr->display, msgPtr->textGC); } msgPtr->textGC = gc; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index cda1cd3..698e8a9 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -432,16 +432,16 @@ DoConfig( Pixmap newBmp, oldBmp; if (nullValue) { - newBmp = 0; + newBmp = None; } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newBmp = Tk_GetBitmap(interp, tkwin, uid); - if (!newBmp) { + if (newBmp == None) { return TCL_ERROR; } } oldBmp = *((Pixmap *) ptr); - if (oldBmp) { + if (oldBmp != None) { Tk_FreeBitmap(Tk_Display(tkwin), oldBmp); } *((Pixmap *) ptr) = newBmp; @@ -455,12 +455,12 @@ DoConfig( } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newBorder = Tk_Get3DBorder(interp, tkwin, uid); - if (!newBorder) { + if (newBorder == NULL) { return TCL_ERROR; } } oldBorder = *((Tk_3DBorder *) ptr); - if (oldBorder) { + if (oldBorder != NULL) { Tk_Free3DBorder(oldBorder); } *((Tk_3DBorder *) ptr) = newBorder; @@ -481,12 +481,12 @@ DoConfig( } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newCursor = Tk_GetCursor(interp, tkwin, uid); - if (!newCursor) { + if (newCursor == None) { return TCL_ERROR; } } oldCursor = *((Tk_Cursor *) ptr); - if (oldCursor) { + if (oldCursor != None) { Tk_FreeCursor(Tk_Display(tkwin), oldCursor); } *((Tk_Cursor *) ptr) = newCursor; @@ -793,7 +793,7 @@ FormatConfigValue( case TK_CONFIG_UID: { Tk_Uid uid = *((Tk_Uid *) ptr); - if (uid) { + if (uid != NULL) { result = uid; } break; @@ -801,7 +801,7 @@ FormatConfigValue( case TK_CONFIG_COLOR: { XColor *colorPtr = *((XColor **) ptr); - if (colorPtr) { + if (colorPtr != NULL) { result = Tk_NameOfColor(colorPtr); } break; @@ -809,7 +809,7 @@ FormatConfigValue( case TK_CONFIG_FONT: { Tk_Font tkfont = *((Tk_Font *) ptr); - if (tkfont) { + if (tkfont != NULL) { result = Tk_NameOfFont(tkfont); } break; @@ -817,7 +817,7 @@ FormatConfigValue( case TK_CONFIG_BITMAP: { Pixmap pixmap = *((Pixmap *) ptr); - if (pixmap) { + if (pixmap != None) { result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); } break; @@ -825,7 +825,7 @@ FormatConfigValue( case TK_CONFIG_BORDER: { Tk_3DBorder border = *((Tk_3DBorder *) ptr); - if (border) { + if (border != NULL) { result = Tk_NameOf3DBorder(border); } break; @@ -837,7 +837,7 @@ FormatConfigValue( case TK_CONFIG_ACTIVE_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *) ptr); - if (cursor) { + if (cursor != None) { result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); } break; @@ -993,7 +993,7 @@ Tk_FreeOptions( ptr = widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_STRING: - if (*((char **) ptr)) { + if (*((char **) ptr) != NULL) { ckfree(*((char **) ptr)); *((char **) ptr) = NULL; } @@ -1009,22 +1009,22 @@ Tk_FreeOptions( *((Tk_Font *) ptr) = NULL; break; case TK_CONFIG_BITMAP: - if (*((Pixmap *) ptr)) { + if (*((Pixmap *) ptr) != None) { Tk_FreeBitmap(display, *((Pixmap *) ptr)); - *((Pixmap *) ptr) = 0; + *((Pixmap *) ptr) = None; } break; case TK_CONFIG_BORDER: - if (*((Tk_3DBorder *) ptr)) { + if (*((Tk_3DBorder *) ptr) != NULL) { Tk_Free3DBorder(*((Tk_3DBorder *) ptr)); *((Tk_3DBorder *) ptr) = NULL; } break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: - if (*((Tk_Cursor *) ptr)) { + if (*((Tk_Cursor *) ptr) != None) { Tk_FreeCursor(display, *((Tk_Cursor *) ptr)); - *((Tk_Cursor *) ptr) = 0; + *((Tk_Cursor *) ptr) = NULL; } } } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index f087cb0..8233d35 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 = 0; - pwPtr->cursor = 0; - pwPtr->sashCursor = 0; + pwPtr->gc = NULL; + pwPtr->cursor = NULL; + pwPtr->sashCursor = NULL; /* * Keep a hold of the associated tkwin until we destroy the widget, @@ -862,7 +862,7 @@ ConfigureSlaves( index = -1; haveLoc = 0; - if (options.after) { + if (options.after != None) { tkwin = options.after; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -871,7 +871,7 @@ ConfigureSlaves( break; } } - } else if (options.before) { + } else if (options.before != None) { tkwin = options.before; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -1304,7 +1304,7 @@ PanedWindowWorldChanged( gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel; newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues); - if (pwPtr->gc) { + if (pwPtr->gc != None) { Tk_FreeGC(pwPtr->display, pwPtr->gc); } pwPtr->gc = newGC; @@ -2044,10 +2044,10 @@ Unlink( for (i = 0; i < masterPtr->numSlaves; i++) { if (masterPtr->slaves[i]->before == slavePtr->tkwin) { - masterPtr->slaves[i]->before = 0; + masterPtr->slaves[i]->before = NULL; } if (masterPtr->slaves[i]->after == slavePtr->tkwin) { - masterPtr->slaves[i]->after = 0; + masterPtr->slaves[i]->after = NULL; } } diff --git a/generic/tkPointer.c b/generic/tkPointer.c index 14a5597..0141b64 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -179,13 +179,14 @@ GenerateEnterLeave( } else { TkWindow *targetPtr; - if (!lastWinPtr || !lastWinPtr->window) { + if ((lastWinPtr == NULL) + || (lastWinPtr->window == None)) { targetPtr = winPtr; } else { targetPtr = lastWinPtr; } - if (targetPtr && targetPtr->window) { + if (targetPtr && (targetPtr->window != None)) { XEvent event; /* @@ -539,7 +540,7 @@ static void UpdateCursor( TkWindow *winPtr) { - Cursor cursor = 0; + Cursor cursor = None; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -549,8 +550,8 @@ UpdateCursor( */ tsdPtr->cursorWinPtr = winPtr; - while (winPtr) { - if (winPtr->atts.cursor) { + while (winPtr != NULL) { + if (winPtr->atts.cursor != None) { cursor = winPtr->atts.cursor; break; } else if (winPtr->flags & TK_TOP_HIERARCHY) { diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index b6c24a9..30e1d50 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -255,10 +255,10 @@ CreateRectOval( rectOvalPtr->fillColor = NULL; rectOvalPtr->activeFillColor = NULL; rectOvalPtr->disabledFillColor = NULL; - rectOvalPtr->fillStipple = 0; - rectOvalPtr->activeFillStipple = 0; - rectOvalPtr->disabledFillStipple = 0; - rectOvalPtr->fillGC = 0; + rectOvalPtr->fillStipple = None; + rectOvalPtr->activeFillStipple = None; + rectOvalPtr->disabledFillStipple = None; + rectOvalPtr->fillGC = NULL; /* * Process the arguments to fill in the item record. @@ -422,11 +422,11 @@ ConfigureRectOval( */ if (rectOvalPtr->outline.activeWidth > rectOvalPtr->outline.width || - rectOvalPtr->outline.activeDash.number || - rectOvalPtr->outline.activeColor || - rectOvalPtr->outline.activeStipple || - rectOvalPtr->activeFillColor || - rectOvalPtr->activeFillStipple) { + rectOvalPtr->outline.activeDash.number != 0 || + rectOvalPtr->outline.activeColor != NULL || + rectOvalPtr->outline.activeStipple != None || + rectOvalPtr->activeFillColor != NULL || + rectOvalPtr->activeFillStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -460,13 +460,13 @@ ConfigureRectOval( mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(rectOvalPtr->outline)); if (mask && \ - rectOvalPtr->outline.width && \ - rectOvalPtr->outline.color) { + rectOvalPtr->outline.width != 0 && \ + rectOvalPtr->outline.color != NULL) { gcValues.cap_style = CapProjecting; mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = 0; + newGC = NULL; } if (rectOvalPtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->outline.gc); @@ -487,23 +487,23 @@ ConfigureRectOval( if (rectOvalPtr->activeFillColor!=NULL) { color = rectOvalPtr->activeFillColor; } - if (rectOvalPtr->activeFillStipple) { + if (rectOvalPtr->activeFillStipple!=None) { stipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { - if (rectOvalPtr->disabledFillColor) { + if (rectOvalPtr->disabledFillColor!=NULL) { color = rectOvalPtr->disabledFillColor; } - if (rectOvalPtr->disabledFillStipple) { + if (rectOvalPtr->disabledFillStipple!=None) { stipple = rectOvalPtr->disabledFillStipple; } } if (!color) { - newGC = 0; + newGC = NULL; } else { gcValues.foreground = color->pixel; - if (stipple) { + if (stipple != None) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask = GCForeground|GCStipple|GCFillStyle; @@ -577,25 +577,25 @@ DeleteRectOval( RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; Tk_DeleteOutline(display, &(rectOvalPtr->outline)); - if (rectOvalPtr->fillColor) { + if (rectOvalPtr->fillColor != NULL) { Tk_FreeColor(rectOvalPtr->fillColor); } - if (rectOvalPtr->activeFillColor) { + if (rectOvalPtr->activeFillColor != NULL) { Tk_FreeColor(rectOvalPtr->activeFillColor); } - if (rectOvalPtr->disabledFillColor) { + if (rectOvalPtr->disabledFillColor != NULL) { Tk_FreeColor(rectOvalPtr->disabledFillColor); } - if (rectOvalPtr->fillStipple) { + if (rectOvalPtr->fillStipple != None) { Tk_FreeBitmap(display, rectOvalPtr->fillStipple); } - if (rectOvalPtr->activeFillStipple) { + if (rectOvalPtr->activeFillStipple != None) { Tk_FreeBitmap(display, rectOvalPtr->activeFillStipple); } - if (rectOvalPtr->disabledFillStipple) { + if (rectOvalPtr->disabledFillStipple != None) { Tk_FreeBitmap(display, rectOvalPtr->disabledFillStipple); } - if (rectOvalPtr->fillGC) { + if (rectOvalPtr->fillGC != None) { Tk_FreeGC(display, rectOvalPtr->fillGC); } } @@ -664,7 +664,7 @@ ComputeRectOvalBbox( rectOvalPtr->bbox[0] = tmpX; } - if (!rectOvalPtr->outline.gc) { + if (rectOvalPtr->outline.gc == None) { /* * 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 @@ -869,17 +869,17 @@ DisplayRectOval( } fillStipple = rectOvalPtr->fillStipple; if (Canvas(canvas)->currentItemPtr == (Tk_Item *) rectOvalPtr) { - if (rectOvalPtr->activeFillStipple) { + if (rectOvalPtr->activeFillStipple != None) { fillStipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { - if (rectOvalPtr->disabledFillStipple) { + if (rectOvalPtr->disabledFillStipple != None) { fillStipple = rectOvalPtr->disabledFillStipple; } } - if (rectOvalPtr->fillGC) { - if (fillStipple) { + if (rectOvalPtr->fillGC != None) { + if (fillStipple != None) { Tk_TSOffset *tsoffset; int w = 0, h = 0; @@ -917,12 +917,12 @@ DisplayRectOval( x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), 0, 360*64); } - if (fillStipple) { + if (fillStipple != None) { XSetTSOrigin(display, rectOvalPtr->fillGC, 0, 0); } } - if (rectOvalPtr->outline.gc) { + if (rectOvalPtr->outline.gc != None) { Tk_ChangeOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline)); if (rectOvalPtr->header.typePtr == &tkRectangleType) { XDrawRectangle(display, drawable, rectOvalPtr->outline.gc, @@ -993,7 +993,7 @@ RectToPoint( y1 = rectPtr->bbox[1]; x2 = rectPtr->bbox[2]; y2 = rectPtr->bbox[3]; - if (rectPtr->outline.gc) { + if (rectPtr->outline.gc != None) { inc = width/2.0; x1 -= inc; y1 -= inc; @@ -1009,7 +1009,7 @@ RectToPoint( if ((pointPtr[0] >= x1) && (pointPtr[0] < x2) && (pointPtr[1] >= y1) && (pointPtr[1] < y2)) { - if (rectPtr->fillGC || !rectPtr->outline.gc) { + if ((rectPtr->fillGC != None) || (rectPtr->outline.gc == None)) { return 0.0; } xDiff = pointPtr[0] - x1; @@ -1105,8 +1105,8 @@ OvalToPoint( } - filled = ovalPtr->fillGC != 0; - if (!ovalPtr->outline.gc) { + filled = ovalPtr->fillGC != None; + if (ovalPtr->outline.gc == None) { width = 0.0; filled = 1; } @@ -1161,7 +1161,7 @@ RectToArea( } halfWidth = width/2.0; - if (!rectPtr->outline.gc) { + if (rectPtr->outline.gc == None) { halfWidth = 0.0; } @@ -1171,7 +1171,7 @@ RectToArea( || (areaPtr[1] >= (rectPtr->bbox[3] + halfWidth))) { return -1; } - if (!rectPtr->fillGC && rectPtr->outline.gc + if ((rectPtr->fillGC == None) && (rectPtr->outline.gc != None) && (areaPtr[0] >= (rectPtr->bbox[0] + halfWidth)) && (areaPtr[1] >= (rectPtr->bbox[1] + halfWidth)) && (areaPtr[2] <= (rectPtr->bbox[2] - halfWidth)) @@ -1239,7 +1239,7 @@ OvalToArea( */ halfWidth = width/2.0; - if (!ovalPtr->outline.gc) { + if (ovalPtr->outline.gc == None) { halfWidth = 0.0; } oval[0] = ovalPtr->bbox[0] - halfWidth; @@ -1256,8 +1256,8 @@ OvalToArea( * return "outside". */ - if ((result == 0) && ovalPtr->outline.gc - && !ovalPtr->fillGC) { + if ((result == 0) && (ovalPtr->outline.gc != None) + && (ovalPtr->fillGC == None)) { double centerX, centerY, height; double xDelta1, yDelta1, xDelta2, yDelta2; @@ -1432,20 +1432,20 @@ RectOvalToPostscript( if (rectOvalPtr->outline.activeColor!=NULL) { color = rectOvalPtr->outline.activeColor; } - if (rectOvalPtr->activeFillColor) { + if (rectOvalPtr->activeFillColor!=NULL) { fillColor = rectOvalPtr->activeFillColor; } - if (rectOvalPtr->activeFillStipple) { + if (rectOvalPtr->activeFillStipple!=None) { fillStipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { if (rectOvalPtr->outline.disabledColor!=NULL) { color = rectOvalPtr->outline.disabledColor; } - if (rectOvalPtr->disabledFillColor) { + if (rectOvalPtr->disabledFillColor!=NULL) { fillColor = rectOvalPtr->disabledFillColor; } - if (rectOvalPtr->disabledFillStipple) { + if (rectOvalPtr->disabledFillStipple!=None) { fillStipple = rectOvalPtr->disabledFillStipple; } } @@ -1461,7 +1461,7 @@ RectOvalToPostscript( * First draw the filled area of the rectangle. */ - if (fillColor) { + if (fillColor != NULL) { Tcl_AppendObjToObj(psObj, pathObj); Tcl_ResetResult(interp); @@ -1490,7 +1490,7 @@ RectOvalToPostscript( * Now draw the outline, if there is one. */ - if (color) { + if (color != NULL) { Tcl_AppendObjToObj(psObj, pathObj); Tcl_AppendToObj(psObj, "0 setlinejoin 2 setlinecap\n", -1); diff --git a/generic/tkScale.c b/generic/tkScale.c index 96e21f2..71de55f 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -270,11 +270,11 @@ Tk_ScaleObjCmd( scalePtr->activeBorder = NULL; scalePtr->sliderRelief = TK_RELIEF_RAISED; scalePtr->troughColorPtr = NULL; - scalePtr->troughGC = 0; - scalePtr->copyGC = 0; + scalePtr->troughGC = NULL; + scalePtr->copyGC = NULL; scalePtr->tkfont = NULL; scalePtr->textColorPtr = NULL; - scalePtr->textGC = 0; + scalePtr->textGC = NULL; scalePtr->relief = TK_RELIEF_FLAT; scalePtr->highlightWidth = 0; scalePtr->highlightBorder = NULL; @@ -291,7 +291,7 @@ Tk_ScaleObjCmd( scalePtr->vertTroughX = 0; scalePtr->vertLabelX = 0; scalePtr->fontHeight = 0; - scalePtr->cursor = 0; + scalePtr->cursor = NULL; scalePtr->takeFocusPtr = NULL; scalePtr->flags = NEVER_SET; @@ -518,13 +518,13 @@ DestroyScale( NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, scalePtr); } - if (scalePtr->troughGC) { + if (scalePtr->troughGC != None) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); } - if (scalePtr->copyGC) { + if (scalePtr->copyGC != None) { Tk_FreeGC(scalePtr->display, scalePtr->copyGC); } - if (scalePtr->textGC) { + if (scalePtr->textGC != None) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } Tk_FreeConfigOptions((char *) scalePtr, scalePtr->optionTable, @@ -729,7 +729,7 @@ ScaleWorldChanged( gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); - if (scalePtr->troughGC) { + if (scalePtr->troughGC != None) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); } scalePtr->troughGC = gc; @@ -737,12 +737,12 @@ ScaleWorldChanged( gcValues.font = Tk_FontId(scalePtr->tkfont); gcValues.foreground = scalePtr->textColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground | GCFont, &gcValues); - if (scalePtr->textGC) { + if (scalePtr->textGC != None) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } scalePtr->textGC = gc; - if (!scalePtr->copyGC) { + if (scalePtr->copyGC == None) { gcValues.graphics_exposures = False; scalePtr->copyGC = Tk_GetGC(scalePtr->tkwin, GCGraphicsExposures, &gcValues); diff --git a/generic/tkScale.h b/generic/tkScale.h index aa0feff..4fd9995 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -73,7 +73,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[16]; /* Sprintf conversion specifier computed from + char format[10]; /* 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 5e3e838..9a85532 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -185,7 +185,7 @@ Tk_ScrollbarObjCmd( scrollPtr->lastUnit = 0; scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; - scrollPtr->cursor = 0; + scrollPtr->cursor = NULL; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index caf1b3a..fcfd323 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -128,7 +128,7 @@ Tk_CreateSelHandler( register TkSelHandler *selPtr; TkWindow *winPtr = (TkWindow *) tkwin; - if (!winPtr->dispPtr->multipleAtom) { + if (winPtr->dispPtr->multipleAtom == None) { TkSelInit(tkwin); } @@ -360,7 +360,7 @@ Tk_OwnSelection( ClientData clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ - if (!dispPtr->multipleAtom) { + if (dispPtr->multipleAtom == None) { TkSelInit(tkwin); } Tk_MakeWindowExist(tkwin); @@ -469,7 +469,7 @@ Tk_ClearSelection( ClientData clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ - if (!dispPtr->multipleAtom) { + if (dispPtr->multipleAtom == None) { TkSelInit(tkwin); } @@ -492,7 +492,7 @@ Tk_ClearSelection( clearData = infoPtr->clearData; ckfree(infoPtr); } - XSetSelectionOwner(winPtr->display, selection, 0, CurrentTime); + XSetSelectionOwner(winPtr->display, selection, None, CurrentTime); if (clearProc != NULL) { clearProc(clearData); @@ -559,7 +559,7 @@ Tk_GetSelection( ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - if (!dispPtr->multipleAtom) { + if (dispPtr->multipleAtom == None) { TkSelInit(tkwin); } diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 91247d6..39083d4 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -169,7 +169,7 @@ SquareObjCmd( squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr, SquareDeletedProc); - squarePtr->gc = 0; + squarePtr->gc = NULL; squarePtr->optionTable = optionTable; if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin) @@ -335,7 +335,7 @@ SquareConfigure( Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); - if (!squarePtr->gc && doubleBuffer) { + if ((squarePtr->gc == None) && (doubleBuffer)) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; @@ -397,10 +397,10 @@ SquareObjEventProc( squarePtr->updatePending = 1; } } else if (eventPtr->type == DestroyNotify) { - if (squarePtr->tkwin) { + if (squarePtr->tkwin != NULL) { Tk_FreeConfigOptions((char *) squarePtr, squarePtr->optionTable, squarePtr->tkwin); - if (squarePtr->gc) { + if (squarePtr->gc != None) { Tk_FreeGC(squarePtr->display, squarePtr->gc); } squarePtr->tkwin = NULL; @@ -475,7 +475,7 @@ SquareDisplay( { Square *squarePtr = clientData; Tk_Window tkwin = squarePtr->tkwin; - Pixmap pm = 0; + Pixmap pm = None; Drawable d; int borderWidth, size, relief; Tk_3DBorder bgBorder, fgBorder; diff --git a/generic/tkTest.c b/generic/tkTest.c index 88aba2b..6712017 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -937,7 +937,7 @@ TestobjconfigObjCmd( recordPtr->index = 0; recordPtr->colorPtr = NULL; recordPtr->tkfont = NULL; - recordPtr->bitmap = 0; + recordPtr->bitmap = None; recordPtr->border = NULL; recordPtr->relief = TK_RELIEF_FLAT; recordPtr->cursor = NULL; @@ -1864,7 +1864,7 @@ TestpropObjCmd( w, propName, 0, 100000, False, AnyPropertyType, &actualType, &actualFormat, &length, &bytesAfter, &property); - if ((result == Success) && actualType) { + if ((result == Success) && (actualType != None)) { 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 bf8d8ef..ff773a1 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -587,7 +587,7 @@ CreateWidget( textPtr->state = TK_TEXT_STATE_NORMAL; textPtr->relief = TK_RELIEF_FLAT; - textPtr->cursor = 0; + textPtr->cursor = NULL; textPtr->charWidth = 1; textPtr->charHeight = 10; textPtr->wrapMode = TEXT_WRAPMODE_CHAR; @@ -2277,17 +2277,17 @@ ConfigureText( } textPtr->selTagPtr->affectsDisplay = 0; textPtr->selTagPtr->affectsDisplayGeometry = 0; - 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 + 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) || (textPtr->selTagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { textPtr->selTagPtr->affectsDisplay = 1; textPtr->selTagPtr->affectsDisplayGeometry = 1; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a6ee33e..7e1a88e 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -664,7 +664,7 @@ TkTextCreateDInfo( dInfoPtr = ckalloc(sizeof(TextDInfo)); Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int)); dInfoPtr->dLinePtr = NULL; - dInfoPtr->copyGC = 0; + dInfoPtr->copyGC = NULL; gcValues.graphics_exposures = True; dInfoPtr->scrollGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); @@ -728,19 +728,19 @@ TkTextFreeDInfo( FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK); Tcl_DeleteHashTable(&dInfoPtr->styleTable); - if (dInfoPtr->copyGC) { + if (dInfoPtr->copyGC != None) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC); if (dInfoPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayText, textPtr); } - if (dInfoPtr->lineUpdateTimer) { + if (dInfoPtr->lineUpdateTimer != NULL) { Tcl_DeleteTimerHandler(dInfoPtr->lineUpdateTimer); textPtr->refCount--; dInfoPtr->lineUpdateTimer = NULL; } - if (dInfoPtr->scrollbarTimer) { + if (dInfoPtr->scrollbarTimer != NULL) { Tcl_DeleteTimerHandler(dInfoPtr->scrollbarTimer); textPtr->refCount--; dInfoPtr->scrollbarTimer = NULL; @@ -882,7 +882,7 @@ GetStyle( styleValues.relief = tagPtr->relief; reliefPrio = tagPtr->priority; } - if ((tagPtr->bgStipple) + if ((tagPtr->bgStipple != None) && (tagPtr->priority > bgStipplePrio)) { styleValues.bgStipple = tagPtr->bgStipple; bgStipplePrio = tagPtr->priority; @@ -891,26 +891,26 @@ GetStyle( styleValues.fgColor = fgColor; fgPrio = tagPtr->priority; } - if ((tagPtr->tkfont) && (tagPtr->priority > fontPrio)) { + if ((tagPtr->tkfont != None) && (tagPtr->priority > fontPrio)) { styleValues.tkfont = tagPtr->tkfont; fontPrio = tagPtr->priority; } - if ((tagPtr->fgStipple) + if ((tagPtr->fgStipple != None) && (tagPtr->priority > fgStipplePrio)) { styleValues.fgStipple = tagPtr->fgStipple; fgStipplePrio = tagPtr->priority; } - if ((tagPtr->justifyString) + if ((tagPtr->justifyString != NULL) && (tagPtr->priority > justifyPrio)) { styleValues.justify = tagPtr->justify; justifyPrio = tagPtr->priority; } - if ((tagPtr->lMargin1String) + if ((tagPtr->lMargin1String != NULL) && (tagPtr->priority > lMargin1Prio)) { styleValues.lMargin1 = tagPtr->lMargin1; lMargin1Prio = tagPtr->priority; } - if ((tagPtr->lMargin2String) + if ((tagPtr->lMargin2String != NULL) && (tagPtr->priority > lMargin2Prio)) { styleValues.lMargin2 = tagPtr->lMargin2; lMargin2Prio = tagPtr->priority; @@ -925,7 +925,7 @@ GetStyle( styleValues.offset = tagPtr->offset; offsetPrio = tagPtr->priority; } - if ((tagPtr->overstrikeString) + if ((tagPtr->overstrikeString != NULL) && (tagPtr->priority > overstrikePrio)) { styleValues.overstrike = tagPtr->overstrike; overstrikePrio = tagPtr->priority; @@ -935,7 +935,7 @@ GetStyle( styleValues.overstrikeColor = fgColor; } } - if ((tagPtr->rMarginString) + if ((tagPtr->rMarginString != NULL) && (tagPtr->priority > rMarginPrio)) { styleValues.rMargin = tagPtr->rMargin; rMarginPrio = tagPtr->priority; @@ -950,17 +950,17 @@ GetStyle( styleValues.spacing1 = tagPtr->spacing1; spacing1Prio = tagPtr->priority; } - if ((tagPtr->spacing2String) + if ((tagPtr->spacing2String != NULL) && (tagPtr->priority > spacing2Prio)) { styleValues.spacing2 = tagPtr->spacing2; spacing2Prio = tagPtr->priority; } - if ((tagPtr->spacing3String) + if ((tagPtr->spacing3String != NULL) && (tagPtr->priority > spacing3Prio)) { styleValues.spacing3 = tagPtr->spacing3; spacing3Prio = tagPtr->priority; } - if ((tagPtr->tabStringPtr) + if ((tagPtr->tabStringPtr != NULL) && (tagPtr->priority > tabPrio)) { styleValues.tabArrayPtr = tagPtr->tabArrayPtr; tabPrio = tagPtr->priority; @@ -970,7 +970,7 @@ GetStyle( styleValues.tabStyle = tagPtr->tabStyle; tabStylePrio = tagPtr->priority; } - if ((tagPtr->underlineString) + if ((tagPtr->underlineString != NULL) && (tagPtr->priority > underlinePrio)) { styleValues.underline = tagPtr->underline; underlinePrio = tagPtr->priority; @@ -980,7 +980,7 @@ GetStyle( styleValues.underlineColor = fgColor; } } - if ((tagPtr->elideString) + if ((tagPtr->elideString != NULL) && (tagPtr->priority > elidePrio)) { styleValues.elide = tagPtr->elide; elidePrio = tagPtr->priority; @@ -991,7 +991,7 @@ GetStyle( wrapPrio = tagPtr->priority; } } - if (tagPtrs) { + if (tagPtrs != NULL) { ckfree(tagPtrs); } @@ -1016,20 +1016,20 @@ GetStyle( if (styleValues.border != NULL) { gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel; mask = GCForeground; - if (styleValues.bgStipple) { + if (styleValues.bgStipple != None) { gcValues.stipple = styleValues.bgStipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } stylePtr->bgGC = Tk_GetGC(textPtr->tkwin, mask, &gcValues); } else { - stylePtr->bgGC = 0; + stylePtr->bgGC = NULL; } mask = GCFont; gcValues.font = Tk_FontId(styleValues.tkfont); mask |= GCForeground; gcValues.foreground = styleValues.fgColor->pixel; - if (styleValues.fgStipple) { + if (styleValues.fgStipple != None) { gcValues.stipple = styleValues.fgStipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -1074,10 +1074,10 @@ FreeStyle( { stylePtr->refCount--; if (stylePtr->refCount == 0) { - if (stylePtr->bgGC) { + if (stylePtr->bgGC != None) { Tk_FreeGC(textPtr->display, stylePtr->bgGC); } - if (stylePtr->fgGC) { + if (stylePtr->fgGC != None) { Tk_FreeGC(textPtr->display, stylePtr->fgGC); } if (stylePtr->ulGC) { @@ -2688,7 +2688,7 @@ DisplayLineBackground( if ((chunkPtr->nextPtr == NULL) && (rightX < maxX)) { rightX = maxX; } - if (chunkPtr->stylePtr->bgGC) { + if (chunkPtr->stylePtr->bgGC != None) { /* * Not visible - bail out now. */ @@ -4544,7 +4544,7 @@ DisplayText( dlPtr->spaceAbove, dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, NULL, - 0, dlPtr->y + dlPtr->spaceAbove); + (Drawable) None, dlPtr->y + dlPtr->spaceAbove); } } } @@ -5180,7 +5180,7 @@ TkTextRelayoutWindow( gcValues.graphics_exposures = False; newGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); - if (dInfoPtr->copyGC) { + if (dInfoPtr->copyGC != None) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } dInfoPtr->copyGC = newGC; @@ -7994,7 +7994,7 @@ CharDisplayProc( */ if (!sValuePtr->elide && (numBytes > offsetBytes) - && stylePtr->fgGC) { + && (stylePtr->fgGC != None)) { #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 5f9994f..3a7052a 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -515,17 +515,17 @@ TkTextTagCmd( tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; - if (tagPtr->elideString - || tagPtr->tkfont - || tagPtr->justifyString - || tagPtr->lMargin1String - || tagPtr->lMargin2String - || tagPtr->offsetString - || tagPtr->rMarginString - || tagPtr->spacing1String - || tagPtr->spacing2String - || tagPtr->spacing3String - || tagPtr->tabStringPtr + 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) || (tagPtr->tabStyle != TK_TEXT_TABSTYLE_NONE) || (tagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { tagPtr->affectsDisplay = 1; @@ -1030,10 +1030,10 @@ TkTextCreateTag( tagPtr->borderWidthPtr = NULL; tagPtr->reliefString = NULL; tagPtr->relief = TK_RELIEF_FLAT; - tagPtr->bgStipple = 0; + tagPtr->bgStipple = None; tagPtr->fgColor = NULL; tagPtr->tkfont = NULL; - tagPtr->fgStipple = 0; + tagPtr->fgStipple = None; tagPtr->justifyString = NULL; tagPtr->justify = TK_JUSTIFY_LEFT; tagPtr->lMargin1String = NULL; @@ -1608,7 +1608,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 = 0; + textPtr->pickEvent.xcrossing.subwindow = None; 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 98ad3d5..8b0c155 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -402,20 +402,20 @@ Tk_GetColormap( */ other = Tk_NameToWindow(interp, string, tkwin); - if (!other) { - return 0; + if (other == NULL) { + return None; } if (Tk_Screen(other) != Tk_Screen(tkwin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use colormap for %s: not on same screen", string)); Tcl_SetErrorCode(interp, "TK", "COLORMAP", "SCREEN", NULL); - return 0; + return None; } if (Tk_Visual(other) != Tk_Visual(tkwin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use colormap for %s: incompatible visuals", string)); Tcl_SetErrorCode(interp, "TK", "COLORMAP", "INCOMPATIBLE", NULL); - return 0; + return None; } colormap = Tk_Colormap(other); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 9906289..839e860 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -67,7 +67,7 @@ static const XWindowChanges defChanges = { EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \ VisibilityChangeMask|PropertyChangeMask|ColormapChangeMask static const XSetWindowAttributes defAtts= { - 0, /* background_pixmap */ + None, /* background_pixmap */ 0, /* background_pixel */ CopyFromParent, /* border_pixmap */ 0, /* border_pixel */ @@ -81,7 +81,7 @@ static const XSetWindowAttributes defAtts= { 0, /* do_not_propagate_mask */ False, /* override_redirect */ CopyFromParent, /* colormap */ - 0 /* cursor */ + None /* cursor */ }; /* @@ -633,7 +633,7 @@ TkAllocWindow( winPtr->visual = DefaultVisual(dispPtr->display, screenNum); winPtr->depth = DefaultDepth(dispPtr->display, screenNum); } - winPtr->window = 0; + winPtr->window = None; winPtr->childList = NULL; winPtr->lastChildPtr = NULL; winPtr->parentPtr = NULL; @@ -1379,7 +1379,7 @@ Tk_DestroyWindow( winPtr->pathName != NULL && !(winPtr->flags & TK_ANONYMOUS_WINDOW)) { halfdeadPtr->flags |= HD_DESTROY_EVENT; - if (!winPtr->window) { + if (winPtr->window == None) { Tk_MakeWindowExist(tkwin); } event.type = DestroyNotify; @@ -1425,7 +1425,7 @@ Tk_DestroyWindow( } else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) { TkWmRemoveFromColormapWindows(winPtr); } - if (winPtr->window) { + if (winPtr->window != None) { #if defined(MAC_OSX_TK) || defined(_WIN32) XDestroyWindow(winPtr->display, winPtr->window); #else @@ -1443,7 +1443,7 @@ Tk_DestroyWindow( #endif Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, (char *) winPtr->window)); - winPtr->window = 0; + winPtr->window = None; } UnlinkWindow(winPtr); TkEventDeadWindow(winPtr); @@ -1619,7 +1619,7 @@ Tk_MapWindow( if (winPtr->flags & TK_MAPPED) { return; } - if (!winPtr->window) { + if (winPtr->window == None) { Tk_MakeWindowExist(tkwin); } /* @@ -1681,21 +1681,21 @@ Tk_MakeWindowExist( Tk_ClassCreateProc *createProc; int isNew; - if (winPtr->window) { + if (winPtr->window != None) { return; } if ((winPtr->parentPtr == NULL) || (winPtr->flags & TK_TOP_HIERARCHY)) { parent = XRootWindow(winPtr->display, winPtr->screenNum); } else { - if (!winPtr->parentPtr->window) { + if (winPtr->parentPtr->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr->parentPtr); } parent = winPtr->parentPtr->window; } createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc); - if (createProc != NULL && parent) { + if (createProc != NULL && parent != None) { winPtr->window = createProc(tkwin, parent, winPtr->instanceData); } else { winPtr->window = TkpMakeWindow(winPtr, parent); @@ -1721,7 +1721,7 @@ Tk_MakeWindowExist( for (winPtr2 = winPtr->nextPtr; winPtr2 != NULL; winPtr2 = winPtr2->nextPtr) { - if (winPtr2->window + if ((winPtr2->window != None) && !(winPtr2->flags & (TK_TOP_HIERARCHY|TK_REPARENTED))) { XWindowChanges changes; @@ -1841,7 +1841,7 @@ Tk_ConfigureWindow( Tcl_Panic("Can't set sibling or stack mode from Tk_ConfigureWindow"); } - if (winPtr->window) { + if (winPtr->window != None) { XConfigureWindow(winPtr->display, winPtr->window, valueMask, valuePtr); TkDoConfigureNotify(winPtr); @@ -1860,7 +1860,7 @@ Tk_MoveWindow( winPtr->changes.x = x; winPtr->changes.y = y; - if (winPtr->window) { + if (winPtr->window != None) { XMoveWindow(winPtr->display, winPtr->window, x, y); TkDoConfigureNotify(winPtr); } else { @@ -1878,7 +1878,7 @@ Tk_ResizeWindow( winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; - if (winPtr->window) { + if (winPtr->window != None) { XResizeWindow(winPtr->display, winPtr->window, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); @@ -1900,7 +1900,7 @@ Tk_MoveResizeWindow( winPtr->changes.y = y; winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; - if (winPtr->window) { + if (winPtr->window != None) { XMoveResizeWindow(winPtr->display, winPtr->window, x, y, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); @@ -1918,7 +1918,7 @@ Tk_SetWindowBorderWidth( register TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.border_width = width; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBorderWidth(winPtr->display, winPtr->window, (unsigned) width); TkDoConfigureNotify(winPtr); @@ -1985,7 +1985,7 @@ Tk_ChangeWindowAttributes( winPtr->atts.cursor = attsPtr->cursor; } - if (winPtr->window) { + if (winPtr->window != None) { XChangeWindowAttributes(winPtr->display, winPtr->window, valueMask, attsPtr); } else { @@ -2003,7 +2003,7 @@ Tk_SetWindowBackground( winPtr->atts.background_pixel = pixel; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBackground(winPtr->display, winPtr->window, pixel); } else { winPtr->dirtyAtts = (winPtr->dirtyAtts & (unsigned) ~CWBackPixmap) @@ -2020,7 +2020,7 @@ Tk_SetWindowBackgroundPixmap( winPtr->atts.background_pixmap = pixmap; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBackgroundPixmap(winPtr->display, winPtr->window, pixmap); } else { @@ -2038,7 +2038,7 @@ Tk_SetWindowBorder( winPtr->atts.border_pixel = pixel; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBorder(winPtr->display, winPtr->window, pixel); } else { winPtr->dirtyAtts = (winPtr->dirtyAtts & (unsigned) ~CWBorderPixmap) @@ -2055,7 +2055,7 @@ Tk_SetWindowBorderPixmap( winPtr->atts.border_pixmap = pixmap; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBorderPixmap(winPtr->display, winPtr->window, pixmap); } else { @@ -2077,7 +2077,7 @@ Tk_DefineCursor( winPtr->atts.cursor = (Cursor) cursor; #endif - if (winPtr->window) { + if (winPtr->window != None) { XDefineCursor(winPtr->display, winPtr->window, winPtr->atts.cursor); } else { winPtr->dirtyAtts = winPtr->dirtyAtts | CWCursor; @@ -2088,7 +2088,7 @@ void Tk_UndefineCursor( Tk_Window tkwin) /* Window to manipulate. */ { - Tk_DefineCursor(tkwin, 0); + Tk_DefineCursor(tkwin, NULL); } void @@ -2100,7 +2100,7 @@ Tk_SetWindowColormap( winPtr->atts.colormap = colormap; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowColormap(winPtr->display, winPtr->window, colormap); if (!(winPtr->flags & TK_WIN_MANAGED)) { TkWmAddToColormapWindows(winPtr); @@ -2140,7 +2140,7 @@ Tk_SetWindowVisual( { register TkWindow *winPtr = (TkWindow *) tkwin; - if (winPtr->window) { + if (winPtr->window != None) { /* Too late! */ return 0; } @@ -2200,7 +2200,7 @@ TkDoConfigureNotify( if (winPtr->changes.stack_mode == Above) { event.xconfigure.above = winPtr->changes.sibling; } else { - event.xconfigure.above = 0; + event.xconfigure.above = None; } event.xconfigure.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); @@ -2569,14 +2569,14 @@ Tk_RestackWindow( * will be handled properly when the window is finally created. */ - if (winPtr->window) { + if (winPtr->window != None) { XWindowChanges changes; unsigned int mask = CWStackMode; changes.stack_mode = Above; for (otherPtr = winPtr->nextPtr; otherPtr != NULL; otherPtr = otherPtr->nextPtr) { - if (otherPtr->window + if ((otherPtr->window != None) && !(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 1e17d54..a8bb717 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1155,7 +1155,7 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip) mask |= GCForeground; } gc = Tk_GetGC(entryPtr->core.tkwin, mask, &gcValues); - if (clip) { + if (clip != None) { TkSetRegion(Tk_Display(entryPtr->core.tkwin), gc, clip); } return gc; @@ -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, leftIndex, rightIndex); - XSetClipMask(Tk_Display(tkwin), gc, 0); + XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); /* Overwrite the selected portion (if any) in the -selectforeground color: @@ -1289,7 +1289,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, 0); + XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -1297,7 +1297,7 @@ static void EntryDisplay(void *clientData, Drawable d) * it from the Xft guts (if they're being used). */ #ifdef HAVE_XFT - TkUnixSetXftClipRegion(0); + TkUnixSetXftClipRegion(None); #endif TkDestroyRegion(clipRegion); } diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 9b80c59..1037840 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(0); + TkUnixSetXftClipRegion(None); #endif - XSetClipMask(Tk_Display(tkwin), gc1, 0); - XSetClipMask(Tk_Display(tkwin), gc2, 0); + XSetClipMask(Tk_Display(tkwin), gc1, None); + XSetClipMask(Tk_Display(tkwin), gc2, None); 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) { + if (stipple != None) { unsigned long mask = GCFillStyle | GCStipple | GCForeground; XGCValues gcvalues; GC gc; |