From f2b5a87d6dc6d3468828d48929583d950690a40b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 31 Dec 2018 15:36:56 +0000 Subject: =?UTF-8?q?As=20requested=20by=20Christian=20Werner/Fran=C3=A7ois?= =?UTF-8?q?=20Vogel=20and=20others:=20Undo=20many=20None=20->=200=20change?= =?UTF-8?q?s,=20in=20order=20to=20reduce=20the=20probability=20of=20merge?= =?UTF-8?q?=20conflicts=20with=20other=20branches.=20Remark:=20Many=20usag?= =?UTF-8?q?es=20of=20"None"=20in=20Tk=20are=20wrong,=20"NULL"=20should=20b?= =?UTF-8?q?e=20used=20in=20many=20places=20where=20pointers=20are=20refere?= =?UTF-8?q?nced=20in=20stead=20of=20XID's.=20Those=20places=20are=20correc?= =?UTF-8?q?ted.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tk3d.c | 24 +++++----- generic/tkBind.c | 4 +- generic/tkBitmap.c | 8 ++-- generic/tkButton.c | 70 ++++++++++++++-------------- generic/tkCanvArc.c | 116 +++++++++++++++++++++++------------------------ generic/tkCanvBmap.c | 80 ++++++++++++++++---------------- generic/tkCanvImg.c | 8 ++-- generic/tkCanvLine.c | 54 +++++++++++----------- generic/tkCanvPoly.c | 98 +++++++++++++++++++-------------------- generic/tkCanvText.c | 76 +++++++++++++++---------------- generic/tkCanvUtil.c | 82 ++++++++++++++++----------------- generic/tkCanvWind.c | 2 +- generic/tkCanvas.c | 16 +++---- generic/tkClipboard.c | 2 +- generic/tkColor.c | 4 +- generic/tkConfig.c | 16 +++---- generic/tkCursor.c | 5 +- generic/tkEntry.c | 34 +++++++------- generic/tkEntry.h | 2 +- generic/tkEvent.c | 16 +++---- generic/tkFrame.c | 24 +++++----- generic/tkGC.c | 14 +++--- generic/tkGrab.c | 18 ++++---- generic/tkImage.c | 4 +- generic/tkImgBmap.c | 40 ++++++++-------- generic/tkImgPhoto.c | 22 ++++----- generic/tkListbox.c | 26 +++++------ generic/tkMenu.c | 2 +- generic/tkMenuDraw.c | 74 +++++++++++++++--------------- generic/tkMenubutton.c | 42 ++++++++--------- generic/tkMessage.c | 18 ++++---- generic/tkOldConfig.c | 38 ++++++++-------- generic/tkPanedWindow.c | 16 +++---- generic/tkPointer.c | 11 +++-- generic/tkRectOval.c | 94 +++++++++++++++++++------------------- generic/tkScale.c | 20 ++++---- generic/tkScale.h | 2 +- generic/tkScrollbar.c | 2 +- generic/tkSelect.c | 10 ++-- generic/tkSquare.c | 10 ++-- generic/tkTest.c | 4 +- generic/tkText.c | 38 ++++++++-------- generic/tkTextDisp.c | 60 ++++++++++++------------ generic/tkTextTag.c | 42 ++++++++--------- generic/tkVisual.c | 8 ++-- generic/tkWindow.c | 62 ++++++++++++------------- generic/ttk/ttkEntry.c | 10 ++-- generic/ttk/ttkLabel.c | 8 ++-- macosx/tkMacOSXDefault.h | 4 +- macosx/tkMacOSXEmbed.c | 6 +-- macosx/tkMacOSXMenu.c | 4 +- macosx/tkMacOSXScrlbr.c | 4 +- macosx/tkMacOSXXStubs.c | 2 +- unix/tkUnix3d.c | 4 +- unix/tkUnixDefault.h | 2 +- win/tkWinDefault.h | 2 +- 56 files changed, 734 insertions(+), 730 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index a97bed3..eebe122 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -236,7 +236,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; @@ -375,7 +375,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) { @@ -392,7 +392,7 @@ Tk_3DBorderGC( * compilers happy. */ - return 0; + return (GC) None; } /* @@ -428,29 +428,29 @@ Tk_Free3DBorder( prevPtr = (TkBorder *) 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); @@ -759,7 +759,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 df82323..c4f8226 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -631,7 +631,7 @@ static const TkStateMap visNotify[] = { }; static const TkStateMap configureRequestDetail[] = { - {0, "None"}, + {None, "None"}, {Above, "Above"}, {Below, "Below"}, {BottomIf, "BottomIf"}, @@ -3870,7 +3870,7 @@ DoWarp( { TkDisplay *dispPtr = (TkDisplay *) clientData; - XWarpPointer(dispPtr->display, 0, (Window) dispPtr->warpWindow, + XWarpPointer(dispPtr->display, (Window) None, (Window) dispPtr->warpWindow, 0, 0, 0, 0, (int) dispPtr->warpX, (int) dispPtr->warpY); XForceScreenSaver(dispPtr->display, ScreenSaverReset); dispPtr->flags &= ~TK_DISPLAY_IN_WARP; diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 73ab9fd..f7df546 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -218,7 +218,7 @@ Tk_AllocBitmapFromObj( bitmapPtr = GetBitmap(interp, tkwin, Tcl_GetString(objPtr)); objPtr->internalRep.twoPtrValue.ptr1 = (void *) bitmapPtr; if (bitmapPtr == NULL) { - return 0; + return None; } bitmapPtr->objRefCount++; return bitmapPtr->bitmap; @@ -260,7 +260,7 @@ Tk_GetBitmap( TkBitmap *bitmapPtr = GetBitmap(interp, tkwin, string); if (bitmapPtr == NULL) { - return 0; + return None; } return bitmapPtr->bitmap; } @@ -381,7 +381,7 @@ GetBitmap( bitmap = TkpGetNativeAppBitmap(Tk_Display(tkwin), string, &width, &height); - if (!bitmap) { + if (bitmap == None) { if (interp != NULL) { Tcl_AppendResult(interp, "bitmap \"", string, "\" not defined", NULL); @@ -395,7 +395,7 @@ GetBitmap( if (predefPtr->native) { bitmap = TkpCreateNativeBitmap(Tk_Display(tkwin), predefPtr->source); - if (!bitmap) { + if (bitmap == None) { Tcl_Panic("native bitmap creation failed"); } } else { diff --git a/generic/tkButton.c b/generic/tkButton.c index 1967ab2..0d8b9a4 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; @@ -969,37 +969,37 @@ DestroyButton( TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, (ClientData) 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_UntraceVar(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, (ClientData) butPtr); @@ -1184,7 +1184,7 @@ ConfigureButton( * don't go to zero and cause image data to be discarded. */ - if (butPtr->imagePtr) { + if (butPtr->imagePtr != NULL) { image = Tk_GetImage(butPtr->interp, butPtr->tkwin, Tcl_GetString(butPtr->imagePtr), ButtonImageProc, (ClientData) butPtr); @@ -1198,7 +1198,7 @@ ConfigureButton( Tk_FreeImage(butPtr->image); } butPtr->image = image; - if (butPtr->selectImagePtr) { + if (butPtr->selectImagePtr != NULL) { image = Tk_GetImage(butPtr->interp, butPtr->tkwin, Tcl_GetString(butPtr->selectImagePtr), ButtonSelectImageProc, (ClientData) butPtr); @@ -1208,7 +1208,7 @@ ConfigureButton( } else { image = NULL; } - if (butPtr->selectImage) { + if (butPtr->selectImage != NULL) { Tk_FreeImage(butPtr->selectImage); } butPtr->selectImage = image; @@ -1228,7 +1228,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) @@ -1243,14 +1243,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; @@ -1258,7 +1258,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. */ @@ -1366,17 +1366,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; @@ -1388,13 +1388,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; @@ -1408,18 +1408,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 101f7aa..33367de 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -296,11 +296,11 @@ CreateArc( arcPtr->fillColor = NULL; arcPtr->activeFillColor = NULL; arcPtr->disabledFillColor = NULL; - arcPtr->fillStipple = 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. @@ -452,11 +452,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; @@ -493,9 +493,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; @@ -511,23 +511,23 @@ ConfigureArc( color = arcPtr->fillColor; stipple = arcPtr->fillStipple; if (((TkCanvas *)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) { @@ -536,14 +536,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; @@ -598,25 +598,25 @@ DeleteArc( if (arcPtr->numOutlinePoints != 0) { ckfree((char *) 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); } } @@ -747,7 +747,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); @@ -804,20 +804,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; } } @@ -846,8 +846,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; @@ -876,14 +876,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); } @@ -895,7 +895,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], @@ -918,13 +918,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); } } @@ -1030,12 +1030,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; } @@ -1157,12 +1157,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; } @@ -1857,29 +1857,29 @@ ArcToPostscript( fillColor = arcPtr->fillColor; fillStipple = arcPtr->fillStipple; if (((TkCanvas *)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; } } @@ -1889,7 +1889,7 @@ ArcToPostscript( * arc. */ - if (arcPtr->fillGC) { + if (arcPtr->fillGC != None) { sprintf(buffer, "matrix currentmatrix\n%.15g %.15g translate %.15g %.15g scale\n", (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2, (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); @@ -1906,12 +1906,12 @@ ArcToPostscript( if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) { return TCL_ERROR; } - if (fillStipple) { + if (fillStipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) { return TCL_ERROR; } - if (arcPtr->outline.gc) { + if (arcPtr->outline.gc != None) { Tcl_AppendResult(interp, "grestore gsave\n", NULL); } } else { @@ -1923,7 +1923,7 @@ ArcToPostscript( * If there's an outline for the arc, draw it. */ - if (arcPtr->outline.gc) { + if (arcPtr->outline.gc != None) { sprintf(buffer, "matrix currentmatrix\n%.15g %.15g translate %.15g %.15g scale\n", (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2, (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); @@ -1946,7 +1946,7 @@ ArcToPostscript( != TCL_OK) { return TCL_ERROR; } - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK){ return TCL_ERROR; @@ -1963,7 +1963,7 @@ ArcToPostscript( != TCL_OK) { return TCL_ERROR; } - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 6f38293..5f97ef2 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -182,16 +182,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 @@ -336,9 +336,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; @@ -355,33 +355,33 @@ ConfigureBitmap( bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; if (((TkCanvas *)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 { @@ -390,7 +390,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; @@ -424,34 +424,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); } } @@ -490,11 +490,11 @@ ComputeBitmapBbox( } bitmap = bmapPtr->bitmap; if (((TkCanvas *)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; } } @@ -502,7 +502,7 @@ ComputeBitmapBbox( x = (int) (bmapPtr->x + ((bmapPtr->x >= 0) ? 0.5 : - 0.5)); y = (int) (bmapPtr->y + ((bmapPtr->y >= 0) ? 0.5 : - 0.5)); - if ((state == TK_STATE_HIDDEN) || !bitmap) { + if (state==TK_STATE_HIDDEN || bitmap == None) { bmapPtr->header.x1 = bmapPtr->header.x2 = x; bmapPtr->header.y1 = bmapPtr->header.y2 = y; return; @@ -600,16 +600,16 @@ DisplayBitmap( } bitmap = bmapPtr->bitmap; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (bmapPtr->activeBitmap) { + 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; @@ -868,28 +868,28 @@ BitmapToPostscript( bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; if (((TkCanvas *)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 134cc23..9e928c7 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -436,16 +436,16 @@ ComputeImageBbox( Tk_Image image; Tk_State state = imgPtr->header.state; - if (state == TK_STATE_NULL) { + if(state == TK_STATE_NULL) { state = ((TkCanvas *)canvas)->canvas_state; } image = imgPtr->image; if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)imgPtr) { - if (imgPtr->activeImage) { + if (imgPtr->activeImage != NULL) { image = imgPtr->activeImage; } } else if (state == TK_STATE_DISABLED) { - if (imgPtr->disabledImage) { + if (imgPtr->disabledImage != NULL) { image = imgPtr->disabledImage; } } @@ -453,7 +453,7 @@ ComputeImageBbox( x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5)); y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5)); - if ((state == TK_STATE_HIDDEN) || !image) { + 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 78cf74c..fea2103 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -303,7 +303,7 @@ CreateLine( linePtr->coordPtr = NULL; linePtr->capStyle = CapButt; linePtr->joinStyle = JoinRound; - linePtr->arrowGC = 0; + linePtr->arrowGC = NULL; linePtr->arrow = ARROWS_NONE; linePtr->arrowShapeA = (float)8.0; linePtr->arrowShapeB = (float)10.0; @@ -503,9 +503,9 @@ ConfigureLine( } if (linePtr->outline.activeWidth > linePtr->outline.width || - linePtr->outline.activeDash.number || - 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; @@ -531,7 +531,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( linePtr->splineSteps = 100; } - if (!linePtr->numPoints || (state==TK_STATE_HIDDEN)) { + if ((!linePtr->numPoints) || (state==TK_STATE_HIDDEN)) { ComputeLineBbox(canvas, linePtr); return TCL_OK; } @@ -562,7 +562,7 @@ ConfigureLine( * line's endpoints (they were shortened when the arrowheads were added). */ - if (linePtr->firstArrowPtr && (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]; @@ -618,16 +618,16 @@ DeleteLine( LineItem *linePtr = (LineItem *) itemPtr; Tk_DeleteOutline(display, &(linePtr->outline)); - if (linePtr->coordPtr) { + if (linePtr->coordPtr != NULL) { ckfree((char *) linePtr->coordPtr); } - if (linePtr->arrowGC) { + if (linePtr->arrowGC != None) { Tk_FreeGC(display, linePtr->arrowGC); } - if (linePtr->firstArrowPtr) { + if (linePtr->firstArrowPtr != NULL) { ckfree((char *) linePtr->firstArrowPtr); } - if (linePtr->lastArrowPtr) { + if (linePtr->lastArrowPtr != NULL) { ckfree((char *) linePtr->lastArrowPtr); } } @@ -664,7 +664,7 @@ ComputeLineBbox( state = ((TkCanvas *)canvas)->canvas_state; } - if (!(linePtr->numPoints) || (state == TK_STATE_HIDDEN)) { + if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) { linePtr->header.x1 = -1; linePtr->header.x2 = -1; linePtr->header.y1 = -1; @@ -677,7 +677,7 @@ ComputeLineBbox( if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } - } else if (state == TK_STATE_DISABLED) { + } else if (state==TK_STATE_DISABLED) { if (linePtr->outline.disabledWidth>0) { width = linePtr->outline.disabledWidth; } @@ -846,7 +846,7 @@ DisplayLine( int numPoints; Tk_State state = itemPtr->state; - if (!linePtr->numPoints || !linePtr->outline.gc) { + if ((!linePtr->numPoints)||(linePtr->outline.gc==None)) { return; } @@ -2251,7 +2251,7 @@ LineToPostscript( * being created. */ { LineItem *linePtr = (LineItem *) itemPtr; - char buffer[64 + 4*TCL_INTEGER_SPACE]; + char buffer[64 + TCL_INTEGER_SPACE]; char *style; double width; @@ -2270,20 +2270,20 @@ LineToPostscript( if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } - if (linePtr->outline.activeColor) { + if (linePtr->outline.activeColor!=NULL) { color = linePtr->outline.activeColor; } - if (linePtr->outline.activeStipple) { + if (linePtr->outline.activeStipple!=None) { stipple = linePtr->outline.activeStipple; } } else if (state==TK_STATE_DISABLED) { if (linePtr->outline.disabledWidth>0) { width = linePtr->outline.disabledWidth; } - if (linePtr->outline.disabledColor) { + if (linePtr->outline.disabledColor!=NULL) { color = linePtr->outline.disabledColor; } - if (linePtr->outline.disabledStipple) { + if (linePtr->outline.disabledStipple!=None) { stipple = linePtr->outline.disabledStipple; } } @@ -2301,7 +2301,7 @@ LineToPostscript( if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; @@ -2319,7 +2319,7 @@ LineToPostscript( if ((!linePtr->smooth) || (linePtr->numPoints < 3)) { Tk_CanvasPsPath(interp, canvas, linePtr->coordPtr, linePtr->numPoints); } else { - if (!stipple && linePtr->smooth->postscriptProc) { + if ((stipple == None) && linePtr->smooth->postscriptProc) { linePtr->smooth->postscriptProc(interp, canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps); } else { @@ -2379,8 +2379,8 @@ LineToPostscript( * Output polygons for the arrowheads, if there are any. */ - if (linePtr->firstArrowPtr) { - if (stipple) { + if (linePtr->firstArrowPtr != NULL) { + if (stipple != None) { Tcl_AppendResult(interp, "grestore gsave\n", NULL); } if (ArrowheadPostscript(interp, canvas, linePtr, @@ -2389,7 +2389,7 @@ LineToPostscript( } } if (linePtr->lastArrowPtr != NULL) { - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "grestore gsave\n", NULL); } if (ArrowheadPostscript(interp, canvas, linePtr, @@ -2438,17 +2438,17 @@ ArrowheadPostscript( stipple = linePtr->outline.stipple; if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) { - if (linePtr->outline.activeStipple) { + 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; } } Tk_CanvasPsPath(interp, canvas, arrowPtr, PTS_IN_ARROW); - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 9b210fa..0810ab6 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -276,10 +276,10 @@ CreatePolygon( polyPtr->fillColor = NULL; polyPtr->activeFillColor = NULL; polyPtr->disabledFillColor = NULL; - polyPtr->fillStipple = 0; - polyPtr->activeFillStipple = 0; - polyPtr->disabledFillStipple = 0; - polyPtr->fillGC = 0; + polyPtr->fillStipple = None; + polyPtr->activeFillStipple = None; + polyPtr->disabledFillStipple = None; + polyPtr->fillGC = NULL; polyPtr->smooth = NULL; polyPtr->splineSteps = 12; polyPtr->autoClosed = 0; @@ -459,11 +459,11 @@ ConfigurePolygon( state = itemPtr->state; if (polyPtr->outline.activeWidth > polyPtr->outline.width || - polyPtr->outline.activeDash.number || - polyPtr->outline.activeColor || - polyPtr->outline.activeStipple || - polyPtr->activeFillColor || - polyPtr->activeFillStipple) { + polyPtr->outline.activeDash.number != 0 || + polyPtr->outline.activeColor != NULL || + polyPtr->outline.activeStipple != None || + polyPtr->activeFillColor != NULL || + polyPtr->activeFillStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -484,7 +484,7 @@ ConfigurePolygon( mask |= GCCapStyle|GCJoinStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { - newGC = 0; + newGC = NULL; } if (polyPtr->outline.gc) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc); @@ -494,23 +494,23 @@ ConfigurePolygon( color = polyPtr->fillColor; stipple = polyPtr->fillStipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (polyPtr->activeFillColor) { + if (polyPtr->activeFillColor!=NULL) { color = polyPtr->activeFillColor; } - if (polyPtr->activeFillStipple) { + if (polyPtr->activeFillStipple!=None) { stipple = polyPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { if (polyPtr->disabledFillColor!=NULL) { color = polyPtr->disabledFillColor; } - if (polyPtr->disabledFillStipple) { + if (polyPtr->disabledFillStipple!=None) { stipple = polyPtr->disabledFillStipple; } } - if (color == NULL) { - newGC = 0; + if (!color) { + newGC = NULL; } else { gcValues.foreground = color->pixel; mask = GCForeground; @@ -530,7 +530,7 @@ ConfigurePolygon( #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (polyPtr->fillGC) { + if (polyPtr->fillGC != None) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC); } polyPtr->fillGC = newGC; @@ -575,28 +575,28 @@ DeletePolygon( PolygonItem *polyPtr = (PolygonItem *) itemPtr; Tk_DeleteOutline(display,&(polyPtr->outline)); - if (polyPtr->coordPtr) { + if (polyPtr->coordPtr != NULL) { ckfree((char *) polyPtr->coordPtr); } - if (polyPtr->fillColor) { + if (polyPtr->fillColor != NULL) { Tk_FreeColor(polyPtr->fillColor); } - if (polyPtr->activeFillColor) { + if (polyPtr->activeFillColor != NULL) { Tk_FreeColor(polyPtr->activeFillColor); } - if (polyPtr->disabledFillColor) { + if (polyPtr->disabledFillColor != NULL) { Tk_FreeColor(polyPtr->disabledFillColor); } - if (polyPtr->fillStipple) { + if (polyPtr->fillStipple != None) { Tk_FreeBitmap(display, polyPtr->fillStipple); } - if (polyPtr->activeFillStipple) { + if (polyPtr->activeFillStipple != None) { Tk_FreeBitmap(display, polyPtr->activeFillStipple); } - if (polyPtr->disabledFillStipple) { + if (polyPtr->disabledFillStipple != None) { Tk_FreeBitmap(display, polyPtr->disabledFillStipple); } - if (polyPtr->fillGC) { + if (polyPtr->fillGC != None) { Tk_FreeGC(display, polyPtr->fillGC); } } @@ -698,7 +698,7 @@ ComputePolygonBbox( } } - if (polyPtr->outline.gc) { + if (polyPtr->outline.gc != None) { tsoffset = &polyPtr->outline.tsoffset; if (tsoffset) { if (tsoffset->flags & TK_OFFSET_INDEX) { @@ -840,11 +840,11 @@ TkFillPolygon( * allocated. */ - if (gc && (numPoints > 3)) { + if (gc != None && numPoints>3) { XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex, CoordModeOrigin); } - if (outlineGC) { + if (outlineGC != None) { XDrawLines(display, drawable, outlineGC, pointPtr, numPoints, CoordModeOrigin); } @@ -885,9 +885,9 @@ DisplayPolygon( Pixmap stipple = polyPtr->fillStipple; double linewidth = polyPtr->outline.width; - if ((!polyPtr->fillGC && !polyPtr->outline.gc) || + if (((polyPtr->fillGC == None) && (polyPtr->outline.gc == None)) || (polyPtr->numPoints < 1) || - (polyPtr->numPoints < 3 && !polyPtr->outline.gc)) { + (polyPtr->numPoints < 3 && polyPtr->outline.gc == None)) { return; } @@ -898,14 +898,14 @@ DisplayPolygon( if (polyPtr->outline.activeWidth>linewidth) { linewidth = polyPtr->outline.activeWidth; } - if (polyPtr->activeFillStipple) { + if (polyPtr->activeFillStipple != None) { stipple = polyPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { if (polyPtr->outline.disabledWidth>0.0) { linewidth = polyPtr->outline.disabledWidth; } - if (polyPtr->disabledFillStipple) { + if (polyPtr->disabledFillStipple != None) { stipple = polyPtr->disabledFillStipple; } } @@ -915,7 +915,7 @@ DisplayPolygon( * reset the offset when done, since the GC is supposed to be read-only. */ - if (stipple && polyPtr->fillGC) { + if ((stipple != None) && (polyPtr->fillGC != None)) { Tk_TSOffset *tsoffset = &polyPtr->tsoffset; int w=0; int h=0; int flags = tsoffset->flags; @@ -977,11 +977,11 @@ DisplayPolygon( } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); - if (polyPtr->fillGC) { + if (polyPtr->fillGC != None) { XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr, numPoints, Complex, CoordModeOrigin); } - if (polyPtr->outline.gc) { + if (polyPtr->outline.gc != None) { XDrawLines(display, drawable, polyPtr->outline.gc, pointPtr, numPoints, CoordModeOrigin); } @@ -990,7 +990,7 @@ DisplayPolygon( } } Tk_ResetOutlineGC(canvas, itemPtr, &(polyPtr->outline)); - if (stipple && polyPtr->fillGC) { + if ((stipple != None) && (polyPtr->fillGC != None)) { XSetTSOrigin(display, polyPtr->fillGC, 0, 0); } } @@ -1303,7 +1303,7 @@ PolygonToPoint( if (bestDist<=0.0) { goto donepoint; } - if (polyPtr->outline.gc && (polyPtr->joinStyle == JoinRound)) { + if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) { dist = bestDist - radius; if (dist <= 0.0) { bestDist = 0.0; @@ -1313,7 +1313,7 @@ PolygonToPoint( } } - if (!polyPtr->outline.gc || (width <= 1)) { + if ((polyPtr->outline.gc == None) || (width <= 1)) { goto donepoint; } @@ -1520,7 +1520,7 @@ PolygonToArea( goto donearea; } - if (!polyPtr->outline.gc) { + if (polyPtr->outline.gc == None) { goto donearea; } @@ -1830,32 +1830,32 @@ PolygonToPostscript( if (polyPtr->outline.activeWidth>width) { width = polyPtr->outline.activeWidth; } - if (polyPtr->outline.activeColor) { + if (polyPtr->outline.activeColor!=NULL) { color = polyPtr->outline.activeColor; } - if (polyPtr->outline.activeStipple) { + if (polyPtr->outline.activeStipple!=None) { stipple = polyPtr->outline.activeStipple; } - if (polyPtr->activeFillColor) { + if (polyPtr->activeFillColor!=NULL) { fillColor = polyPtr->activeFillColor; } - if (polyPtr->activeFillStipple) { + if (polyPtr->activeFillStipple!=None) { fillStipple = polyPtr->activeFillStipple; } } else if (state==TK_STATE_DISABLED) { if (polyPtr->outline.disabledWidth>0.0) { width = polyPtr->outline.disabledWidth; } - if (polyPtr->outline.disabledColor) { + if (polyPtr->outline.disabledColor!=NULL) { color = polyPtr->outline.disabledColor; } - if (polyPtr->outline.disabledStipple) { + if (polyPtr->outline.disabledStipple!=None) { stipple = polyPtr->outline.disabledStipple; } - if (polyPtr->disabledFillColor) { + if (polyPtr->disabledFillColor!=NULL) { fillColor = polyPtr->disabledFillColor; } - if (polyPtr->disabledFillStipple) { + if (polyPtr->disabledFillStipple!=None) { fillStipple = polyPtr->disabledFillStipple; } } @@ -1873,7 +1873,7 @@ PolygonToPostscript( if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; @@ -1899,7 +1899,7 @@ PolygonToPostscript( if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) { return TCL_ERROR; } - if (fillStipple) { + if (fillStipple != None) { Tcl_AppendResult(interp, "eoclip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) { return TCL_ERROR; @@ -1916,7 +1916,7 @@ PolygonToPostscript( * Now draw the outline, if there is one. */ - if (color) { + if (color != NULL) { if (!polyPtr->smooth || !polyPtr->smooth->postscriptProc) { Tk_CanvasPsPath(interp, canvas, polyPtr->coordPtr, polyPtr->numPoints); diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index e187871..187ec40 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -253,9 +253,9 @@ CreateText( textPtr->disabledColor = NULL; textPtr->tkfont = NULL; textPtr->justify = TK_JUSTIFY_LEFT; - textPtr->stipple = 0; - textPtr->activeStipple = 0; - textPtr->disabledStipple = 0; + textPtr->stipple = None; + textPtr->activeStipple = None; + textPtr->disabledStipple = None; textPtr->text = NULL; textPtr->width = 0; textPtr->underline = -1; @@ -265,9 +265,9 @@ CreateText( textPtr->textLayout = NULL; textPtr->leftEdge = 0; textPtr->rightEdge = 0; - textPtr->gc = 0; - textPtr->selTextGC = 0; - textPtr->cursorOffGC = 0; + textPtr->gc = NULL; + textPtr->selTextGC = NULL; + textPtr->cursorOffGC = NULL; /* * Process the arguments to fill in the item record. Only 1 (list) or 2 (x @@ -414,7 +414,7 @@ ConfigureText( state = itemPtr->state; - if (textPtr->activeColor || textPtr->activeStipple) { + if (textPtr->activeColor != NULL || textPtr->activeStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; @@ -427,29 +427,29 @@ ConfigureText( color = textPtr->color; stipple = textPtr->stipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (textPtr->activeColor) { + if (textPtr->activeColor!=NULL) { color = textPtr->activeColor; } - if (textPtr->activeStipple) { + if (textPtr->activeStipple!=None) { stipple = textPtr->activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (textPtr->disabledColor) { + if (textPtr->disabledColor!=NULL) { color = textPtr->disabledColor; } - if (textPtr->disabledStipple) { + if (textPtr->disabledStipple!=None) { stipple = textPtr->disabledStipple; } } - newGC = newSelGC = 0; - if (textPtr->tkfont) { + newGC = newSelGC = NULL; + if (textPtr->tkfont != NULL) { gcValues.font = Tk_FontId(textPtr->tkfont); mask = GCFont; if (color) { gcValues.foreground = color->pixel; mask |= GCForeground; - if (stipple) { + if (stipple != None) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -471,7 +471,7 @@ ConfigureText( Tk_FreeGC(Tk_Display(tkwin), textPtr->gc); } textPtr->gc = newGC; - if (textPtr->selTextGC) { + if (textPtr->selTextGC != None) { Tk_FreeGC(Tk_Display(tkwin), textPtr->selTextGC); } textPtr->selTextGC = newSelGC; @@ -486,7 +486,7 @@ ConfigureText( } newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); } else { - newGC = 0; + newGC = NULL; } if (textPtr->cursorOffGC) { Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC); @@ -548,37 +548,37 @@ DeleteText( { TextItem *textPtr = (TextItem *) itemPtr; - if (textPtr->color) { + if (textPtr->color != NULL) { Tk_FreeColor(textPtr->color); } - if (textPtr->activeColor) { + if (textPtr->activeColor != NULL) { Tk_FreeColor(textPtr->activeColor); } - if (textPtr->disabledColor) { + if (textPtr->disabledColor != NULL) { Tk_FreeColor(textPtr->disabledColor); } Tk_FreeFont(textPtr->tkfont); - if (textPtr->stipple) { + if (textPtr->stipple != None) { Tk_FreeBitmap(display, textPtr->stipple); } - if (textPtr->activeStipple) { + if (textPtr->activeStipple != None) { Tk_FreeBitmap(display, textPtr->activeStipple); } - if (textPtr->disabledStipple) { + if (textPtr->disabledStipple != None) { Tk_FreeBitmap(display, textPtr->disabledStipple); } - if (textPtr->text) { + if (textPtr->text != NULL) { ckfree(textPtr->text); } Tk_FreeTextLayout(textPtr->textLayout); - if (textPtr->gc) { + if (textPtr->gc != None) { Tk_FreeGC(display, textPtr->gc); } - if (textPtr->selTextGC) { + if (textPtr->selTextGC != None) { Tk_FreeGC(display, textPtr->selTextGC); } - if (textPtr->cursorOffGC) { + if (textPtr->cursorOffGC != None) { Tk_FreeGC(display, textPtr->cursorOffGC); } } @@ -731,16 +731,16 @@ DisplayCanvText( } stipple = textPtr->stipple; if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (textPtr->activeStipple) { + if (textPtr->activeStipple!=None) { stipple = textPtr->activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (textPtr->disabledStipple) { + if (textPtr->disabledStipple!=None) { stipple = textPtr->disabledStipple; } } - if (!textPtr->gc) { + if (textPtr->gc == None) { return; } @@ -750,7 +750,7 @@ DisplayCanvText( * read-only. */ - if (stipple) { + if (stipple != None) { Tk_CanvasSetOffset(canvas, textPtr->gc, &textPtr->tsoffset); } @@ -830,7 +830,7 @@ DisplayCanvText( drawableX, drawableY, textInfoPtr->insertWidth, height, textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED); - } else if (textPtr->cursorOffGC) { + } else if (textPtr->cursorOffGC != None) { /* * Redraw the background over the area of the cursor, even * though the cursor is turned off. This guarantees that the @@ -874,7 +874,7 @@ DisplayCanvText( Tk_UnderlineTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->underline); - if (stipple) { + if (stipple != None) { XSetTSOrigin(display, textPtr->gc, 0, 0); } } @@ -1447,14 +1447,14 @@ TextToPostscript( if (textPtr->activeColor!=NULL) { color = textPtr->activeColor; } - if (textPtr->activeStipple) { + if (textPtr->activeStipple!=None) { stipple = textPtr->activeStipple; } } else if (state==TK_STATE_DISABLED) { - if (textPtr->disabledColor) { + if (textPtr->disabledColor!=NULL) { color = textPtr->disabledColor; } - if (textPtr->disabledStipple) { + if (textPtr->disabledStipple!=None) { stipple = textPtr->disabledStipple; } } @@ -1462,13 +1462,13 @@ TextToPostscript( if (Tk_CanvasPsFont(interp, canvas, textPtr->tkfont) != TCL_OK) { return TCL_ERROR; } - if (prepass) { + if (prepass != 0) { return TCL_OK; } if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "/StippleText {\n ", NULL); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendResult(interp, "} bind def\n", NULL); @@ -1506,7 +1506,7 @@ TextToPostscript( Tcl_PrintDouble(NULL, y / 2.0, buffer); Tcl_AppendResult(interp, " ", buffer, NULL); sprintf(buffer, " %s %s DrawText\n", - justify, (stipple ? "true" : "false")); + justify, ((stipple == None) ? "false" : "true")); Tcl_AppendResult(interp, buffer, NULL); return TCL_OK; diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index cacceda..299f502 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -959,7 +959,7 @@ void Tk_CreateOutline( Tk_Outline *outline) /* Outline structure to be filled in. */ { - outline->gc = 0; + outline->gc = NULL; outline->width = 1.0; outline->activeWidth = 0.0; outline->disabledWidth = 0.0; @@ -973,9 +973,9 @@ Tk_CreateOutline( outline->color = NULL; outline->activeColor = NULL; outline->disabledColor = NULL; - outline->stipple = 0; - outline->activeStipple = 0; - outline->disabledStipple = 0; + outline->stipple = None; + outline->activeStipple = None; + outline->disabledStipple = None; } /* @@ -1000,7 +1000,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 int)ABS(outline->dash.number) > sizeof(char *)) { @@ -1012,22 +1012,22 @@ Tk_DeleteOutline( if ((unsigned int)ABS(outline->disabledDash.number) > sizeof(char *)) { ckfree((char *) outline->disabledDash.pattern.pt); } - if (outline->color) { + 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); } } @@ -1093,26 +1093,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; } } @@ -1125,18 +1125,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); @@ -1191,30 +1191,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; } @@ -1236,7 +1236,7 @@ Tk_ChangeOutlineGC( XSetDashes(((TkCanvas *)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; @@ -1310,26 +1310,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; } } @@ -1342,7 +1342,7 @@ Tk_ResetOutlineGC( ((dash->number == -1) && (dash->pattern.array[0] != ','))) { if ((unsigned int)ABS(dash->number) > sizeof(char *)) { dashList = dash->pattern.pt[0]; - } else if (dash->number) { + } else if (dash->number != 0) { dashList = dash->pattern.array[0]; } else { dashList = (char) (4 * width + 0.5); @@ -1350,7 +1350,7 @@ Tk_ResetOutlineGC( XSetDashes(((TkCanvas *)canvas)->display, outline->gc, outline->offset, &dashList , 1); } - if (stipple) { + if (stipple != None) { XSetTSOrigin(((TkCanvas *)canvas)->display, outline->gc, 0, 0); return 1; } @@ -1409,10 +1409,10 @@ Tk_CanvasPsOutline( if (outline->activeDash.number > 0) { dash = &(outline->activeDash); } - if (outline->activeColor) { + if (outline->activeColor != NULL) { color = outline->activeColor; } - if (outline->activeStipple) { + if (outline->activeStipple != None) { stipple = outline->activeStipple; } } else if (state == TK_STATE_DISABLED) { @@ -1422,10 +1422,10 @@ Tk_CanvasPsOutline( if (outline->disabledDash.number > 0) { dash = &(outline->disabledDash); } - if (outline->disabledColor) { + if (outline->disabledColor != NULL) { color = outline->disabledColor; } - if (outline->disabledStipple) { + if (outline->disabledStipple != None) { stipple = outline->disabledStipple; } } @@ -1482,7 +1482,7 @@ Tk_CanvasPsOutline( if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } - if (stipple) { + if (stipple != None) { Tcl_AppendResult(interp, "StrokeClip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index c5ecf1a..b62859c 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -583,7 +583,7 @@ DisplayWinItem( * A drawable of None is used by the canvas UnmapNotify handler * to indicate that we should no longer display ourselves. */ - if (state == TK_STATE_HIDDEN || !drawable) { + 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 27a3a32..1024529 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -417,9 +417,9 @@ Tk_CanvasObjCmd( canvasPtr->highlightBgColorPtr = NULL; canvasPtr->highlightColorPtr = NULL; canvasPtr->inset = 0; - canvasPtr->pixmapGC = 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; @@ -463,7 +463,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)); @@ -1834,7 +1834,7 @@ DestroyCanvas( */ Tcl_DeleteHashTable(&canvasPtr->idTable); - if (canvasPtr->pixmapGC) { + if (canvasPtr->pixmapGC != None) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } #ifndef USE_OLD_TAG_SEARCH @@ -1910,7 +1910,7 @@ ConfigureCanvas( gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; newGC = Tk_GetGC(canvasPtr->tkwin, GCFunction|GCGraphicsExposures|GCForeground, &gcValues); - if (canvasPtr->pixmapGC) { + if (canvasPtr->pixmapGC != None) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } canvasPtr->pixmapGC = newGC; @@ -2405,7 +2405,7 @@ CanvasEventProc( itemPtr = itemPtr->nextPtr) { if (itemPtr->typePtr->alwaysRedraw & 1) { (*itemPtr->typePtr->displayProc)((Tk_Canvas) canvasPtr, - itemPtr, canvasPtr->display, 0, 0, 0, 0, 0); + itemPtr, canvasPtr->display, None, 0, 0, 0, 0); } } } @@ -4545,7 +4545,7 @@ PickCurrentItem( canvasPtr->pickEvent.xcrossing.display = eventPtr->xmotion.display; canvasPtr->pickEvent.xcrossing.window = eventPtr->xmotion.window; canvasPtr->pickEvent.xcrossing.root = eventPtr->xmotion.root; - canvasPtr->pickEvent.xcrossing.subwindow = 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 4c564e7..c6748a1 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -654,7 +654,7 @@ TkClipInit( Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts); Tk_MakeWindowExist(dispPtr->clipWindow); - if (!dispPtr->multipleAtom) { + 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 1ec4ab1..bde08cf 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -414,7 +414,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); @@ -469,7 +469,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 5fcbab8..ace7135 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -802,10 +802,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; } } @@ -858,7 +858,7 @@ DoObjConfig( valuePtr = NULL; } else { newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr); - if (!newCursor) { + if (newCursor == None) { return TCL_ERROR; } } @@ -1680,9 +1680,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); @@ -1700,7 +1700,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; } @@ -1954,7 +1954,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); } @@ -1974,7 +1974,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 ced2534..a1c2723 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -187,7 +187,10 @@ Tk_GetCursor( * details on legal syntax. */ { TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string); - return cursorPtr ? cursorPtr->cursor : 0; + if (cursorPtr == NULL) { + return 0; + } + return cursorPtr->cursor; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 5eaca77..f5b4339 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -523,16 +523,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; @@ -1030,10 +1030,10 @@ DestroyEntry( EntryTextVarProc, (ClientData) 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); @@ -1043,7 +1043,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; } @@ -1423,7 +1423,7 @@ EntryWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = 0; + GC gc = NULL; unsigned long mask; Tk_3DBorder border; XColor *colorPtr; @@ -1475,18 +1475,18 @@ EntryWorldChanged( gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); - if (entryPtr->textGC) { + 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; @@ -2451,7 +2451,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); @@ -3591,22 +3591,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 2ea7936..7f8aa1f 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -226,7 +226,7 @@ typedef struct { * value that the users requests. Malloc'ed */ char *valueFormat; /* Sprintf conversion specifier used for the * value. */ - char digitFormat[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 ac5b68c..9b001e1 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -421,11 +421,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)) { @@ -601,7 +601,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; @@ -617,7 +617,7 @@ UpdateButtonEventState( */ dispPtr->mouseButtonState &= ~allButtonsMask; - dispPtr->mouseButtonWindow = 0; + dispPtr->mouseButtonWindow = None; } else { eventPtr->xmotion.state |= dispPtr->mouseButtonState; } @@ -1192,7 +1192,7 @@ ParentXId( XFree(childList); } if (status == 0) { - parent = 0; + parent = None; } return parent; @@ -1365,7 +1365,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); @@ -1379,7 +1379,7 @@ Tk_HandleEvent( */ releaseInterpreter: - if (interp) { + if (interp != NULL) { Tcl_Release((ClientData) interp); } @@ -1427,7 +1427,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 ef1338e..3203cfa 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -487,7 +487,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) { @@ -591,14 +591,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); @@ -637,12 +637,12 @@ 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; } /* @@ -840,11 +840,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((char *) framePtr); @@ -967,7 +967,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) { @@ -1096,7 +1096,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; @@ -1528,8 +1528,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 c0864d0..800e4d3 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 3039ea0..44a4f8c 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -468,8 +468,8 @@ Tk_Grab( for (numTries = 0; numTries < 10; numTries++) { grabResult = XGrabPointer(dispPtr->display, winPtr->window, True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask - |PointerMotionMask, GrabModeAsync, GrabModeAsync, 0, - 0, CurrentTime); + |PointerMotionMask, GrabModeAsync, GrabModeAsync, None, + None, CurrentTime); if (grabResult != AlreadyGrabbed) { break; } @@ -854,7 +854,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, @@ -921,7 +921,7 @@ TkChangeEventWindow( Tk_GetRootCoords((Tk_Window) winPtr, &x, &y); eventPtr->xmotion.x = eventPtr->xmotion.x_root - x; eventPtr->xmotion.y = eventPtr->xmotion.y_root - y; - eventPtr->xmotion.subwindow = 0; + eventPtr->xmotion.subwindow = None; for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { if (childPtr->flags & TK_TOP_HIERARCHY) { @@ -940,7 +940,7 @@ TkChangeEventWindow( } else { eventPtr->xmotion.x = 0; eventPtr->xmotion.y = 0; - eventPtr->xmotion.subwindow = 0; + eventPtr->xmotion.subwindow = None; sameScreen = 0; } if (eventPtr->type == MotionNotify) { @@ -1029,7 +1029,7 @@ TkInOutEvents( */ #define QUEUE(w, t, d) \ - if (w->window) { \ + if (w->window != None) { \ eventPtr->type = t; \ if (focus) { \ eventPtr->xfocus.window = w->window; \ @@ -1145,9 +1145,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; } } @@ -1338,7 +1338,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 99a1726..6c7c9cd 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -759,7 +759,7 @@ Tk_PostscriptImage( gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); newGC = Tk_GetGC(tkwin, GCForeground, &gcValues); - if (newGC) { + if (newGC != None) { XFillRectangle(Tk_Display(tkwin), pmap, newGC, 0, 0, (unsigned int)width, (unsigned int)height); Tk_FreeGC(Tk_Display(tkwin), newGC); @@ -772,7 +772,7 @@ Tk_PostscriptImage( Tk_FreePixmap(Tk_Display(tkwin), pmap); - if (!ximage) { + 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 4e0082a..fab6afb 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -381,9 +381,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( @@ -414,7 +414,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; } @@ -424,7 +424,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); @@ -441,7 +441,7 @@ ImgBmapConfigureInstance( if (instancePtr->gc) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } - instancePtr->gc = 0; + instancePtr->gc = NULL; Tcl_AddErrorInfo(masterPtr->interp, "\n (while configuring image \""); Tcl_AddErrorInfo(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); Tcl_AddErrorInfo(masterPtr->interp, "\")"); @@ -834,9 +834,9 @@ ImgBmapGet( instancePtr->tkwin = tkwin; instancePtr->fg = NULL; instancePtr->bg = NULL; - instancePtr->bitmap = 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); @@ -890,7 +890,7 @@ ImgBmapDisplay( * creating the image instance so it can't be displayed. */ - if (!instancePtr->gc) { + if (instancePtr->gc == None) { return; } @@ -900,7 +900,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); @@ -949,19 +949,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) { @@ -1000,17 +1000,17 @@ ImgBmapDelete( { BitmapMaster *masterPtr = (BitmapMaster *) 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); @@ -1042,7 +1042,7 @@ ImgBmapCmdDeletedProc( BitmapMaster *masterPtr = (BitmapMaster *) clientData; masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster) { + if (masterPtr->tkMaster != NULL) { Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); } } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index d1503f6..4e1aa01 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2285,7 +2285,7 @@ ImgPhotoConfigureInstance( * has the side effect of allocating a pixmap for us. */ - if (!instancePtr->pixels || !instancePtr->error + if ((instancePtr->pixels == None) || (instancePtr->error == NULL) || (instancePtr->width != masterPtr->width) || (instancePtr->height != masterPtr->height)) { ImgPhotoInstanceSetSize(instancePtr); @@ -2403,7 +2403,7 @@ ImgPhotoGet( Tk_PreserveColormap(instancePtr->display, instancePtr->colormap); instancePtr->refCount = 1; instancePtr->colorTablePtr = NULL; - instancePtr->pixels = 0; + instancePtr->pixels = None; instancePtr->error = NULL; instancePtr->width = 0; instancePtr->height = 0; @@ -2776,7 +2776,7 @@ ImgPhotoDisplay( * the image instance so it can't be displayed. */ - if (!instancePtr->pixels) { + if (instancePtr->pixels == None) { return; } @@ -2834,7 +2834,7 @@ ImgPhotoDisplay( XCopyArea(display, instancePtr->pixels, drawable, instancePtr->gc, imageX, imageY, (unsigned) width, (unsigned) height, drawableX, drawableY); - XSetClipMask(display, instancePtr->gc, 0); + XSetClipMask(display, instancePtr->gc, None); XSetClipOrigin(display, instancePtr->gc, 0, 0); } XFlush(display); @@ -3196,7 +3196,7 @@ ImgPhotoInstanceSetSize( if ((instancePtr->width != masterPtr->width) || (instancePtr->height != masterPtr->height) - || !instancePtr->pixels) { + || (instancePtr->pixels == None)) { newPixmap = Tk_GetPixmap(instancePtr->display, RootWindow(instancePtr->display, instancePtr->visualInfo.screen), @@ -3218,7 +3218,7 @@ ImgPhotoInstanceSetSize( TkSetPixmapColormap(newPixmap, instancePtr->colormap); - if (instancePtr->pixels) { + if (instancePtr->pixels != None) { /* * Copy any common pixels from the old pixmap and free it. */ @@ -3995,19 +3995,19 @@ DisposeInstance( PhotoInstance *instancePtr = (PhotoInstance *) clientData; PhotoInstance *prevPtr; - if (instancePtr->pixels) { + if (instancePtr->pixels != None) { Tk_FreePixmap(instancePtr->display, instancePtr->pixels); } - if (instancePtr->gc) { + if (instancePtr->gc != None) { Tk_FreeGC(instancePtr->display, instancePtr->gc); } - if (instancePtr->imagePtr) { + if (instancePtr->imagePtr != NULL) { XDestroyImage(instancePtr->imagePtr); } - if (instancePtr->error) { + if (instancePtr->error != NULL) { ckfree((char *) instancePtr->error); } - if (instancePtr->colorTablePtr) { + if (instancePtr->colorTablePtr != NULL) { FreeColorTable(instancePtr->colorTablePtr, 1); } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 70e4e3c..1c9a8ae 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -534,15 +534,15 @@ Tk_ListboxObjCmd( ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS); listPtr->relief = TK_RELIEF_RAISED; - listPtr->textGC = 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; /* * Keep a hold of the associated tkwin until we destroy the listbox, @@ -1474,13 +1474,13 @@ DestroyListbox( * Tk_FreeOptions handle all the standard option-related stuff. */ - if (listPtr->textGC) { + 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); } @@ -1765,10 +1765,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; @@ -1777,18 +1777,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 fa14b7e..171087a 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -506,7 +506,7 @@ MenuCmd( Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, (ClientData) menuPtr, MenuCmdDeletedProc); menuPtr->active = -1; - menuPtr->cursorPtr = 0; + menuPtr->cursorPtr = NULL; menuPtr->masterMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; menuPtr->optionTablesPtr = optionTablesPtr; diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index d26f83b..11faa0a 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 a24ab98..95fb9a4 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -251,7 +251,7 @@ Tk_MenubuttonObjCmd( mbPtr->text = NULL; mbPtr->underline = -1; mbPtr->textVarName = NULL; - mbPtr->bitmap = 0; + mbPtr->bitmap = None; mbPtr->imageString = NULL; mbPtr->image = NULL; mbPtr->state = STATE_NORMAL; @@ -267,11 +267,11 @@ Tk_MenubuttonObjCmd( mbPtr->normalFg = NULL; mbPtr->activeFg = NULL; mbPtr->disabledFg = NULL; - mbPtr->normalTextGC = 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; @@ -288,7 +288,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; @@ -433,22 +433,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); @@ -578,7 +578,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: @@ -683,7 +683,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; @@ -692,7 +692,7 @@ TkMenuButtonWorldChanged( gcValues.background = Tk_3DBorderColor(mbPtr->activeBorder)->pixel; mask = GCForeground | GCBackground | GCFont; gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); - if (mbPtr->activeTextGC) { + if (mbPtr->activeTextGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC); } mbPtr->activeTextGC = gc; @@ -703,13 +703,13 @@ TkMenuButtonWorldChanged( * Create the GC that can be used for stippling */ - if (!mbPtr->stippleGC) { + 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; @@ -723,13 +723,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 9cfa593..40535b3 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -254,11 +254,11 @@ Tk_MessageObjCmd( (ClientData) msgPtr, MessageCmdDeletedProc); msgPtr->optionTable = optionTable; msgPtr->relief = TK_RELIEF_FLAT; - msgPtr->textGC = 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, (ClientData) msgPtr); @@ -396,13 +396,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_UntraceVar(msgPtr->interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, (ClientData) msgPtr); @@ -469,7 +469,7 @@ ConfigureMessage( CONST char *value; value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY); - if (!value) { + if (value == NULL) { Tcl_SetVar(interp, msgPtr->textVarName, msgPtr->string, TCL_GLOBAL_ONLY); } else { @@ -523,20 +523,20 @@ MessageWorldChanged( ClientData instanceData) /* Information about widget. */ { XGCValues gcValues; - GC gc = 0; + GC gc = NULL; Tk_FontMetrics fm; Message *msgPtr; msgPtr = (Message *) 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 955b3e0..cf5612b 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -431,16 +431,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; @@ -454,12 +454,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; @@ -480,12 +480,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; @@ -794,7 +794,7 @@ FormatConfigValue( case TK_CONFIG_UID: { Tk_Uid uid = *((Tk_Uid *) ptr); - if (uid) { + if (uid != NULL) { result = uid; } break; @@ -802,7 +802,7 @@ FormatConfigValue( case TK_CONFIG_COLOR: { XColor *colorPtr = *((XColor **) ptr); - if (colorPtr) { + if (colorPtr != NULL) { result = Tk_NameOfColor(colorPtr); } break; @@ -810,7 +810,7 @@ FormatConfigValue( case TK_CONFIG_FONT: { Tk_Font tkfont = *((Tk_Font *) ptr); - if (tkfont) { + if (tkfont != NULL) { result = Tk_NameOfFont(tkfont); } break; @@ -818,7 +818,7 @@ FormatConfigValue( case TK_CONFIG_BITMAP: { Pixmap pixmap = *((Pixmap *) ptr); - if (pixmap) { + if (pixmap != None) { result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); } break; @@ -826,7 +826,7 @@ FormatConfigValue( case TK_CONFIG_BORDER: { Tk_3DBorder border = *((Tk_3DBorder *) ptr); - if (border) { + if (border != NULL) { result = Tk_NameOf3DBorder(border); } break; @@ -838,7 +838,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; @@ -995,7 +995,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; } @@ -1011,22 +1011,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 f37892c..f232889 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, @@ -859,7 +859,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++) { @@ -868,7 +868,7 @@ ConfigureSlaves( break; } } - } else if (options.before) { + } else if (options.before != None) { tkwin = options.before; haveLoc = 1; for (i = 0; i < pwPtr->numSlaves; i++) { @@ -1299,7 +1299,7 @@ PanedWindowWorldChanged( gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel; newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues); - if (pwPtr->gc) { + if (pwPtr->gc != None) { Tk_FreeGC(pwPtr->display, pwPtr->gc); } pwPtr->gc = newGC; @@ -2018,10 +2018,10 @@ Unlink( for (i = 0; i < masterPtr->numSlaves; i++) { if (masterPtr->slaves[i]->before == slavePtr->tkwin) { - masterPtr->slaves[i]->before = 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 00e1328..dd4f7e6 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 = (ThreadSpecificData *) 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 af94c6f..53ebe61 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -259,10 +259,10 @@ CreateRectOval( rectOvalPtr->fillColor = NULL; rectOvalPtr->activeFillColor = NULL; rectOvalPtr->disabledFillColor = NULL; - rectOvalPtr->fillStipple = 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. @@ -429,11 +429,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; @@ -467,13 +467,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); @@ -494,23 +494,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; @@ -583,25 +583,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); } } @@ -670,7 +670,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 @@ -783,17 +783,17 @@ DisplayRectOval( } fillStipple = rectOvalPtr->fillStipple; if (((TkCanvas *)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; @@ -831,12 +831,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, @@ -907,7 +907,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; @@ -923,7 +923,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; @@ -1019,8 +1019,8 @@ OvalToPoint( } - filled = ovalPtr->fillGC != 0; - if (!ovalPtr->outline.gc) { + filled = ovalPtr->fillGC != None; + if (ovalPtr->outline.gc == None) { width = 0.0; filled = 1; } @@ -1075,7 +1075,7 @@ RectToArea( } halfWidth = width/2.0; - if (!rectPtr->outline.gc) { + if (rectPtr->outline.gc == None) { halfWidth = 0.0; } @@ -1085,7 +1085,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)) @@ -1154,7 +1154,7 @@ OvalToArea( */ halfWidth = width/2.0; - if (!ovalPtr->outline.gc) { + if (ovalPtr->outline.gc == None) { halfWidth = 0.0; } oval[0] = ovalPtr->bbox[0] - halfWidth; @@ -1171,8 +1171,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; @@ -1335,20 +1335,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; } } @@ -1357,12 +1357,12 @@ RectOvalToPostscript( * First draw the filled area of the rectangle. */ - if (fillColor) { + if (fillColor != NULL) { Tcl_AppendResult(interp, pathCmd, NULL); if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) { return TCL_ERROR; } - if (fillStipple) { + if (fillStipple != None) { Tcl_AppendResult(interp, "clip ", NULL); if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) { return TCL_ERROR; @@ -1379,7 +1379,7 @@ RectOvalToPostscript( * Now draw the outline, if there is one. */ - if (color) { + if (color != NULL) { Tcl_AppendResult(interp, pathCmd, "0 setlinejoin 2 setlinecap\n", NULL); if (Tk_CanvasPsOutline(canvas, itemPtr, diff --git a/generic/tkScale.c b/generic/tkScale.c index 32cb1b2..a804c36 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -264,11 +264,11 @@ Tk_ScaleObjCmd( scalePtr->activeBorder = NULL; scalePtr->sliderRelief = TK_RELIEF_RAISED; scalePtr->troughColorPtr = NULL; - scalePtr->troughGC = 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; @@ -285,7 +285,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; @@ -514,13 +514,13 @@ DestroyScale( TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, (ClientData) 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, @@ -727,7 +727,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; @@ -735,12 +735,12 @@ ScaleWorldChanged( gcValues.font = Tk_FontId(scalePtr->tkfont); gcValues.foreground = scalePtr->textColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground | GCFont, &gcValues); - if (scalePtr->textGC) { + 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 a19695f..a2c5f2b 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -78,7 +78,7 @@ typedef struct TkScale { * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ - char format[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 67fdd2b..7e39056 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -188,7 +188,7 @@ Tk_ScrollbarCmd( scrollPtr->lastUnit = 0; scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; - scrollPtr->cursor = 0; + scrollPtr->cursor = NULL; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 2f74172..7c96b94 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -130,7 +130,7 @@ Tk_CreateSelHandler( register TkSelHandler *selPtr; TkWindow *winPtr = (TkWindow *) tkwin; - if (!winPtr->dispPtr->multipleAtom) { + if (winPtr->dispPtr->multipleAtom == None) { TkSelInit(tkwin); } @@ -362,7 +362,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); @@ -471,7 +471,7 @@ Tk_ClearSelection( ClientData clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ - if (!dispPtr->multipleAtom) { + if (dispPtr->multipleAtom == None) { TkSelInit(tkwin); } @@ -494,7 +494,7 @@ Tk_ClearSelection( clearData = infoPtr->clearData; ckfree((char *) infoPtr); } - XSetSelectionOwner(winPtr->display, selection, 0, CurrentTime); + XSetSelectionOwner(winPtr->display, selection, None, CurrentTime); if (clearProc != NULL) { (*clearProc)(clearData); @@ -561,7 +561,7 @@ Tk_GetSelection( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) 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 305d756..355a447 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -166,7 +166,7 @@ SquareObjCmd( squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, (ClientData) squarePtr, SquareDeletedProc); - squarePtr->gc = 0; + squarePtr->gc = NULL; squarePtr->optionTable = optionTable; if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin) @@ -332,7 +332,7 @@ SquareConfigure( Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); - if (!squarePtr->gc && doubleBuffer) { + if ((squarePtr->gc == None) && (doubleBuffer)) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; @@ -394,10 +394,10 @@ SquareObjEventProc( squarePtr->updatePending = 1; } } else if (eventPtr->type == DestroyNotify) { - if (squarePtr->tkwin) { + 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; @@ -472,7 +472,7 @@ SquareDisplay( { Square *squarePtr = (Square *) 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 8f54781..d06769d 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -1047,7 +1047,7 @@ TestobjconfigObjCmd( recordPtr->index = 0; recordPtr->colorPtr = NULL; recordPtr->tkfont = NULL; - recordPtr->bitmap = 0; + recordPtr->bitmap = None; recordPtr->border = NULL; recordPtr->relief = TK_RELIEF_FLAT; recordPtr->cursor = NULL; @@ -1985,7 +1985,7 @@ TestpropCmd( w, propName, 0, 100000, False, AnyPropertyType, &actualType, &actualFormat, &length, &bytesAfter, &property); - if ((result == Success) && actualType) { + 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 425687f..004bcaf 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -568,7 +568,7 @@ CreateWidget( textPtr->state = TK_TEXT_STATE_NORMAL; textPtr->relief = TK_RELIEF_FLAT; - textPtr->cursor = 0; + textPtr->cursor = NULL; textPtr->charWidth = 1; textPtr->charHeight = 10; textPtr->wrapMode = TEXT_WRAPMODE_CHAR; @@ -2186,28 +2186,28 @@ ConfigureText( textPtr->selTagPtr->fgColor = textPtr->selFgColorPtr; textPtr->selTagPtr->affectsDisplay = 0; textPtr->selTagPtr->affectsDisplayGeometry = 0; - if (textPtr->selTagPtr->elideString - || 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; } - if (textPtr->selTagPtr->border - || textPtr->selTagPtr->reliefString - || textPtr->selTagPtr->bgStipple - || textPtr->selTagPtr->fgColor - || textPtr->selTagPtr->fgStipple - || textPtr->selTagPtr->overstrikeString - || textPtr->selTagPtr->underlineString) { + if ((textPtr->selTagPtr->border != NULL) + || (textPtr->selTagPtr->reliefString != NULL) + || (textPtr->selTagPtr->bgStipple != None) + || (textPtr->selTagPtr->fgColor != NULL) + || (textPtr->selTagPtr->fgStipple != None) + || (textPtr->selTagPtr->overstrikeString != NULL) + || (textPtr->selTagPtr->underlineString != NULL)) { textPtr->selTagPtr->affectsDisplay = 1; } TkTextRedrawTag(NULL, textPtr, NULL, NULL, textPtr->selTagPtr, 1); diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index cc304de..904fa1a 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -632,7 +632,7 @@ TkTextCreateDInfo( dInfoPtr = (TextDInfo *) ckalloc(sizeof(TextDInfo)); Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int)); dInfoPtr->dLinePtr = NULL; - dInfoPtr->copyGC = 0; + dInfoPtr->copyGC = NULL; gcValues.graphics_exposures = True; dInfoPtr->scrollGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues); @@ -696,19 +696,19 @@ TkTextFreeDInfo( FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK); Tcl_DeleteHashTable(&dInfoPtr->styleTable); - if (dInfoPtr->copyGC) { + if (dInfoPtr->copyGC != None) { Tk_FreeGC(textPtr->display, dInfoPtr->copyGC); } Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC); if (dInfoPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayText, (ClientData) textPtr); } - if (dInfoPtr->lineUpdateTimer) { + 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; @@ -827,70 +827,70 @@ 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; } - if ((tagPtr->fgColor) && (tagPtr->priority > fgPrio)) { + if ((tagPtr->fgColor != None) && (tagPtr->priority > fgPrio)) { styleValues.fgColor = tagPtr->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; } - if ((tagPtr->offsetString) + if ((tagPtr->offsetString != NULL) && (tagPtr->priority > offsetPrio)) { styleValues.offset = tagPtr->offset; offsetPrio = tagPtr->priority; } - if ((tagPtr->overstrikeString) + if ((tagPtr->overstrikeString != NULL) && (tagPtr->priority > overstrikePrio)) { styleValues.overstrike = tagPtr->overstrike; overstrikePrio = tagPtr->priority; } - if ((tagPtr->rMarginString) + if ((tagPtr->rMarginString != NULL) && (tagPtr->priority > rMarginPrio)) { styleValues.rMargin = tagPtr->rMargin; rMarginPrio = tagPtr->priority; } - if ((tagPtr->spacing1String) + if ((tagPtr->spacing1String != NULL) && (tagPtr->priority > spacing1Prio)) { 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; @@ -900,12 +900,12 @@ 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; } - if ((tagPtr->elideString) + if ((tagPtr->elideString != NULL) && (tagPtr->priority > elidePrio)) { styleValues.elide = tagPtr->elide; elidePrio = tagPtr->priority; @@ -916,7 +916,7 @@ GetStyle( wrapPrio = tagPtr->priority; } } - if (tagPtrs) { + if (tagPtrs != NULL) { ckfree((char *) tagPtrs); } @@ -941,20 +941,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; @@ -994,10 +994,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); } Tcl_DeleteHashEntry(stylePtr->hPtr); @@ -2578,7 +2578,7 @@ DisplayLineBackground( if ((chunkPtr->nextPtr == NULL) && (rightX < maxX)) { rightX = maxX; } - if (chunkPtr->stylePtr->bgGC) { + if (chunkPtr->stylePtr->bgGC != None) { /* * Not visible - bail out now. */ @@ -4335,7 +4335,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); } } @@ -4970,7 +4970,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; @@ -7708,7 +7708,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 5bf1899..a310dd7 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -489,29 +489,29 @@ 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; tagPtr->affectsDisplayGeometry = 1; } - if (tagPtr->border - || tagPtr->reliefString - || tagPtr->bgStipple - || tagPtr->fgColor - || tagPtr->fgStipple - || tagPtr->overstrikeString - || tagPtr->underlineString) { + if ((tagPtr->border != NULL) + || (tagPtr->reliefString != NULL) + || (tagPtr->bgStipple != None) + || (tagPtr->fgColor != NULL) + || (tagPtr->fgStipple != None) + || (tagPtr->overstrikeString != NULL) + || (tagPtr->underlineString != NULL)) { tagPtr->affectsDisplay = 1; } if (!newTag) { @@ -987,10 +987,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; @@ -1556,7 +1556,7 @@ TkTextPickCurrent( textPtr->pickEvent.xcrossing.display = eventPtr->xmotion.display; textPtr->pickEvent.xcrossing.window = eventPtr->xmotion.window; textPtr->pickEvent.xcrossing.root = eventPtr->xmotion.root; - textPtr->pickEvent.xcrossing.subwindow = 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 fe3e447..ec8be11 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -398,18 +398,18 @@ 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_AppendResult(interp, "can't use colormap for ", string, ": not on same screen", NULL); - return 0; + return None; } if (Tk_Visual(other) != Tk_Visual(tkwin)) { Tcl_AppendResult(interp, "can't use colormap for ", string, ": incompatible visuals", NULL); - return 0; + return None; } colormap = Tk_Colormap(other); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index c122128..1257e22 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -73,7 +73,7 @@ static const XWindowChanges defChanges = { EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \ VisibilityChangeMask|PropertyChangeMask|ColormapChangeMask static const XSetWindowAttributes defAtts= { - 0, /* background_pixmap */ + None, /* background_pixmap */ 0, /* background_pixel */ CopyFromParent, /* border_pixmap */ 0, /* border_pixel */ @@ -87,7 +87,7 @@ static const XSetWindowAttributes defAtts= { 0, /* do_not_propagate_mask */ False, /* override_redirect */ CopyFromParent, /* colormap */ - 0 /* cursor */ + None /* cursor */ }; /* @@ -504,9 +504,9 @@ GetScreen( dispPtr->lastEventTime = CurrentTime; dispPtr->bindInfoStale = 1; - dispPtr->cursorFont = 0; - dispPtr->warpWindow = 0; - dispPtr->multipleAtom = 0; + dispPtr->cursorFont = None; + dispPtr->warpWindow = None; + dispPtr->multipleAtom = None; /* * By default we do want to collapse motion events in @@ -667,7 +667,7 @@ TkAllocWindow( winPtr->visual = DefaultVisual(dispPtr->display, screenNum); winPtr->depth = DefaultDepth(dispPtr->display, screenNum); } - winPtr->window = 0; + winPtr->window = None; winPtr->childList = NULL; winPtr->lastChildPtr = NULL; winPtr->parentPtr = NULL; @@ -1403,7 +1403,7 @@ Tk_DestroyWindow( winPtr->pathName != NULL && !(winPtr->flags & TK_ANONYMOUS_WINDOW)) { halfdeadPtr->flags |= HD_DESTROY_EVENT; - if (!winPtr->window) { + if (winPtr->window == None) { Tk_MakeWindowExist(tkwin); } event.type = DestroyNotify; @@ -1449,7 +1449,7 @@ Tk_DestroyWindow( } else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) { TkWmRemoveFromColormapWindows(winPtr); } - if (winPtr->window) { + if (winPtr->window != None) { #if defined(MAC_OSX_TK) || defined(__WIN32__) XDestroyWindow(winPtr->display, winPtr->window); #else @@ -1469,7 +1469,7 @@ Tk_DestroyWindow( TkFreeWindowId(dispPtr, winPtr->window); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, (char *) winPtr->window)); - winPtr->window = 0; + winPtr->window = None; } dispPtr->destroyCount--; UnlinkWindow(winPtr); @@ -1642,7 +1642,7 @@ Tk_MapWindow( if (winPtr->flags & TK_MAPPED) { return; } - if (!winPtr->window) { + if (winPtr->window == None) { Tk_MakeWindowExist(tkwin); } /* @@ -1704,21 +1704,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); @@ -1744,7 +1744,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; changes.sibling = winPtr2->window; @@ -1863,7 +1863,7 @@ Tk_ConfigureWindow( Tcl_Panic("Can't set sibling or stack mode from Tk_ConfigureWindow."); } - if (winPtr->window) { + if (winPtr->window != None) { XConfigureWindow(winPtr->display, winPtr->window, valueMask, valuePtr); TkDoConfigureNotify(winPtr); @@ -1882,7 +1882,7 @@ Tk_MoveWindow( winPtr->changes.x = x; winPtr->changes.y = y; - if (winPtr->window) { + if (winPtr->window != None) { XMoveWindow(winPtr->display, winPtr->window, x, y); TkDoConfigureNotify(winPtr); } else { @@ -1900,7 +1900,7 @@ Tk_ResizeWindow( winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; - if (winPtr->window) { + if (winPtr->window != None) { XResizeWindow(winPtr->display, winPtr->window, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); @@ -1922,7 +1922,7 @@ Tk_MoveResizeWindow( winPtr->changes.y = y; winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; - if (winPtr->window) { + if (winPtr->window != None) { XMoveResizeWindow(winPtr->display, winPtr->window, x, y, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); @@ -1940,7 +1940,7 @@ Tk_SetWindowBorderWidth( register TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.border_width = width; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBorderWidth(winPtr->display, winPtr->window, (unsigned) width); TkDoConfigureNotify(winPtr); @@ -2007,7 +2007,7 @@ Tk_ChangeWindowAttributes( winPtr->atts.cursor = attsPtr->cursor; } - if (winPtr->window) { + if (winPtr->window != None) { XChangeWindowAttributes(winPtr->display, winPtr->window, valueMask, attsPtr); } else { @@ -2025,7 +2025,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) @@ -2042,7 +2042,7 @@ Tk_SetWindowBackgroundPixmap( winPtr->atts.background_pixmap = pixmap; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBackgroundPixmap(winPtr->display, winPtr->window, pixmap); } else { @@ -2060,7 +2060,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) @@ -2077,7 +2077,7 @@ Tk_SetWindowBorderPixmap( winPtr->atts.border_pixmap = pixmap; - if (winPtr->window) { + if (winPtr->window != None) { XSetWindowBorderPixmap(winPtr->display, winPtr->window, pixmap); } else { @@ -2099,7 +2099,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; @@ -2110,7 +2110,7 @@ void Tk_UndefineCursor( Tk_Window tkwin) /* Window to manipulate. */ { - Tk_DefineCursor(tkwin, 0); + Tk_DefineCursor(tkwin, NULL); } void @@ -2122,7 +2122,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); @@ -2162,7 +2162,7 @@ Tk_SetWindowVisual( { register TkWindow *winPtr = (TkWindow *) tkwin; - if (winPtr->window) { + if (winPtr->window != None) { /* Too late! */ return 0; } @@ -2222,7 +2222,7 @@ TkDoConfigureNotify( if (winPtr->changes.stack_mode == Above) { event.xconfigure.above = winPtr->changes.sibling; } else { - event.xconfigure.above = 0; + event.xconfigure.above = None; } event.xconfigure.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); @@ -2585,7 +2585,7 @@ Tk_RestackWindow( * will be handled properly when the window is finally created. */ - if (winPtr->window) { + if (winPtr->window != None) { XWindowChanges changes; unsigned int mask; @@ -2593,7 +2593,7 @@ Tk_RestackWindow( changes.stack_mode = Above; for (otherPtr = winPtr->nextPtr; otherPtr != NULL; otherPtr = otherPtr->nextPtr) { - if (otherPtr->window + 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 48aeb5c..ae43ae6 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1151,7 +1151,7 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip) mask |= GCForeground; } gc = Tk_GetGC(entryPtr->core.tkwin, mask, &gcValues); - if (clip) { + if (clip != None) { TkSetRegion(Tk_Display(entryPtr->core.tkwin), gc, clip); } return gc; @@ -1256,7 +1256,7 @@ static void EntryDisplay(void *clientData, Drawable d) gc = EntryGetGC(entryPtr, es.insertColorObj, clipRegion); XFillRectangle(Tk_Display(tkwin), d, gc, cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight); - XSetClipMask(Tk_Display(tkwin), gc, 0); + XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -1267,7 +1267,7 @@ static void EntryDisplay(void *clientData, Drawable d) Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, leftIndex, rightIndex); - XSetClipMask(Tk_Display(tkwin), gc, 0); + XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); /* Overwrite the selected portion (if any) in the -selectforeground color: @@ -1278,7 +1278,7 @@ static void EntryDisplay(void *clientData, Drawable d) Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, selFirst, selLast); - XSetClipMask(Tk_Display(tkwin), gc, 0); + XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -1286,7 +1286,7 @@ static void EntryDisplay(void *clientData, Drawable d) * it from the Xft guts (if they're being used). */ #ifdef HAVE_XFT - TkUnixSetXftClipRegion(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; diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 60d6cda..b80a3cf 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -37,7 +37,7 @@ #define ACTIVE_BG "systemButtonFacePressed" #define ACTIVE_FG "systemPushButtonPressedText" #define SELECT_BG "systemHighlight" -#define SELECT_FG None +#define SELECT_FG NULL #define INACTIVE_SELECT_BG "systemHighlightSecondary" #define TROUGH "#c3c3c3" #define INDICATOR "#b03060" @@ -281,7 +281,7 @@ #define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL) #define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL) #define DEF_MENU_ENTRY_BG ((char *) NULL) -#define DEF_MENU_ENTRY_BITMAP None +#define DEF_MENU_ENTRY_BITMAP NULL #define DEF_MENU_ENTRY_COLUMN_BREAK "0" #define DEF_MENU_ENTRY_COMMAND ((char *) NULL) #define DEF_MENU_ENTRY_COMPOUND "none" diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index bd7e0a8..03a724d 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -491,7 +491,7 @@ TkMacOSXContainerId( } } Tcl_Panic("TkMacOSXContainerId couldn't find window"); - return None; + return NULL; } /* @@ -527,8 +527,8 @@ TkMacOSXGetHostToplevel( * TODO: Here we should handle out of process embedding. */ - if (contWinPtr == NULL) { - return None; + if (!contWinPtr) { + return NULL; } return TkMacOSXGetHostToplevel(contWinPtr); } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 8f20447..6b957dc 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -1460,10 +1460,10 @@ TkpMenuInit(void) #undef observe [NSMenuItem setUsesUserKeyEquivalents:NO]; - tkColPtr = TkpGetColor(None, DEF_MENU_BG_COLOR); + tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR); defaultBg = tkColPtr->color.pixel; ckfree((char *) tkColPtr); - tkColPtr = TkpGetColor(None, DEF_MENU_FG); + tkColPtr = TkpGetColor(NULL, DEF_MENU_FG); defaultFg = tkColPtr->color.pixel; ckfree((char *) tkColPtr); diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 7dde501..ea0fdd0 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -104,8 +104,8 @@ TkpCreateScrollbar( MacScrollbar *scrollPtr = (MacScrollbar *)ckalloc(sizeof(MacScrollbar)); - scrollPtr->troughGC = None; - scrollPtr->copyGC = None; + scrollPtr->troughGC = NULL; + scrollPtr->copyGC = NULL; Tk_CreateEventHandler(tkwin,ExposureMask|StructureNotifyMask|FocusChangeMask|ButtonPressMask|VisibilityChangeMask, ScrollbarEventProc, scrollPtr); diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index e928298..a541945 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -1371,7 +1371,7 @@ void Tk_ResetUserInactiveTime( Display *dpy) { - IOGPoint loc; + IOGPoint loc = {0}; kern_return_t kr; NXEvent nullEvent = {NX_NULLEVENT, {0, 0}, 0, -1, 0}; enum { kNULLEventPostThrottle = 10 }; diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c index 417866b..14f5827 100644 --- a/unix/tkUnix3d.c +++ b/unix/tkUnix3d.c @@ -47,7 +47,7 @@ TkBorder * TkpGetBorder(void) { UnixBorder *borderPtr = (UnixBorder *) ckalloc(sizeof(UnixBorder)); - borderPtr->solidGC = None; + borderPtr->solidGC = NULL; return (TkBorder *) borderPtr; } @@ -215,7 +215,7 @@ Tk_3DHorizontalBevel( Display *display = Tk_Display(tkwin); int bottom, halfway, x1, x2, x1Delta, x2Delta; UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr; - GC topGC = None, bottomGC = None; + GC topGC = NULL, bottomGC = NULL; /* Initializations needed only to prevent * compiler warnings. */ diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h index a8ecdc1..7663903 100644 --- a/unix/tkUnixDefault.h +++ b/unix/tkUnixDefault.h @@ -243,7 +243,7 @@ #define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL #define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL #define DEF_MENU_ENTRY_BG (char *) NULL -#define DEF_MENU_ENTRY_BITMAP None +#define DEF_MENU_ENTRY_BITMAP NULL #define DEF_MENU_ENTRY_COLUMN_BREAK "0" #define DEF_MENU_ENTRY_COMMAND (char *) NULL #define DEF_MENU_ENTRY_COMPOUND "none" diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index 7f48703..cc561ec 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -246,7 +246,7 @@ #define DEF_MENU_ENTRY_ACTIVE_FG (char *) NULL #define DEF_MENU_ENTRY_ACCELERATOR (char *) NULL #define DEF_MENU_ENTRY_BG (char *) NULL -#define DEF_MENU_ENTRY_BITMAP 0 +#define DEF_MENU_ENTRY_BITMAP NULL #define DEF_MENU_ENTRY_COLUMN_BREAK "0" #define DEF_MENU_ENTRY_COMMAND (char *) NULL #define DEF_MENU_ENTRY_COMPOUND "none" -- cgit v0.12