summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-01-10 11:39:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-01-10 11:39:31 (GMT)
commitff3492bbc800f6cb8529315fc531339acef43fb4 (patch)
tree88a1aa87c3b869e363e04c8b2f5e2357d9e97f43 /generic
parent1fd3bd358e8df3bb28729eb43824fff9ecf50ec5 (diff)
parent587df2a3c0d221979267d8549003fa2dda184a38 (diff)
downloadtk-ff3492bbc800f6cb8529315fc531339acef43fb4.zip
tk-ff3492bbc800f6cb8529315fc531339acef43fb4.tar.gz
tk-ff3492bbc800f6cb8529315fc531339acef43fb4.tar.bz2
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r--generic/tk3d.c18
-rw-r--r--generic/tk3d.h4
-rw-r--r--generic/tkBind.c2
-rw-r--r--generic/tkBusy.c9
-rw-r--r--generic/tkButton.c32
-rw-r--r--generic/tkButton.h2
-rw-r--r--generic/tkCanvArc.c40
-rw-r--r--generic/tkCanvBmap.c6
-rw-r--r--generic/tkCanvImg.c2
-rw-r--r--generic/tkCanvLine.c12
-rw-r--r--generic/tkCanvPoly.c36
-rw-r--r--generic/tkCanvText.c26
-rw-r--r--generic/tkCanvUtil.c4
-rw-r--r--generic/tkCanvas.c8
-rw-r--r--generic/tkCanvas.h2
-rw-r--r--generic/tkColor.c10
-rw-r--r--generic/tkColor.h2
-rw-r--r--generic/tkConfig.c12
-rw-r--r--generic/tkCursor.c6
-rw-r--r--generic/tkEntry.c32
-rw-r--r--generic/tkEntry.h4
-rw-r--r--generic/tkEvent.c4
-rw-r--r--generic/tkFrame.c8
-rw-r--r--generic/tkGrab.c7
-rw-r--r--generic/tkImage.c2
-rw-r--r--generic/tkImgBmap.c14
-rw-r--r--generic/tkImgPhInstance.c2
-rw-r--r--generic/tkListbox.c16
-rw-r--r--generic/tkMain.c4
-rw-r--r--generic/tkMenu.c2
-rw-r--r--generic/tkMenu.h8
-rw-r--r--generic/tkMenuDraw.c62
-rw-r--r--generic/tkMenubutton.c26
-rw-r--r--generic/tkMenubutton.h2
-rw-r--r--generic/tkMessage.c10
-rw-r--r--generic/tkOldConfig.c12
-rw-r--r--generic/tkPanedWindow.c16
-rw-r--r--generic/tkPlace.c2
-rw-r--r--generic/tkRectOval.c36
-rw-r--r--generic/tkScale.c20
-rw-r--r--generic/tkScale.h2
-rw-r--r--generic/tkScrollbar.c2
-rw-r--r--generic/tkScrollbar.h2
-rw-r--r--generic/tkSquare.c6
-rw-r--r--generic/tkText.c15
-rw-r--r--generic/tkText.h6
-rw-r--r--generic/tkTextDisp.c109
-rw-r--r--generic/tkTextTag.c2
-rw-r--r--generic/tkWindow.c2
-rw-r--r--generic/ttk/ttkClassicTheme.c4
-rw-r--r--generic/ttk/ttkDefaultTheme.c7
-rw-r--r--generic/ttk/ttkEntry.c16
-rw-r--r--generic/ttk/ttkLabel.c5
-rw-r--r--generic/ttk/ttkLayout.c2
-rw-r--r--generic/ttk/ttkScroll.c2
-rw-r--r--generic/ttk/ttkState.c6
-rw-r--r--generic/ttk/ttkTheme.c5
-rw-r--r--generic/ttk/ttkTreeview.c2
-rw-r--r--generic/ttk/ttkWidget.c2
59 files changed, 366 insertions, 353 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 87ddf76..bcc5673 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -236,9 +236,9 @@ Tk_Get3DBorder(
borderPtr->darkColorPtr = NULL;
borderPtr->lightColorPtr = NULL;
borderPtr->shadow = None;
- borderPtr->bgGC = None;
- borderPtr->darkGC = None;
- borderPtr->lightGC = None;
+ borderPtr->bgGC = NULL;
+ borderPtr->darkGC = NULL;
+ borderPtr->lightGC = NULL;
borderPtr->hashPtr = hashPtr;
borderPtr->nextPtr = existingBorderPtr;
Tcl_SetHashValue(hashPtr, borderPtr);
@@ -374,7 +374,7 @@ Tk_3DBorderGC(
{
TkBorder * borderPtr = (TkBorder *) border;
- if ((borderPtr->lightGC == None) && (which != TK_3D_FLAT_GC)) {
+ if ((borderPtr->lightGC == NULL) && (which != TK_3D_FLAT_GC)) {
TkpGetShadows(borderPtr, tkwin);
}
if (which == TK_3D_FLAT_GC) {
@@ -391,7 +391,7 @@ Tk_3DBorderGC(
* compilers happy.
*/
- return (GC) None;
+ return NULL;
}
/*
@@ -439,13 +439,13 @@ Tk_Free3DBorder(
if (borderPtr->shadow != None) {
Tk_FreeBitmap(display, borderPtr->shadow);
}
- if (borderPtr->bgGC != None) {
+ if (borderPtr->bgGC != NULL) {
Tk_FreeGC(display, borderPtr->bgGC);
}
- if (borderPtr->darkGC != None) {
+ if (borderPtr->darkGC != NULL) {
Tk_FreeGC(display, borderPtr->darkGC);
}
- if (borderPtr->lightGC != None) {
+ if (borderPtr->lightGC != NULL) {
Tk_FreeGC(display, borderPtr->lightGC);
}
if (prevPtr == borderPtr) {
@@ -765,7 +765,7 @@ Tk_Draw3DPolygon(
int i, lightOnLeft, dx, dy, parallel, pointsSeen;
Display *display = Tk_Display(tkwin);
- if (borderPtr->lightGC == None) {
+ if (borderPtr->lightGC == NULL) {
TkpGetShadows(borderPtr, tkwin);
}
diff --git a/generic/tk3d.h b/generic/tk3d.h
index 891e927..ec7f7c7 100644
--- a/generic/tk3d.h
+++ b/generic/tk3d.h
@@ -54,10 +54,10 @@ typedef struct TkBorder {
GC bgGC; /* Used (if necessary) to draw areas in the
* background color. */
GC darkGC; /* Used to draw darker parts of the border.
- * None means the shadow colors haven't been
+ * NULL means the shadow colors haven't been
* allocated yet.*/
GC lightGC; /* Used to draw lighter parts of the border.
- * None means the shadow colors haven't been
+ * NULL means the shadow colors haven't been
* allocated yet. */
Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to
* delete structure). */
diff --git a/generic/tkBind.c b/generic/tkBind.c
index d117c87..aff6418 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -4384,7 +4384,7 @@ DoWarp(
if (dispPtr->warpWindow) {
Tcl_Release(dispPtr->warpWindow);
- dispPtr->warpWindow = None;
+ dispPtr->warpWindow = NULL;
}
dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
}
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 514465a..7bd6262 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -519,7 +519,8 @@ CreateBusy(
Tk_Window tkRef) /* Window hosting the busy window */
{
Busy *busyPtr;
- int length, x, y;
+ size_t length;
+ int x, y;
const char *fmt;
char *name;
Tk_Window tkBusy, tkChild, tkParent;
@@ -568,7 +569,7 @@ CreateBusy(
busyPtr->height = Tk_Height(tkRef);
busyPtr->x = Tk_X(tkRef);
busyPtr->y = Tk_Y(tkRef);
- busyPtr->cursor = None;
+ busyPtr->cursor = NULL;
Tk_SetClass(tkBusy, "Busy");
busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs);
if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable,
@@ -598,7 +599,7 @@ CreateBusy(
*/
Tk_ManageGeometry(tkBusy, &busyMgrInfo, busyPtr);
- if (busyPtr->cursor != None) {
+ if (busyPtr->cursor != NULL) {
Tk_DefineCursor(tkBusy, busyPtr->cursor);
}
@@ -643,7 +644,7 @@ ConfigureBusy(
return TCL_ERROR;
}
if (busyPtr->cursor != oldCursor) {
- if (busyPtr->cursor == None) {
+ if (busyPtr->cursor == NULL) {
Tk_UndefineCursor(busyPtr->tkBusy);
} else {
Tk_DefineCursor(busyPtr->tkBusy, busyPtr->cursor);
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 7760359..dc44189 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -710,12 +710,12 @@ ButtonCreate(
butPtr->normalFg = NULL;
butPtr->activeFg = NULL;
butPtr->disabledFg = NULL;
- butPtr->normalTextGC = None;
- butPtr->activeTextGC = None;
- butPtr->disabledGC = None;
- butPtr->stippleGC = None;
+ butPtr->normalTextGC = NULL;
+ butPtr->activeTextGC = NULL;
+ butPtr->disabledGC = NULL;
+ butPtr->stippleGC = NULL;
butPtr->gray = None;
- butPtr->copyGC = None;
+ butPtr->copyGC = NULL;
butPtr->widthPtr = NULL;
butPtr->width = 0;
butPtr->heightPtr = NULL;
@@ -740,7 +740,7 @@ ButtonCreate(
butPtr->onValuePtr = NULL;
butPtr->offValuePtr = NULL;
butPtr->tristateValuePtr = NULL;
- butPtr->cursor = None;
+ butPtr->cursor = NULL;
butPtr->takeFocusPtr = NULL;
butPtr->commandPtr = NULL;
butPtr->flags = 0;
@@ -981,22 +981,22 @@ DestroyButton(
if (butPtr->tristateImage != NULL) {
Tk_FreeImage(butPtr->tristateImage);
}
- if (butPtr->normalTextGC != None) {
+ if (butPtr->normalTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
- if (butPtr->activeTextGC != None) {
+ if (butPtr->activeTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
- if (butPtr->disabledGC != None) {
+ if (butPtr->disabledGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
- if (butPtr->stippleGC != None) {
+ if (butPtr->stippleGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->stippleGC);
}
if (butPtr->gray != None) {
Tk_FreeBitmap(butPtr->display, butPtr->gray);
}
- if (butPtr->copyGC != None) {
+ if (butPtr->copyGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->copyGC);
}
if (butPtr->textLayout != NULL) {
@@ -1367,7 +1367,7 @@ TkButtonWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
- if (butPtr->normalTextGC != None) {
+ if (butPtr->normalTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
butPtr->normalTextGC = newGC;
@@ -1377,7 +1377,7 @@ TkButtonWorldChanged(
gcValues.background = Tk_3DBorderColor(butPtr->activeBorder)->pixel;
mask = GCForeground | GCBackground | GCFont;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
- if (butPtr->activeTextGC != None) {
+ if (butPtr->activeTextGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
butPtr->activeTextGC = newGC;
@@ -1389,7 +1389,7 @@ TkButtonWorldChanged(
* Create the GC that can be used for stippling
*/
- if (butPtr->stippleGC == None) {
+ if (butPtr->stippleGC == NULL) {
gcValues.foreground = gcValues.background;
mask = GCForeground;
if (butPtr->gray == None) {
@@ -1415,12 +1415,12 @@ TkButtonWorldChanged(
gcValues.foreground = gcValues.background;
}
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
- if (butPtr->disabledGC != None) {
+ if (butPtr->disabledGC != NULL) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
butPtr->disabledGC = newGC;
- if (butPtr->copyGC == None) {
+ if (butPtr->copyGC == NULL) {
butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues);
}
diff --git a/generic/tkButton.h b/generic/tkButton.h
index 7ed464f..7e04fb9 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -235,7 +235,7 @@ typedef struct {
* Miscellaneous information:
*/
- Tk_Cursor cursor; /* Value of -cursor option: if not None,
+ Tk_Cursor cursor; /* Value of -cursor option: if not NULL,
* specifies current cursor for window. */
Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index 4e4c582..d9f0461 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -290,7 +290,7 @@ CreateArc(
arcPtr->activeFillStipple = None;
arcPtr->disabledFillStipple = None;
arcPtr->style = PIESLICE_STYLE;
- arcPtr->fillGC = None;
+ arcPtr->fillGC = NULL;
/*
* Process the arguments to fill in the item record.
@@ -478,9 +478,9 @@ ConfigureArc(
mask |= GCCapStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
- newGC = None;
+ newGC = NULL;
}
- if (arcPtr->outline.gc != None) {
+ if (arcPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc);
}
arcPtr->outline.gc = newGC;
@@ -512,9 +512,9 @@ ConfigureArc(
}
if (arcPtr->style == ARC_STYLE) {
- newGC = None;
+ newGC = NULL;
} else if (color == NULL) {
- newGC = None;
+ newGC = NULL;
} else {
gcValues.foreground = color->pixel;
if (arcPtr->style == CHORD_STYLE) {
@@ -530,7 +530,7 @@ ConfigureArc(
}
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
- if (arcPtr->fillGC != None) {
+ if (arcPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC);
}
arcPtr->fillGC = newGC;
@@ -603,7 +603,7 @@ DeleteArc(
if (arcPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, arcPtr->disabledFillStipple);
}
- if (arcPtr->fillGC != None) {
+ if (arcPtr->fillGC != NULL) {
Tk_FreeGC(display, arcPtr->fillGC);
}
}
@@ -734,7 +734,7 @@ ComputeArcBbox(
* drawn) and add one extra pixel just for safety.
*/
- if (arcPtr->outline.gc == None) {
+ if (arcPtr->outline.gc == NULL) {
tmp = 1;
} else {
tmp = (int) ((width + 1.0)/2.0 + 1);
@@ -833,7 +833,7 @@ DisplayArc(
* window servers to crash and should be a no-op anyway.
*/
- if ((arcPtr->fillGC != None) && (extent != 0)) {
+ if ((arcPtr->fillGC != NULL) && (extent != 0)) {
if (stipple != None) {
int w = 0;
int h = 0;
@@ -867,7 +867,7 @@ DisplayArc(
XSetTSOrigin(display, arcPtr->fillGC, 0, 0);
}
}
- if (arcPtr->outline.gc != None) {
+ if (arcPtr->outline.gc != NULL) {
Tk_ChangeOutlineGC(canvas, itemPtr, &(arcPtr->outline));
if (extent != 0) {
@@ -905,13 +905,13 @@ DisplayArc(
} else {
if (arcPtr->style == CHORD_STYLE) {
TkFillPolygon(canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
- display, drawable, arcPtr->outline.gc, None);
+ display, drawable, arcPtr->outline.gc, NULL);
} else if (arcPtr->style == PIESLICE_STYLE) {
TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
- display, drawable, arcPtr->outline.gc, None);
+ display, drawable, arcPtr->outline.gc, NULL);
TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
PIE_OUTLINE2_PTS, display, drawable,
- arcPtr->outline.gc, None);
+ arcPtr->outline.gc, NULL);
}
}
@@ -1017,12 +1017,12 @@ ArcToPoint(
return dist;
}
- if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) {
+ if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) {
filled = 1;
} else {
filled = 0;
}
- if (arcPtr->outline.gc == None) {
+ if (arcPtr->outline.gc == NULL) {
width = 0.0;
}
@@ -1144,12 +1144,12 @@ ArcToArea(
}
}
- if ((arcPtr->fillGC != None) || (arcPtr->outline.gc == None)) {
+ if ((arcPtr->fillGC != NULL) || (arcPtr->outline.gc == NULL)) {
filled = 1;
} else {
filled = 0;
}
- if (arcPtr->outline.gc == None) {
+ if (arcPtr->outline.gc == NULL) {
width = 0.0;
}
@@ -1883,7 +1883,7 @@ ArcToPostscript(
* arc.
*/
- if (arcPtr->fillGC != None) {
+ if (arcPtr->fillGC != NULL) {
Tcl_AppendPrintfToObj(psObj,
"matrix currentmatrix\n"
"%.15g %.15g translate %.15g %.15g scale\n",
@@ -1912,7 +1912,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (arcPtr->outline.gc != None) {
+ if (arcPtr->outline.gc != NULL) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
}
} else {
@@ -1924,7 +1924,7 @@ ArcToPostscript(
* If there's an outline for the arc, draw it.
*/
- if (arcPtr->outline.gc != None) {
+ if (arcPtr->outline.gc != NULL) {
Tcl_AppendPrintfToObj(psObj,
"matrix currentmatrix\n"
"%.15g %.15g translate %.15g %.15g scale\n",
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index d7d54f4..b9de07b 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -189,7 +189,7 @@ TkcCreateBitmap(
bmapPtr->bgColor = NULL;
bmapPtr->activeBgColor = NULL;
bmapPtr->disabledBgColor = NULL;
- bmapPtr->gc = None;
+ bmapPtr->gc = NULL;
/*
* Process the arguments to fill in the item record. Only 1 (list) or 2 (x
@@ -372,7 +372,7 @@ ConfigureBitmap(
}
if (bitmap == None) {
- newGC = None;
+ newGC = NULL;
} else {
gcValues.foreground = fgColor->pixel;
mask = GCForeground;
@@ -385,7 +385,7 @@ ConfigureBitmap(
}
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
- if (bmapPtr->gc != None) {
+ if (bmapPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), bmapPtr->gc);
}
bmapPtr->gc = newGC;
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 899741a..70b9c79 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -449,7 +449,7 @@ ComputeImageBbox(
x = (int) (imgPtr->x + ((imgPtr->x >= 0) ? 0.5 : - 0.5));
y = (int) (imgPtr->y + ((imgPtr->y >= 0) ? 0.5 : - 0.5));
- if ((state == TK_STATE_HIDDEN) || (image == None)) {
+ if ((state == TK_STATE_HIDDEN) || (image == NULL)) {
imgPtr->header.x1 = imgPtr->header.x2 = x;
imgPtr->header.y1 = imgPtr->header.y2 = y;
return;
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 087aa56..b6c845d 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -296,7 +296,7 @@ CreateLine(
linePtr->coordPtr = NULL;
linePtr->capStyle = CapButt;
linePtr->joinStyle = JoinRound;
- linePtr->arrowGC = None;
+ linePtr->arrowGC = NULL;
linePtr->arrow = ARROWS_NONE;
linePtr->arrowShapeA = (float)8.0;
linePtr->arrowShapeB = (float)10.0;
@@ -521,12 +521,12 @@ ConfigureLine(
#endif
arrowGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
- newGC = arrowGC = None;
+ newGC = arrowGC = NULL;
}
- if (linePtr->outline.gc != None) {
+ if (linePtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc);
}
- if (linePtr->arrowGC != None) {
+ if (linePtr->arrowGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->arrowGC);
}
linePtr->outline.gc = newGC;
@@ -611,7 +611,7 @@ DeleteLine(
if (linePtr->coordPtr != NULL) {
ckfree(linePtr->coordPtr);
}
- if (linePtr->arrowGC != None) {
+ if (linePtr->arrowGC != NULL) {
Tk_FreeGC(display, linePtr->arrowGC);
}
if (linePtr->firstArrowPtr != NULL) {
@@ -840,7 +840,7 @@ DisplayLine(
int numPoints;
Tk_State state = itemPtr->state;
- if ((!linePtr->numPoints) || (linePtr->outline.gc == None)) {
+ if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
}
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index b4ef098..be80378 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -273,7 +273,7 @@ CreatePolygon(
polyPtr->fillStipple = None;
polyPtr->activeFillStipple = None;
polyPtr->disabledFillStipple = None;
- polyPtr->fillGC = None;
+ polyPtr->fillGC = NULL;
polyPtr->smooth = NULL;
polyPtr->splineSteps = 12;
polyPtr->autoClosed = 0;
@@ -478,9 +478,9 @@ ConfigurePolygon(
mask |= GCCapStyle|GCJoinStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
- newGC = None;
+ newGC = NULL;
}
- if (polyPtr->outline.gc != None) {
+ if (polyPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc);
}
polyPtr->outline.gc = newGC;
@@ -504,7 +504,7 @@ ConfigurePolygon(
}
if (color == NULL) {
- newGC = None;
+ newGC = NULL;
} else {
gcValues.foreground = color->pixel;
mask = GCForeground;
@@ -524,7 +524,7 @@ ConfigurePolygon(
#endif
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
- if (polyPtr->fillGC != None) {
+ if (polyPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC);
}
polyPtr->fillGC = newGC;
@@ -590,7 +590,7 @@ DeletePolygon(
if (polyPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, polyPtr->disabledFillStipple);
}
- if (polyPtr->fillGC != None) {
+ if (polyPtr->fillGC != NULL) {
Tk_FreeGC(display, polyPtr->fillGC);
}
}
@@ -694,7 +694,7 @@ ComputePolygonBbox(
}
}
- if (polyPtr->outline.gc != None) {
+ if (polyPtr->outline.gc != NULL) {
tsoffset = &polyPtr->outline.tsoffset;
if (tsoffset) {
if (tsoffset->flags & TK_OFFSET_INDEX) {
@@ -836,11 +836,11 @@ TkFillPolygon(
* allocated.
*/
- if (gc != None && numPoints > 3) {
+ if (gc != NULL && numPoints > 3) {
XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex,
CoordModeOrigin);
}
- if (outlineGC != None) {
+ if (outlineGC != NULL) {
XDrawLines(display, drawable, outlineGC, pointPtr, numPoints,
CoordModeOrigin);
}
@@ -881,9 +881,9 @@ DisplayPolygon(
Pixmap stipple = polyPtr->fillStipple;
double linewidth = polyPtr->outline.width;
- if (((polyPtr->fillGC == None) && (polyPtr->outline.gc == None)) ||
+ if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) ||
(polyPtr->numPoints < 1) ||
- (polyPtr->numPoints < 3 && polyPtr->outline.gc == None)) {
+ (polyPtr->numPoints < 3 && polyPtr->outline.gc == NULL)) {
return;
}
@@ -911,7 +911,7 @@ DisplayPolygon(
* reset the offset when done, since the GC is supposed to be read-only.
*/
- if ((stipple != None) && (polyPtr->fillGC != None)) {
+ if ((stipple != None) && (polyPtr->fillGC != NULL)) {
Tk_TSOffset *tsoffset = &polyPtr->tsoffset;
int w = 0, h = 0;
int flags = tsoffset->flags;
@@ -973,11 +973,11 @@ DisplayPolygon(
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
- if (polyPtr->fillGC != None) {
+ if (polyPtr->fillGC != NULL) {
XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr,
numPoints, Complex, CoordModeOrigin);
}
- if (polyPtr->outline.gc != None) {
+ if (polyPtr->outline.gc != NULL) {
XDrawLines(display, drawable, polyPtr->outline.gc, pointPtr,
numPoints, CoordModeOrigin);
}
@@ -986,7 +986,7 @@ DisplayPolygon(
}
}
Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline);
- if ((stipple != None) && (polyPtr->fillGC != None)) {
+ if ((stipple != None) && (polyPtr->fillGC != NULL)) {
XSetTSOrigin(display, polyPtr->fillGC, 0, 0);
}
}
@@ -1299,7 +1299,7 @@ PolygonToPoint(
if (bestDist <= 0.0) {
goto donepoint;
}
- if ((polyPtr->outline.gc != None) && (polyPtr->joinStyle == JoinRound)) {
+ if ((polyPtr->outline.gc != NULL) && (polyPtr->joinStyle == JoinRound)) {
dist = bestDist - radius;
if (dist <= 0.0) {
bestDist = 0.0;
@@ -1309,7 +1309,7 @@ PolygonToPoint(
}
}
- if ((polyPtr->outline.gc == None) || (width <= 1)) {
+ if ((polyPtr->outline.gc == NULL) || (width <= 1)) {
goto donepoint;
}
@@ -1515,7 +1515,7 @@ PolygonToArea(
goto donearea;
}
- if (polyPtr->outline.gc == None) {
+ if (polyPtr->outline.gc == NULL) {
goto donearea;
}
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index eb8dfe3..279e548 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -269,9 +269,9 @@ CreateText(
textPtr->textLayout = NULL;
textPtr->actualWidth = 0;
textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0;
- textPtr->gc = None;
- textPtr->selTextGC = None;
- textPtr->cursorOffGC = None;
+ textPtr->gc = NULL;
+ textPtr->selTextGC = NULL;
+ textPtr->cursorOffGC = NULL;
textPtr->sine = 0.0;
textPtr->cosine = 1.0;
@@ -447,7 +447,7 @@ ConfigureText(
}
}
- newGC = newSelGC = None;
+ newGC = newSelGC = NULL;
if (textPtr->tkfont != NULL) {
gcValues.font = Tk_FontId(textPtr->tkfont);
mask = GCFont;
@@ -472,11 +472,11 @@ ConfigureText(
}
newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues);
}
- if (textPtr->gc != None) {
+ if (textPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->gc);
}
textPtr->gc = newGC;
- if (textPtr->selTextGC != None) {
+ if (textPtr->selTextGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->selTextGC);
}
textPtr->selTextGC = newSelGC;
@@ -491,9 +491,9 @@ ConfigureText(
}
newGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
} else {
- newGC = None;
+ newGC = NULL;
}
- if (textPtr->cursorOffGC != None) {
+ if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC);
}
textPtr->cursorOffGC = newGC;
@@ -592,13 +592,13 @@ DeleteText(
}
Tk_FreeTextLayout(textPtr->textLayout);
- if (textPtr->gc != None) {
+ if (textPtr->gc != NULL) {
Tk_FreeGC(display, textPtr->gc);
}
- if (textPtr->selTextGC != None) {
+ if (textPtr->selTextGC != NULL) {
Tk_FreeGC(display, textPtr->selTextGC);
}
- if (textPtr->cursorOffGC != None) {
+ if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(display, textPtr->cursorOffGC);
}
}
@@ -820,7 +820,7 @@ DisplayCanvText(
}
}
- if (textPtr->gc == None) {
+ if (textPtr->gc == NULL) {
return;
}
@@ -932,7 +932,7 @@ DisplayCanvText(
Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable,
textInfoPtr->insertBorder, points, 4,
textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED);
- } else if (textPtr->cursorOffGC != None) {
+ } else if (textPtr->cursorOffGC != NULL) {
/*
* Redraw the background over the area of the cursor, even
* though the cursor is turned off. This guarantees that the
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 09ce98c..6ce671d 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -961,7 +961,7 @@ void
Tk_CreateOutline(
Tk_Outline *outline) /* Outline structure to be filled in. */
{
- outline->gc = None;
+ outline->gc = NULL;
outline->width = 1.0;
outline->activeWidth = 0.0;
outline->disabledWidth = 0.0;
@@ -1002,7 +1002,7 @@ Tk_DeleteOutline(
Display *display, /* Display containing window. */
Tk_Outline *outline)
{
- if (outline->gc != None) {
+ if (outline->gc != NULL) {
Tk_FreeGC(display, outline->gc);
}
if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) {
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index ecabe22..414c6fb 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -678,7 +678,7 @@ Tk_CanvasObjCmd(
canvasPtr->highlightBgColorPtr = NULL;
canvasPtr->highlightColorPtr = NULL;
canvasPtr->inset = 0;
- canvasPtr->pixmapGC = None;
+ canvasPtr->pixmapGC = NULL;
canvasPtr->width = None;
canvasPtr->height = None;
canvasPtr->confine = 0;
@@ -724,7 +724,7 @@ Tk_CanvasObjCmd(
canvasPtr->scanYOrigin = 0;
canvasPtr->hotPtr = NULL;
canvasPtr->hotPrevPtr = NULL;
- canvasPtr->cursor = None;
+ canvasPtr->cursor = NULL;
canvasPtr->takeFocus = NULL;
canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin));
canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin));
@@ -2189,7 +2189,7 @@ DestroyCanvas(
*/
Tcl_DeleteHashTable(&canvasPtr->idTable);
- if (canvasPtr->pixmapGC != None) {
+ if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
#ifndef USE_OLD_TAG_SEARCH
@@ -2265,7 +2265,7 @@ ConfigureCanvas(
gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
newGC = Tk_GetGC(canvasPtr->tkwin,
GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
- if (canvasPtr->pixmapGC != None) {
+ if (canvasPtr->pixmapGC != NULL) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
canvasPtr->pixmapGC = newGC;
diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h
index b8b1b46..e2221a8 100644
--- a/generic/tkCanvas.h
+++ b/generic/tkCanvas.h
@@ -206,7 +206,7 @@ typedef struct TkCanvas {
* Miscellaneous information:
*/
- Tk_Cursor cursor; /* Current cursor for window, or None. */
+ Tk_Cursor cursor; /* Current cursor for window, or NULL. */
char *takeFocus; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */
diff --git a/generic/tkColor.c b/generic/tkColor.c
index 9abb448..ccb9914 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -245,7 +245,7 @@ Tk_GetColor(
*/
tkColPtr->magic = COLOR_MAGIC;
- tkColPtr->gc = None;
+ tkColPtr->gc = NULL;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = Tk_Colormap(tkwin);
tkColPtr->visual = Tk_Visual(tkwin);
@@ -326,7 +326,7 @@ Tk_GetColorByValue(
tkColPtr = TkpGetColorByValue(tkwin, colorPtr);
tkColPtr->magic = COLOR_MAGIC;
- tkColPtr->gc = None;
+ tkColPtr->gc = NULL;
tkColPtr->screen = Tk_Screen(tkwin);
tkColPtr->colormap = valueKey.colormap;
tkColPtr->visual = Tk_Visual(tkwin);
@@ -436,7 +436,7 @@ Tk_GCForColor(
Tcl_Panic("Tk_GCForColor called with bogus color");
}
- if (tkColPtr->gc == None) {
+ if (tkColPtr->gc == NULL) {
gcValues.foreground = tkColPtr->color.pixel;
tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable,
GCForeground, &gcValues);
@@ -491,9 +491,9 @@ Tk_FreeColor(
* longer any objects referencing it.
*/
- if (tkColPtr->gc != None) {
+ if (tkColPtr->gc != NULL) {
XFreeGC(DisplayOfScreen(screen), tkColPtr->gc);
- tkColPtr->gc = None;
+ tkColPtr->gc = NULL;
}
TkpFreeColor(tkColPtr);
diff --git a/generic/tkColor.h b/generic/tkColor.h
index 05ef295..54e8cdc 100644
--- a/generic/tkColor.h
+++ b/generic/tkColor.h
@@ -32,7 +32,7 @@ typedef struct TkColor {
* COLOR_MAGIC. */
GC gc; /* Simple gc with this color as foreground
* color and all other fields defaulted. May
- * be None. */
+ * be NULL. */
Screen *screen; /* Screen where this color is valid. Used to
* delete it, and to find its display. */
Colormap colormap; /* Colormap from which this entry was
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 795a8e8..d3c8aad 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -800,11 +800,11 @@ DoObjConfig(
Tk_Cursor newCursor;
if (nullOK && ObjectIsEmpty(valuePtr)) {
- newCursor = None;
+ newCursor = NULL;
valuePtr = NULL;
} else {
newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr);
- if (newCursor == None) {
+ if (newCursor == NULL) {
return TCL_ERROR;
}
}
@@ -862,7 +862,7 @@ DoObjConfig(
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
- newWin = None;
+ newWin = NULL;
} else {
if (TkGetWindowFromObj(interp, tkwin, valuePtr,
&newWin) != TCL_OK) {
@@ -1666,9 +1666,9 @@ FreeResources(
break;
case TK_OPTION_CURSOR:
if (internalFormExists) {
- if (*((Tk_Cursor *) internalPtr) != None) {
+ if (*((Tk_Cursor *) internalPtr) != NULL) {
Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr));
- *((Tk_Cursor *) internalPtr) = None;
+ *((Tk_Cursor *) internalPtr) = NULL;
}
} else if (objPtr != NULL) {
Tk_FreeCursorFromObj(tkwin, objPtr);
@@ -1939,7 +1939,7 @@ GetObjectForOption(
case TK_OPTION_CURSOR: {
Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
- if (cursor != None) {
+ if (cursor != NULL) {
objPtr = Tcl_NewStringObj(
Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
}
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 6b2d5f4..ff66d17 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -150,7 +150,7 @@ Tk_AllocCursorFromObj(
cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr));
objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr;
if (cursorPtr == NULL) {
- return None;
+ return NULL;
}
cursorPtr->objRefCount++;
return cursorPtr->cursor;
@@ -190,7 +190,7 @@ Tk_GetCursor(
TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string);
if (cursorPtr == NULL) {
- return None;
+ return NULL;
}
return cursorPtr->cursor;
}
@@ -388,7 +388,7 @@ Tk_GetCursorFromData(
error:
Tcl_DeleteHashEntry(dataHashPtr);
- return None;
+ return NULL;
}
/*
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 678691f..05a1a60 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -524,16 +524,16 @@ Tk_EntryObjCmd(
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
- entryPtr->cursor = None;
+ entryPtr->cursor = NULL;
entryPtr->exportSelection = 1;
entryPtr->justify = TK_JUSTIFY_LEFT;
entryPtr->relief = TK_RELIEF_FLAT;
entryPtr->state = STATE_NORMAL;
entryPtr->displayString = entryPtr->string;
entryPtr->inset = XPAD;
- entryPtr->textGC = None;
- entryPtr->selTextGC = None;
- entryPtr->highlightGC = None;
+ entryPtr->textGC = NULL;
+ entryPtr->selTextGC = NULL;
+ entryPtr->highlightGC = NULL;
entryPtr->avgWidth = 1;
entryPtr->validate = VALIDATE_NONE;
@@ -1033,10 +1033,10 @@ DestroyEntry(
EntryTextVarProc, entryPtr);
entryPtr->flags &= ~ENTRY_VAR_TRACED;
}
- if (entryPtr->textGC != None) {
+ if (entryPtr->textGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->textGC);
}
- if (entryPtr->selTextGC != None) {
+ if (entryPtr->selTextGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->selTextGC);
}
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
@@ -1430,7 +1430,7 @@ EntryWorldChanged(
ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
- GC gc = None;
+ GC gc = NULL;
unsigned long mask;
Tk_3DBorder border;
XColor *colorPtr;
@@ -1482,7 +1482,7 @@ EntryWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCFont | GCGraphicsExposures;
gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues);
- if (entryPtr->textGC != None) {
+ if (entryPtr->textGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->textGC);
}
entryPtr->textGC = gc;
@@ -1493,7 +1493,7 @@ EntryWorldChanged(
gcValues.font = Tk_FontId(entryPtr->tkfont);
mask = GCForeground | GCFont;
gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues);
- if (entryPtr->selTextGC != None) {
+ if (entryPtr->selTextGC != NULL) {
Tk_FreeGC(entryPtr->display, entryPtr->selTextGC);
}
entryPtr->selTextGC = gc;
@@ -2457,9 +2457,9 @@ EntryEventProc(
} else if ((elem == SEL_BUTTONDOWN) || (elem == SEL_BUTTONUP)) {
cursor = sbPtr->bCursor;
} else {
- cursor = None;
+ cursor = NULL;
}
- if (cursor != None) {
+ if (cursor != NULL) {
Tk_DefineCursor(entryPtr->tkwin, cursor);
} else {
Tk_UndefineCursor(entryPtr->tkwin);
@@ -3633,22 +3633,22 @@ Tk_SpinboxObjCmd(
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
- entryPtr->cursor = None;
+ entryPtr->cursor = NULL;
entryPtr->exportSelection = 1;
entryPtr->justify = TK_JUSTIFY_LEFT;
entryPtr->relief = TK_RELIEF_FLAT;
entryPtr->state = STATE_NORMAL;
entryPtr->displayString = entryPtr->string;
entryPtr->inset = XPAD;
- entryPtr->textGC = None;
- entryPtr->selTextGC = None;
- entryPtr->highlightGC = None;
+ entryPtr->textGC = NULL;
+ entryPtr->selTextGC = NULL;
+ entryPtr->highlightGC = NULL;
entryPtr->avgWidth = 1;
entryPtr->validate = VALIDATE_NONE;
sbPtr->selElement = SEL_NONE;
sbPtr->curElement = SEL_NONE;
- sbPtr->bCursor = None;
+ sbPtr->bCursor = NULL;
sbPtr->repeatDelay = 400;
sbPtr->repeatInterval = 100;
sbPtr->fromValue = 0.0;
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index 12c0374..6b1bf87 100644
--- a/generic/tkEntry.h
+++ b/generic/tkEntry.h
@@ -82,7 +82,7 @@ typedef struct {
* in readonly state, plus used for
* background. */
int borderWidth; /* Width of 3-D border around window. */
- Tk_Cursor cursor; /* Current cursor for window, or None. */
+ Tk_Cursor cursor; /* Current cursor for window, or NULL. */
int exportSelection; /* Non-zero means tie internal entry selection
* to X selection. */
Tk_Font tkfont; /* Information about text font, or NULL. */
@@ -192,7 +192,7 @@ typedef struct {
Tk_3DBorder activeBorder; /* Used for drawing border around active
* buttons. */
Tk_3DBorder buttonBorder; /* Used for drawing border around buttons. */
- Tk_Cursor bCursor; /* cursor for buttons, or None. */
+ Tk_Cursor bCursor; /* cursor for buttons, or NULL. */
int bdRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
int buRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */
char *command; /* Command to invoke for spin buttons. NULL
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index d058e7c..891f667 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -1368,7 +1368,7 @@ Tk_HandleEvent(
* handle CreateNotify events, so we gotta pass 'em through.
*/
- if ((ip.winPtr != None)
+ if ((ip.winPtr != NULL)
&& ((mask != SubstructureNotifyMask)
|| (eventPtr->type == CreateNotify))) {
TkBindEventProc(winPtr, eventPtr);
@@ -1439,7 +1439,7 @@ TkEventDeadWindow(
ipPtr->nextHandler = NULL;
}
if (ipPtr->winPtr == winPtr) {
- ipPtr->winPtr = None;
+ ipPtr->winPtr = NULL;
}
}
ckfree(handlerPtr);
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 0f1a1b3..ce7dc8c 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -662,13 +662,13 @@ CreateFrame(
framePtr->type = type;
framePtr->colormap = colormap;
framePtr->relief = TK_RELIEF_FLAT;
- framePtr->cursor = None;
+ framePtr->cursor = NULL;
if (framePtr->type == TYPE_LABELFRAME) {
Labelframe *labelframePtr = (Labelframe *) framePtr;
labelframePtr->labelAnchor = LABELANCHOR_NW;
- labelframePtr->textGC = None;
+ labelframePtr->textGC = NULL;
}
/*
@@ -864,7 +864,7 @@ DestroyFrame(
if (framePtr->type == TYPE_LABELFRAME) {
Tk_FreeTextLayout(labelframePtr->textLayout);
- if (labelframePtr->textGC != None) {
+ if (labelframePtr->textGC != NULL) {
Tk_FreeGC(framePtr->display, labelframePtr->textGC);
}
}
@@ -1120,7 +1120,7 @@ FrameWorldChanged(
gcValues.graphics_exposures = False;
gc = Tk_GetGC(tkwin, GCForeground | GCFont | GCGraphicsExposures,
&gcValues);
- if (labelframePtr->textGC != None) {
+ if (labelframePtr->textGC != NULL) {
Tk_FreeGC(framePtr->display, labelframePtr->textGC);
}
labelframePtr->textGC = gc;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 00d4511..5ea2906 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -426,12 +426,7 @@ Tk_Grab(
}
Tk_MakeWindowExist(tkwin);
-#ifndef MAC_OSX_TK
- if (!grabGlobal)
-#else
- if (0)
-#endif /* MAC_OSX_TK */
- {
+ if (!grabGlobal) {
Window dummy1, dummy2;
int dummy3, dummy4, dummy5, dummy6;
unsigned int state;
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 359d6c6..32e09c0 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -775,7 +775,7 @@ Tk_PostscriptImage(
gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin));
newGC = Tk_GetGC(tkwin, GCForeground, &gcValues);
- if (newGC != None) {
+ if (newGC != NULL) {
XFillRectangle(Tk_Display(tkwin), pmap, newGC, 0, 0,
(unsigned) width, (unsigned) height);
Tk_FreeGC(Tk_Display(tkwin), newGC);
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 0906673..f4ee407 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -427,9 +427,9 @@ ImgBmapConfigureInstance(
}
gc = Tk_GetGC(instancePtr->tkwin, mask, &gcValues);
} else {
- gc = None;
+ gc = NULL;
}
- if (instancePtr->gc != None) {
+ if (instancePtr->gc != NULL) {
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
instancePtr->gc = gc;
@@ -441,10 +441,10 @@ ImgBmapConfigureInstance(
* it clear that this instance cannot be displayed. Then report the error.
*/
- if (instancePtr->gc != None) {
+ if (instancePtr->gc != NULL) {
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
- instancePtr->gc = None;
+ instancePtr->gc = NULL;
Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf(
"\n (while configuring image \"%s\")", Tk_NameOfImage(
masterPtr->tkMaster)));
@@ -848,7 +848,7 @@ ImgBmapGet(
instancePtr->bg = NULL;
instancePtr->bitmap = None;
instancePtr->mask = None;
- instancePtr->gc = None;
+ instancePtr->gc = NULL;
instancePtr->nextPtr = masterPtr->instancePtr;
masterPtr->instancePtr = instancePtr;
ImgBmapConfigureInstance(instancePtr);
@@ -902,7 +902,7 @@ ImgBmapDisplay(
* creating the image instance so it can't be displayed.
*/
- if (instancePtr->gc == None) {
+ if (instancePtr->gc == NULL) {
return;
}
@@ -973,7 +973,7 @@ ImgBmapFree(
if (instancePtr->mask != None) {
Tk_FreePixmap(display, instancePtr->mask);
}
- if (instancePtr->gc != None) {
+ if (instancePtr->gc != NULL) {
Tk_FreeGC(display, instancePtr->gc);
}
if (instancePtr->masterPtr->instancePtr == instancePtr) {
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 3314f5e..72ebcb8 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -1590,7 +1590,7 @@ TkImgDisposeInstance(
if (instancePtr->pixels != None) {
Tk_FreePixmap(instancePtr->display, instancePtr->pixels);
}
- if (instancePtr->gc != None) {
+ if (instancePtr->gc != NULL) {
Tk_FreeGC(instancePtr->display, instancePtr->gc);
}
if (instancePtr->imagePtr != NULL) {
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 5f650fe..b323845 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -542,13 +542,13 @@ Tk_ListboxObjCmd(
listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS);
listPtr->relief = TK_RELIEF_RAISED;
- listPtr->textGC = None;
- listPtr->selFgColorPtr = None;
- listPtr->selTextGC = None;
+ listPtr->textGC = NULL;
+ listPtr->selFgColorPtr = NULL;
+ listPtr->selTextGC = NULL;
listPtr->fullLines = 1;
listPtr->xScrollUnit = 1;
listPtr->exportSelection = 1;
- listPtr->cursor = None;
+ listPtr->cursor = NULL;
listPtr->state = STATE_NORMAL;
listPtr->gray = None;
listPtr->justify = TK_JUSTIFY_LEFT;
@@ -1488,10 +1488,10 @@ DestroyListbox(
* Tk_FreeOptions handle all the standard option-related stuff.
*/
- if (listPtr->textGC != None) {
+ if (listPtr->textGC != NULL) {
Tk_FreeGC(listPtr->display, listPtr->textGC);
}
- if (listPtr->selTextGC != None) {
+ if (listPtr->selTextGC != NULL) {
Tk_FreeGC(listPtr->display, listPtr->selTextGC);
}
if (listPtr->gray != None) {
@@ -1791,7 +1791,7 @@ ListboxWorldChanged(
gcValues.font = Tk_FontId(listPtr->tkfont);
gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues);
- if (listPtr->textGC != None) {
+ if (listPtr->textGC != NULL) {
Tk_FreeGC(listPtr->display, listPtr->textGC);
}
listPtr->textGC = gc;
@@ -1802,7 +1802,7 @@ ListboxWorldChanged(
gcValues.font = Tk_FontId(listPtr->tkfont);
mask = GCForeground | GCFont;
gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues);
- if (listPtr->selTextGC != None) {
+ if (listPtr->selTextGC != NULL) {
Tk_FreeGC(listPtr->display, listPtr->selTextGC);
}
listPtr->selTextGC = gc;
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 1086eb2..a7d4ca1 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -45,7 +45,7 @@ extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
* The default prompt used when the user has not overridden it.
*/
-#define DEFAULT_PRIMARY_PROMPT "% "
+static const char DEFAULT_PRIMARY_PROMPT[] = "% ";
/*
* This file can be compiled on Windows in UNICODE mode, as well as
@@ -519,7 +519,7 @@ Prompt(
chan = Tcl_GetStdChannel(TCL_STDOUT);
if (chan != NULL) {
Tcl_WriteChars(chan, DEFAULT_PRIMARY_PROMPT,
- strlen(DEFAULT_PRIMARY_PROMPT));
+ sizeof(DEFAULT_PRIMARY_PROMPT) - 1);
}
}
} else {
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 26ffc88..a31666d 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -455,7 +455,7 @@ Tk_MenuObjCmd(
Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr,
MenuCmdDeletedProc);
menuPtr->active = -1;
- menuPtr->cursorPtr = None;
+ menuPtr->cursorPtr = NULL;
menuPtr->masterMenuPtr = menuPtr;
menuPtr->menuType = UNKNOWN_TYPE;
TkMenuInitializeDrawingFields(menuPtr);
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index bac51aa..9522db2 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -75,8 +75,8 @@ typedef struct TkMenuEntry {
* of character to underline (<0 means don't
* underline anything). */
Tcl_Obj *underlinePtr; /* Index of character to underline. */
- Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or None.
- * If not None then label is ignored. */
+ Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL.
+ * If not NULL then label is ignored. */
Tcl_Obj *imagePtr; /* Name of image to display, or NULL. If not
* NULL, bitmap, text, and textVarName are
* ignored. */
@@ -175,7 +175,7 @@ typedef struct TkMenuEntry {
* NULL means use overall disabledGC from menu
* structure. See comments for disabledFg in
* menu structure for more information. */
- GC indicatorGC; /* For drawing indicators. None means use GC
+ GC indicatorGC; /* For drawing indicators. NULL means use GC
* from menu. */
/*
@@ -340,7 +340,7 @@ typedef struct TkMenu {
Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */
- Tcl_Obj *cursorPtr; /* Current cursor for window, or None. */
+ Tcl_Obj *cursorPtr; /* Current cursor for window, or NULL. */
Tcl_Obj *postCommandPtr; /* Used to detect cycles in cascade hierarchy
* trees when preprocessing postcommands on
* some platforms. See PostMenu for more
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 3f492db..3abfc3c 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -43,12 +43,12 @@ void
TkMenuInitializeDrawingFields(
TkMenu *menuPtr) /* The menu we are initializing. */
{
- menuPtr->textGC = None;
+ menuPtr->textGC = NULL;
menuPtr->gray = None;
- menuPtr->disabledGC = None;
- menuPtr->activeGC = None;
- menuPtr->indicatorGC = None;
- menuPtr->disabledImageGC = None;
+ menuPtr->disabledGC = NULL;
+ menuPtr->activeGC = NULL;
+ menuPtr->indicatorGC = NULL;
+ menuPtr->disabledImageGC = NULL;
menuPtr->totalWidth = menuPtr->totalHeight = 0;
}
@@ -79,10 +79,10 @@ TkMenuInitializeEntryDrawingFields(
mePtr->y = 0;
mePtr->indicatorSpace = 0;
mePtr->labelWidth = 0;
- mePtr->textGC = None;
- mePtr->activeGC = None;
- mePtr->disabledGC = None;
- mePtr->indicatorGC = None;
+ mePtr->textGC = NULL;
+ mePtr->activeGC = NULL;
+ mePtr->disabledGC = NULL;
+ mePtr->indicatorGC = NULL;
}
/*
@@ -106,22 +106,22 @@ void
TkMenuFreeDrawOptions(
TkMenu *menuPtr)
{
- if (menuPtr->textGC != None) {
+ if (menuPtr->textGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->textGC);
}
- if (menuPtr->disabledImageGC != None) {
+ if (menuPtr->disabledImageGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->disabledImageGC);
}
if (menuPtr->gray != None) {
Tk_FreeBitmap(menuPtr->display, menuPtr->gray);
}
- if (menuPtr->disabledGC != None) {
+ if (menuPtr->disabledGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->disabledGC);
}
- if (menuPtr->activeGC != None) {
+ if (menuPtr->activeGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->activeGC);
}
- if (menuPtr->indicatorGC != None) {
+ if (menuPtr->indicatorGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC);
}
}
@@ -147,16 +147,16 @@ void
TkMenuEntryFreeDrawOptions(
TkMenuEntry *mePtr)
{
- if (mePtr->textGC != None) {
+ if (mePtr->textGC != NULL) {
Tk_FreeGC(mePtr->menuPtr->display, mePtr->textGC);
}
- if (mePtr->disabledGC != None) {
+ if (mePtr->disabledGC != NULL) {
Tk_FreeGC(mePtr->menuPtr->display, mePtr->disabledGC);
}
- if (mePtr->activeGC != None) {
+ if (mePtr->activeGC != NULL) {
Tk_FreeGC(mePtr->menuPtr->display, mePtr->activeGC);
}
- if (mePtr->indicatorGC != None) {
+ if (mePtr->indicatorGC != NULL) {
Tk_FreeGC(mePtr->menuPtr->display, mePtr->indicatorGC);
}
}
@@ -205,7 +205,7 @@ TkMenuConfigureDrawOptions(
gcValues.background = Tk_3DBorderColor(border)->pixel;
newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont,
&gcValues);
- if (menuPtr->textGC != None) {
+ if (menuPtr->textGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->textGC);
}
menuPtr->textGC = newGC;
@@ -233,7 +233,7 @@ TkMenuConfigureDrawOptions(
}
}
newGC = Tk_GetGC(menuPtr->tkwin, mask, &gcValues);
- if (menuPtr->disabledGC != None) {
+ if (menuPtr->disabledGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->disabledGC);
}
menuPtr->disabledGC = newGC;
@@ -249,7 +249,7 @@ TkMenuConfigureDrawOptions(
newGC = Tk_GetGC(menuPtr->tkwin,
GCForeground|GCFillStyle|GCStipple, &gcValues);
}
- if (menuPtr->disabledImageGC != None) {
+ if (menuPtr->disabledImageGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->disabledImageGC);
}
menuPtr->disabledImageGC = newGC;
@@ -262,7 +262,7 @@ TkMenuConfigureDrawOptions(
gcValues.background = Tk_3DBorderColor(activeBorder)->pixel;
newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont,
&gcValues);
- if (menuPtr->activeGC != None) {
+ if (menuPtr->activeGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->activeGC);
}
menuPtr->activeGC = newGC;
@@ -273,7 +273,7 @@ TkMenuConfigureDrawOptions(
gcValues.background = Tk_3DBorderColor(border)->pixel;
newGC = Tk_GetGC(menuPtr->tkwin, GCForeground|GCBackground|GCFont,
&gcValues);
- if (menuPtr->indicatorGC != None) {
+ if (menuPtr->indicatorGC != NULL) {
Tk_FreeGC(menuPtr->display, menuPtr->indicatorGC);
}
menuPtr->indicatorGC = newGC;
@@ -385,24 +385,24 @@ TkMenuConfigureEntryDrawOptions(
GCForeground|GCBackground|GCFont|GCGraphicsExposures,
&gcValues);
} else {
- newGC = None;
- newActiveGC = None;
- newDisabledGC = None;
- newIndicatorGC = None;
+ newGC = NULL;
+ newActiveGC = NULL;
+ newDisabledGC = NULL;
+ newIndicatorGC = NULL;
}
- if (mePtr->textGC != None) {
+ if (mePtr->textGC != NULL) {
Tk_FreeGC(menuPtr->display, mePtr->textGC);
}
mePtr->textGC = newGC;
- if (mePtr->activeGC != None) {
+ if (mePtr->activeGC != NULL) {
Tk_FreeGC(menuPtr->display, mePtr->activeGC);
}
mePtr->activeGC = newActiveGC;
- if (mePtr->disabledGC != None) {
+ if (mePtr->disabledGC != NULL) {
Tk_FreeGC(menuPtr->display, mePtr->disabledGC);
}
mePtr->disabledGC = newDisabledGC;
- if (mePtr->indicatorGC != None) {
+ if (mePtr->indicatorGC != NULL) {
Tk_FreeGC(menuPtr->display, mePtr->indicatorGC);
}
mePtr->indicatorGC = newIndicatorGC;
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 2c1676c..21da0d3 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -279,11 +279,11 @@ Tk_MenubuttonObjCmd(
mbPtr->normalFg = NULL;
mbPtr->activeFg = NULL;
mbPtr->disabledFg = NULL;
- mbPtr->normalTextGC = None;
- mbPtr->activeTextGC = None;
+ mbPtr->normalTextGC = NULL;
+ mbPtr->activeTextGC = NULL;
mbPtr->gray = None;
- mbPtr->disabledGC = None;
- mbPtr->stippleGC = None;
+ mbPtr->disabledGC = NULL;
+ mbPtr->stippleGC = NULL;
mbPtr->leftBearing = 0;
mbPtr->rightBearing = 0;
mbPtr->widthString = NULL;
@@ -300,7 +300,7 @@ Tk_MenubuttonObjCmd(
mbPtr->indicatorWidth = 0;
mbPtr->indicatorHeight = 0;
mbPtr->direction = DIRECTION_FLUSH;
- mbPtr->cursor = None;
+ mbPtr->cursor = NULL;
mbPtr->takeFocus = NULL;
mbPtr->flags = 0;
@@ -443,16 +443,16 @@ DestroyMenuButton(
if (mbPtr->image != NULL) {
Tk_FreeImage(mbPtr->image);
}
- if (mbPtr->normalTextGC != None) {
+ if (mbPtr->normalTextGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC);
}
- if (mbPtr->activeTextGC != None) {
+ if (mbPtr->activeTextGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC);
}
- if (mbPtr->disabledGC != None) {
+ if (mbPtr->disabledGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->disabledGC);
}
- if (mbPtr->stippleGC != None) {
+ if (mbPtr->stippleGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->stippleGC);
}
if (mbPtr->gray != None) {
@@ -690,7 +690,7 @@ TkMenuButtonWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues);
- if (mbPtr->normalTextGC != None) {
+ if (mbPtr->normalTextGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->normalTextGC);
}
mbPtr->normalTextGC = gc;
@@ -699,7 +699,7 @@ TkMenuButtonWorldChanged(
gcValues.background = Tk_3DBorderColor(mbPtr->activeBorder)->pixel;
mask = GCForeground | GCBackground | GCFont;
gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues);
- if (mbPtr->activeTextGC != None) {
+ if (mbPtr->activeTextGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->activeTextGC);
}
mbPtr->activeTextGC = gc;
@@ -710,7 +710,7 @@ TkMenuButtonWorldChanged(
* Create the GC that can be used for stippling
*/
- if (mbPtr->stippleGC == None) {
+ if (mbPtr->stippleGC == NULL) {
gcValues.foreground = gcValues.background;
mask = GCForeground;
if (mbPtr->gray == None) {
@@ -736,7 +736,7 @@ TkMenuButtonWorldChanged(
gcValues.foreground = gcValues.background;
}
gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues);
- if (mbPtr->disabledGC != None) {
+ if (mbPtr->disabledGC != NULL) {
Tk_FreeGC(mbPtr->display, mbPtr->disabledGC);
}
mbPtr->disabledGC = gc;
diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h
index e8dc12f..1dbacb3 100644
--- a/generic/tkMenubutton.h
+++ b/generic/tkMenubutton.h
@@ -170,7 +170,7 @@ typedef struct {
* "left" and "right" will pop the menu left
* or right, and the active item will be next
* to the button. */
- Tk_Cursor cursor; /* Current cursor for window, or None. */
+ Tk_Cursor cursor; /* Current cursor for window, or NULL. */
char *takeFocus; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index f65b046..9d02346 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -256,11 +256,11 @@ Tk_MessageObjCmd(
MessageCmdDeletedProc);
msgPtr->optionTable = optionTable;
msgPtr->relief = TK_RELIEF_FLAT;
- msgPtr->textGC = None;
+ msgPtr->textGC = NULL;
msgPtr->anchor = TK_ANCHOR_CENTER;
msgPtr->aspect = 150;
msgPtr->justify = TK_JUSTIFY_LEFT;
- msgPtr->cursor = None;
+ msgPtr->cursor = NULL;
Tk_SetClass(msgPtr->tkwin, "Message");
Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr);
@@ -398,7 +398,7 @@ DestroyMessage(
* Tk_FreeConfigOptions handle all the standard option-related stuff.
*/
- if (msgPtr->textGC != None) {
+ if (msgPtr->textGC != NULL) {
Tk_FreeGC(msgPtr->display, msgPtr->textGC);
}
if (msgPtr->textLayout != NULL) {
@@ -525,7 +525,7 @@ MessageWorldChanged(
ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
- GC gc = None;
+ GC gc = NULL;
Tk_FontMetrics fm;
Message *msgPtr = instanceData;
@@ -536,7 +536,7 @@ MessageWorldChanged(
gcValues.font = Tk_FontId(msgPtr->tkfont);
gcValues.foreground = msgPtr->fgColorPtr->pixel;
gc = Tk_GetGC(msgPtr->tkwin, GCForeground | GCFont, &gcValues);
- if (msgPtr->textGC != None) {
+ if (msgPtr->textGC != NULL) {
Tk_FreeGC(msgPtr->display, msgPtr->textGC);
}
msgPtr->textGC = gc;
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 920d93e..f20f38f 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -477,16 +477,16 @@ DoConfig(
Tk_Cursor newCursor, oldCursor;
if (nullValue) {
- newCursor = None;
+ newCursor = NULL;
} else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
newCursor = Tk_GetCursor(interp, tkwin, uid);
- if (newCursor == None) {
+ if (newCursor == NULL) {
return TCL_ERROR;
}
}
oldCursor = *((Tk_Cursor *) ptr);
- if (oldCursor != None) {
+ if (oldCursor != NULL) {
Tk_FreeCursor(Tk_Display(tkwin), oldCursor);
}
*((Tk_Cursor *) ptr) = newCursor;
@@ -837,7 +837,7 @@ FormatConfigValue(
case TK_CONFIG_ACTIVE_CURSOR: {
Tk_Cursor cursor = *((Tk_Cursor *) ptr);
- if (cursor != None) {
+ if (cursor != NULL) {
result = Tk_NameOfCursor(Tk_Display(tkwin), cursor);
}
break;
@@ -1022,9 +1022,9 @@ Tk_FreeOptions(
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR:
- if (*((Tk_Cursor *) ptr) != None) {
+ if (*((Tk_Cursor *) ptr) != NULL) {
Tk_FreeCursor(display, *((Tk_Cursor *) ptr));
- *((Tk_Cursor *) ptr) = None;
+ *((Tk_Cursor *) ptr) = NULL;
}
}
}
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 45d784a..80ddb33 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -448,9 +448,9 @@ Tk_PanedWindowObjCmd(
pwPtr->optionTable = pwOpts->pwOptions;
pwPtr->slaveOpts = pwOpts->slaveOpts;
pwPtr->relief = TK_RELIEF_RAISED;
- pwPtr->gc = None;
- pwPtr->cursor = None;
- pwPtr->sashCursor = None;
+ pwPtr->gc = NULL;
+ pwPtr->cursor = NULL;
+ pwPtr->sashCursor = NULL;
/*
* Keep a hold of the associated tkwin until we destroy the widget,
@@ -862,7 +862,7 @@ ConfigureSlaves(
index = -1;
haveLoc = 0;
- if (options.after != None) {
+ if (options.after != NULL) {
tkwin = options.after;
haveLoc = 1;
for (i = 0; i < pwPtr->numSlaves; i++) {
@@ -871,7 +871,7 @@ ConfigureSlaves(
break;
}
}
- } else if (options.before != None) {
+ } else if (options.before != NULL) {
tkwin = options.before;
haveLoc = 1;
for (i = 0; i < pwPtr->numSlaves; i++) {
@@ -1304,7 +1304,7 @@ PanedWindowWorldChanged(
gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel;
newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues);
- if (pwPtr->gc != None) {
+ if (pwPtr->gc != NULL) {
Tk_FreeGC(pwPtr->display, pwPtr->gc);
}
pwPtr->gc = newGC;
@@ -2044,10 +2044,10 @@ Unlink(
for (i = 0; i < masterPtr->numSlaves; i++) {
if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
- masterPtr->slaves[i]->before = None;
+ masterPtr->slaves[i]->before = NULL;
}
if (masterPtr->slaves[i]->after == slavePtr->tkwin) {
- masterPtr->slaves[i]->after = None;
+ masterPtr->slaves[i]->after = NULL;
}
}
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 9fa406a..2c06977 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -395,7 +395,7 @@ CreateSlave(
slavePtr = ckalloc(sizeof(Slave));
memset(slavePtr, 0, sizeof(Slave));
slavePtr->tkwin = tkwin;
- slavePtr->inTkwin = None;
+ slavePtr->inTkwin = NULL;
slavePtr->anchor = TK_ANCHOR_NW;
slavePtr->borderMode = BM_INSIDE;
slavePtr->optionTable = table;
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index 4d48fe7..daae092 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -258,7 +258,7 @@ CreateRectOval(
rectOvalPtr->fillStipple = None;
rectOvalPtr->activeFillStipple = None;
rectOvalPtr->disabledFillStipple = None;
- rectOvalPtr->fillGC = None;
+ rectOvalPtr->fillGC = NULL;
/*
* Process the arguments to fill in the item record.
@@ -466,9 +466,9 @@ ConfigureRectOval(
mask |= GCCapStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
- newGC = None;
+ newGC = NULL;
}
- if (rectOvalPtr->outline.gc != None) {
+ if (rectOvalPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->outline.gc);
}
rectOvalPtr->outline.gc = newGC;
@@ -500,7 +500,7 @@ ConfigureRectOval(
}
if (color == NULL) {
- newGC = None;
+ newGC = NULL;
} else {
gcValues.foreground = color->pixel;
if (stipple != None) {
@@ -522,7 +522,7 @@ ConfigureRectOval(
#endif
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
- if (rectOvalPtr->fillGC != None) {
+ if (rectOvalPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->fillGC);
}
rectOvalPtr->fillGC = newGC;
@@ -595,7 +595,7 @@ DeleteRectOval(
if (rectOvalPtr->disabledFillStipple != None) {
Tk_FreeBitmap(display, rectOvalPtr->disabledFillStipple);
}
- if (rectOvalPtr->fillGC != None) {
+ if (rectOvalPtr->fillGC != NULL) {
Tk_FreeGC(display, rectOvalPtr->fillGC);
}
}
@@ -664,7 +664,7 @@ ComputeRectOvalBbox(
rectOvalPtr->bbox[0] = tmpX;
}
- if (rectOvalPtr->outline.gc == None) {
+ if (rectOvalPtr->outline.gc == NULL) {
/*
* The Win32 switch was added for 8.3 to solve a problem with ovals
* leaving traces on bottom and right of 1 pixel. This may not be the
@@ -878,7 +878,7 @@ DisplayRectOval(
}
}
- if (rectOvalPtr->fillGC != None) {
+ if (rectOvalPtr->fillGC != NULL) {
if (fillStipple != None) {
Tk_TSOffset *tsoffset;
int w = 0, h = 0;
@@ -922,7 +922,7 @@ DisplayRectOval(
}
}
- if (rectOvalPtr->outline.gc != None) {
+ if (rectOvalPtr->outline.gc != NULL) {
Tk_ChangeOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline));
if (rectOvalPtr->header.typePtr == &tkRectangleType) {
XDrawRectangle(display, drawable, rectOvalPtr->outline.gc,
@@ -993,7 +993,7 @@ RectToPoint(
y1 = rectPtr->bbox[1];
x2 = rectPtr->bbox[2];
y2 = rectPtr->bbox[3];
- if (rectPtr->outline.gc != None) {
+ if (rectPtr->outline.gc != NULL) {
inc = width/2.0;
x1 -= inc;
y1 -= inc;
@@ -1009,7 +1009,7 @@ RectToPoint(
if ((pointPtr[0] >= x1) && (pointPtr[0] < x2)
&& (pointPtr[1] >= y1) && (pointPtr[1] < y2)) {
- if ((rectPtr->fillGC != None) || (rectPtr->outline.gc == None)) {
+ if ((rectPtr->fillGC != NULL) || (rectPtr->outline.gc == NULL)) {
return 0.0;
}
xDiff = pointPtr[0] - x1;
@@ -1105,8 +1105,8 @@ OvalToPoint(
}
- filled = ovalPtr->fillGC != None;
- if (ovalPtr->outline.gc == None) {
+ filled = ovalPtr->fillGC != NULL;
+ if (ovalPtr->outline.gc == NULL) {
width = 0.0;
filled = 1;
}
@@ -1161,7 +1161,7 @@ RectToArea(
}
halfWidth = width/2.0;
- if (rectPtr->outline.gc == None) {
+ if (rectPtr->outline.gc == NULL) {
halfWidth = 0.0;
}
@@ -1171,7 +1171,7 @@ RectToArea(
|| (areaPtr[1] >= (rectPtr->bbox[3] + halfWidth))) {
return -1;
}
- if ((rectPtr->fillGC == None) && (rectPtr->outline.gc != None)
+ if ((rectPtr->fillGC == NULL) && (rectPtr->outline.gc != NULL)
&& (areaPtr[0] >= (rectPtr->bbox[0] + halfWidth))
&& (areaPtr[1] >= (rectPtr->bbox[1] + halfWidth))
&& (areaPtr[2] <= (rectPtr->bbox[2] - halfWidth))
@@ -1239,7 +1239,7 @@ OvalToArea(
*/
halfWidth = width/2.0;
- if (ovalPtr->outline.gc == None) {
+ if (ovalPtr->outline.gc == NULL) {
halfWidth = 0.0;
}
oval[0] = ovalPtr->bbox[0] - halfWidth;
@@ -1256,8 +1256,8 @@ OvalToArea(
* return "outside".
*/
- if ((result == 0) && (ovalPtr->outline.gc != None)
- && (ovalPtr->fillGC == None)) {
+ if ((result == 0) && (ovalPtr->outline.gc != NULL)
+ && (ovalPtr->fillGC == NULL)) {
double centerX, centerY, height;
double xDelta1, yDelta1, xDelta2, yDelta2;
diff --git a/generic/tkScale.c b/generic/tkScale.c
index af45afa..6f61046 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -270,11 +270,11 @@ Tk_ScaleObjCmd(
scalePtr->activeBorder = NULL;
scalePtr->sliderRelief = TK_RELIEF_RAISED;
scalePtr->troughColorPtr = NULL;
- scalePtr->troughGC = None;
- scalePtr->copyGC = None;
+ scalePtr->troughGC = NULL;
+ scalePtr->copyGC = NULL;
scalePtr->tkfont = NULL;
scalePtr->textColorPtr = NULL;
- scalePtr->textGC = None;
+ scalePtr->textGC = NULL;
scalePtr->relief = TK_RELIEF_FLAT;
scalePtr->highlightWidth = 0;
scalePtr->highlightBorder = NULL;
@@ -291,7 +291,7 @@ Tk_ScaleObjCmd(
scalePtr->vertTroughX = 0;
scalePtr->vertLabelX = 0;
scalePtr->fontHeight = 0;
- scalePtr->cursor = None;
+ scalePtr->cursor = NULL;
scalePtr->takeFocusPtr = NULL;
scalePtr->flags = NEVER_SET;
@@ -518,13 +518,13 @@ DestroyScale(
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ScaleVarProc, scalePtr);
}
- if (scalePtr->troughGC != None) {
+ if (scalePtr->troughGC != NULL) {
Tk_FreeGC(scalePtr->display, scalePtr->troughGC);
}
- if (scalePtr->copyGC != None) {
+ if (scalePtr->copyGC != NULL) {
Tk_FreeGC(scalePtr->display, scalePtr->copyGC);
}
- if (scalePtr->textGC != None) {
+ if (scalePtr->textGC != NULL) {
Tk_FreeGC(scalePtr->display, scalePtr->textGC);
}
Tk_FreeConfigOptions((char *) scalePtr, scalePtr->optionTable,
@@ -729,7 +729,7 @@ ScaleWorldChanged(
gcValues.foreground = scalePtr->troughColorPtr->pixel;
gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues);
- if (scalePtr->troughGC != None) {
+ if (scalePtr->troughGC != NULL) {
Tk_FreeGC(scalePtr->display, scalePtr->troughGC);
}
scalePtr->troughGC = gc;
@@ -737,12 +737,12 @@ ScaleWorldChanged(
gcValues.font = Tk_FontId(scalePtr->tkfont);
gcValues.foreground = scalePtr->textColorPtr->pixel;
gc = Tk_GetGC(scalePtr->tkwin, GCForeground | GCFont, &gcValues);
- if (scalePtr->textGC != None) {
+ if (scalePtr->textGC != NULL) {
Tk_FreeGC(scalePtr->display, scalePtr->textGC);
}
scalePtr->textGC = gc;
- if (scalePtr->copyGC == None) {
+ if (scalePtr->copyGC == NULL) {
gcValues.graphics_exposures = False;
scalePtr->copyGC = Tk_GetGC(scalePtr->tkwin, GCGraphicsExposures,
&gcValues);
diff --git a/generic/tkScale.h b/generic/tkScale.h
index aa0feff..4f28738 100644
--- a/generic/tkScale.h
+++ b/generic/tkScale.h
@@ -151,7 +151,7 @@ typedef struct TkScale {
*/
int fontHeight; /* Height of scale font. */
- Tk_Cursor cursor; /* Current cursor for window, or None. */
+ Tk_Cursor cursor; /* Current cursor for window, or NULL. */
Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. May be NULL. */
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 5017d30..9a85532 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -185,7 +185,7 @@ Tk_ScrollbarObjCmd(
scrollPtr->lastUnit = 0;
scrollPtr->firstFraction = 0.0;
scrollPtr->lastFraction = 0.0;
- scrollPtr->cursor = None;
+ scrollPtr->cursor = NULL;
scrollPtr->takeFocus = NULL;
scrollPtr->flags = 0;
diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h
index b0cd085..2d521ae 100644
--- a/generic/tkScrollbar.h
+++ b/generic/tkScrollbar.h
@@ -119,7 +119,7 @@ typedef struct TkScrollbar {
* Miscellaneous information:
*/
- Tk_Cursor cursor; /* Current cursor for window, or None. */
+ Tk_Cursor cursor; /* Current cursor for window, or NULL. */
char *takeFocus; /* Value of -takefocus option; not used in the
* C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 36d2d6e..40d5e8f 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -169,7 +169,7 @@ SquareObjCmd(
squarePtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr,
SquareDeletedProc);
- squarePtr->gc = None;
+ squarePtr->gc = NULL;
squarePtr->optionTable = optionTable;
if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin)
@@ -335,7 +335,7 @@ SquareConfigure(
Tk_SetWindowBackground(squarePtr->tkwin,
Tk_3DBorderColor(bgBorder)->pixel);
Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer);
- if ((squarePtr->gc == None) && (doubleBuffer)) {
+ if ((squarePtr->gc == NULL) && (doubleBuffer)) {
XGCValues gcValues;
gcValues.function = GXcopy;
gcValues.graphics_exposures = False;
@@ -400,7 +400,7 @@ SquareObjEventProc(
if (squarePtr->tkwin != NULL) {
Tk_FreeConfigOptions((char *) squarePtr, squarePtr->optionTable,
squarePtr->tkwin);
- if (squarePtr->gc != None) {
+ if (squarePtr->gc != NULL) {
Tk_FreeGC(squarePtr->display, squarePtr->gc);
}
squarePtr->tkwin = NULL;
diff --git a/generic/tkText.c b/generic/tkText.c
index 4c536a2..ab06089 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -406,7 +406,6 @@ static Tcl_Obj * TextGetText(const TkText *textPtr,
static void GenerateModifiedEvent(TkText *textPtr);
static void GenerateUndoStackEvent(TkText *textPtr);
static void UpdateDirtyFlag(TkSharedText *sharedPtr);
-static void RunAfterSyncCmd(ClientData clientData);
static void TextPushUndoAction(TkText *textPtr,
Tcl_Obj *undoString, int insert,
const TkTextIndex *index1Ptr,
@@ -587,7 +586,7 @@ CreateWidget(
textPtr->state = TK_TEXT_STATE_NORMAL;
textPtr->relief = TK_RELIEF_FLAT;
- textPtr->cursor = None;
+ textPtr->cursor = NULL;
textPtr->charWidth = 1;
textPtr->charHeight = 10;
textPtr->wrapMode = TEXT_WRAPMODE_CHAR;
@@ -1547,7 +1546,7 @@ TextWidgetObjCmd(
textPtr->afterSyncCmd = cmd;
} else {
textPtr->afterSyncCmd = cmd;
- Tcl_DoWhenIdle(RunAfterSyncCmd, (ClientData) textPtr);
+ Tcl_DoWhenIdle(TkTextRunAfterSyncCmd, (ClientData) textPtr);
}
break;
} else if (objc != 2) {
@@ -1559,7 +1558,7 @@ TextWidgetObjCmd(
Tcl_DecrRefCount(textPtr->afterSyncCmd);
}
textPtr->afterSyncCmd = NULL;
- TkTextUpdateLineMetrics(textPtr, 1,
+ TkTextUpdateLineMetrics(textPtr, 0,
TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr), -1);
break;
}
@@ -2278,7 +2277,7 @@ ConfigureText(
textPtr->selTagPtr->affectsDisplay = 0;
textPtr->selTagPtr->affectsDisplayGeometry = 0;
if ((textPtr->selTagPtr->elideString != NULL)
- || (textPtr->selTagPtr->tkfont != None)
+ || (textPtr->selTagPtr->tkfont != NULL)
|| (textPtr->selTagPtr->justifyString != NULL)
|| (textPtr->selTagPtr->lMargin1String != NULL)
|| (textPtr->selTagPtr->lMargin2String != NULL)
@@ -5506,7 +5505,7 @@ UpdateDirtyFlag(
/*
*----------------------------------------------------------------------
*
- * RunAfterSyncCmd --
+ * TkTextRunAfterSyncCmd --
*
* This function is called by the event loop and executes the command
* scheduled by [.text sync -command $cmd].
@@ -5520,8 +5519,8 @@ UpdateDirtyFlag(
*----------------------------------------------------------------------
*/
-static void
-RunAfterSyncCmd(
+void
+TkTextRunAfterSyncCmd(
ClientData clientData) /* Information about text widget. */
{
register TkText *textPtr = (TkText *) clientData;
diff --git a/generic/tkText.h b/generic/tkText.h
index 5d88784..a8a17da 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -667,7 +667,7 @@ typedef struct TkText {
/* Color for drawing traversal highlight area
* when highlight is off. */
XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
- Tk_Cursor cursor; /* Current cursor for window, or None. */
+ Tk_Cursor cursor; /* Current cursor for window, or NULL. */
XColor *fgColor; /* Default foreground color for text. */
Tk_Font tkfont; /* Default font for displaying text. */
int charWidth; /* Width of average character in default
@@ -1070,7 +1070,7 @@ MODULE_SCOPE int TkTextGetObjIndex(Tcl_Interp *interp, TkText *textPtr,
MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp,
TkSharedText *sharedTextPtr, Tcl_Obj *idxPtr,
TkTextIndex *indexPtr);
-MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp,
+MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp,
TkText *textPtr, Tcl_Obj *objPtr);
MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp,
TkText *textPtr, Tcl_Obj *stringPtr);
@@ -1159,7 +1159,7 @@ MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr,
TkTextEmbWindowClient *client);
-
+MODULE_SCOPE void TkTextRunAfterSyncCmd(ClientData clientData);
#endif /* _TKTEXT */
/*
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 8d60754..fcefb9a 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -497,13 +497,15 @@ static TkTextDispChunk *baseCharChunkPtr = NULL;
* different character might be under the mouse
* cursor now). Need to recompute the current
* character before the next redisplay.
+ * OUT_OF_SYNC 1 means that the last <<WidgetViewSync>> event had
+ * value 0, indicating that the widget is out of sync.
*/
#define DINFO_OUT_OF_DATE 1
#define REDRAW_PENDING 2
#define REDRAW_BORDERS 4
#define REPICK_NEEDED 8
-
+#define OUT_OF_SYNC 16
/*
* Action values for FreeDLines:
*
@@ -664,7 +666,7 @@ TkTextCreateDInfo(
dInfoPtr = ckalloc(sizeof(TextDInfo));
Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int));
dInfoPtr->dLinePtr = NULL;
- dInfoPtr->copyGC = None;
+ dInfoPtr->copyGC = NULL;
gcValues.graphics_exposures = True;
dInfoPtr->scrollGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures,
&gcValues);
@@ -681,7 +683,7 @@ TkTextCreateDInfo(
dInfoPtr->scanTotalYScroll = 0;
dInfoPtr->scanMarkY = 0;
dInfoPtr->dLinesInvalidated = 0;
- dInfoPtr->flags = DINFO_OUT_OF_DATE;
+ dInfoPtr->flags = 0;
dInfoPtr->topPixelOffset = 0;
dInfoPtr->newTopPixelOffset = 0;
dInfoPtr->currentMetricUpdateLine = -1;
@@ -728,7 +730,7 @@ TkTextFreeDInfo(
FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK);
Tcl_DeleteHashTable(&dInfoPtr->styleTable);
- if (dInfoPtr->copyGC != None) {
+ if (dInfoPtr->copyGC != NULL) {
Tk_FreeGC(textPtr->display, dInfoPtr->copyGC);
}
Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC);
@@ -860,7 +862,7 @@ GetStyle(
border = tagPtr->selBorder;
}
- if ((tagPtr->selFgColor != None) && (isSelected)) {
+ if ((tagPtr->selFgColor != NULL) && isSelected) {
fgColor = tagPtr->selFgColor;
}
@@ -887,11 +889,11 @@ GetStyle(
styleValues.bgStipple = tagPtr->bgStipple;
bgStipplePrio = tagPtr->priority;
}
- if ((fgColor != None) && (tagPtr->priority > fgPrio)) {
+ if ((fgColor != NULL) && (tagPtr->priority > fgPrio)) {
styleValues.fgColor = fgColor;
fgPrio = tagPtr->priority;
}
- if ((tagPtr->tkfont != None) && (tagPtr->priority > fontPrio)) {
+ if ((tagPtr->tkfont != NULL) && (tagPtr->priority > fontPrio)) {
styleValues.tkfont = tagPtr->tkfont;
fontPrio = tagPtr->priority;
}
@@ -929,9 +931,9 @@ GetStyle(
&& (tagPtr->priority > overstrikePrio)) {
styleValues.overstrike = tagPtr->overstrike;
overstrikePrio = tagPtr->priority;
- if (tagPtr->overstrikeColor != None) {
+ if (tagPtr->overstrikeColor != NULL) {
styleValues.overstrikeColor = tagPtr->overstrikeColor;
- } else if (fgColor != None) {
+ } else if (fgColor != NULL) {
styleValues.overstrikeColor = fgColor;
}
}
@@ -974,9 +976,9 @@ GetStyle(
&& (tagPtr->priority > underlinePrio)) {
styleValues.underline = tagPtr->underline;
underlinePrio = tagPtr->priority;
- if (tagPtr->underlineColor != None) {
+ if (tagPtr->underlineColor != NULL) {
styleValues.underlineColor = tagPtr->underlineColor;
- } else if (fgColor != None) {
+ } else if (fgColor != NULL) {
styleValues.underlineColor = fgColor;
}
}
@@ -1023,7 +1025,7 @@ GetStyle(
}
stylePtr->bgGC = Tk_GetGC(textPtr->tkwin, mask, &gcValues);
} else {
- stylePtr->bgGC = None;
+ stylePtr->bgGC = NULL;
}
mask = GCFont;
gcValues.font = Tk_FontId(styleValues.tkfont);
@@ -1074,16 +1076,16 @@ FreeStyle(
{
stylePtr->refCount--;
if (stylePtr->refCount == 0) {
- if (stylePtr->bgGC != None) {
+ if (stylePtr->bgGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->bgGC);
}
- if (stylePtr->fgGC != None) {
+ if (stylePtr->fgGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->fgGC);
}
- if (stylePtr->ulGC != None) {
+ if (stylePtr->ulGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->ulGC);
}
- if (stylePtr->ovGC != None) {
+ if (stylePtr->ovGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->ovGC);
}
Tcl_DeleteHashEntry(stylePtr->hPtr);
@@ -2688,7 +2690,7 @@ DisplayLineBackground(
if ((chunkPtr->nextPtr == NULL) && (rightX < maxX)) {
rightX = maxX;
}
- if (chunkPtr->stylePtr->bgGC != None) {
+ if (chunkPtr->stylePtr->bgGC != NULL) {
/*
* Not visible - bail out now.
*/
@@ -3070,10 +3072,13 @@ AsyncUpdateLineMetrics(
* We have looped over all lines, so we're done. We must release our
* refCount on the widget (the timer token was already set to NULL
* above). If there is a registered aftersync command, run that first.
+ * Cancel any pending idle task which would try to run the command
+ * after the afterSyncCmd pointer had been set to NULL.
*/
if (textPtr->afterSyncCmd) {
int code;
+ Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr);
Tcl_Preserve((ClientData) textPtr->interp);
code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd,
TCL_EVAL_GLOBAL);
@@ -3091,7 +3096,6 @@ AsyncUpdateLineMetrics(
* with its internal data (actually it will be after the next trip
* through the event loop, because the widget redraws at idle-time).
*/
-
GenerateWidgetViewSyncEvent(textPtr, 1);
if (textPtr->refCount-- <= 1) {
@@ -3115,8 +3119,14 @@ AsyncUpdateLineMetrics(
* GenerateWidgetViewSyncEvent --
*
* Send the <<WidgetViewSync>> event related to the text widget
- * line metrics asynchronous update.
- * This is equivalent to:
+ * line metrics asynchronous update. These events should only
+ * be sent when the sync status has changed. So this function
+ * compares the requested state with the state saved in the
+ * TkText structure, and only generates the event if they are
+ * different. This means that it is safe to call this function
+ * at any time when the state is known.
+ *
+ * If an event is sent, the effect is equivalent to:
* event generate $textWidget <<WidgetViewSync>> -data $s
* where $s is the sync status: true (when the widget view is in
* sync with its internal data) or false (when it is not).
@@ -3132,9 +3142,12 @@ AsyncUpdateLineMetrics(
static void
GenerateWidgetViewSyncEvent(
- TkText *textPtr, /* Information about text widget. */
- Bool InSync) /* true if in sync, false otherwise */
+ TkText *textPtr, /* Information about text widget. */
+ Bool InSync) /* true if becoming in sync, false otherwise */
{
+ Bool NewSyncState = (InSync != 0); /* ensure 0 or 1 value */
+ Bool OldSyncState = !(textPtr->dInfoPtr->flags & OUT_OF_SYNC);
+
/*
* OSX 10.14 needs to be told to display the window when the Text Widget
* is in sync. (That is, to run DisplayText inside of the drawRect
@@ -3147,8 +3160,15 @@ GenerateWidgetViewSyncEvent(
FORCE_DISPLAY(textPtr->tkwin);
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
- Tcl_NewBooleanObj(InSync));
+ if (NewSyncState != OldSyncState) {
+ if (NewSyncState) {
+ textPtr->dInfoPtr->flags &= ~OUT_OF_SYNC;
+ } else {
+ textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
+ }
+ TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tcl_NewBooleanObj(NewSyncState));
+ }
}
/*
@@ -3191,6 +3211,9 @@ TkTextUpdateLineMetrics(
TkTextLine *linePtr = NULL;
int count = 0;
int totalLines = TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
+ int fullUpdateRequested = (lineNum == 0 &&
+ endLine == totalLines &&
+ doThisMuch == -1);
if (totalLines == 0) {
/*
@@ -3201,6 +3224,7 @@ TkTextUpdateLineMetrics(
}
while (1) {
+
/*
* Get a suitable line.
*/
@@ -3227,6 +3251,7 @@ TkTextUpdateLineMetrics(
*/
if (textPtr->dInfoPtr->metricEpoch == -1 && lineNum == endLine) {
+
/*
* We have looped over all lines, so we're done.
*/
@@ -3250,10 +3275,12 @@ TkTextUpdateLineMetrics(
if (TkBTreeLinePixelEpoch(textPtr, linePtr)
== textPtr->dInfoPtr->lineMetricUpdateEpoch) {
+
/*
* This line is already up to date. That means there's nothing
* to do here.
*/
+
} else if (doThisMuch == -1) {
count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,NULL,0);
} else {
@@ -3275,6 +3302,7 @@ TkTextUpdateLineMetrics(
indexPtr = &textPtr->dInfoPtr->metricIndex;
pixelHeight = textPtr->dInfoPtr->metricPixelHeight;
} else {
+
/*
* We must reset the partial line height calculation data
* here, so we don't use it when it is out of date.
@@ -3298,6 +3326,7 @@ TkTextUpdateLineMetrics(
pixelHeight, indexPtr, 1);
if (indexPtr->linePtr == linePtr) {
+
/*
* We didn't complete the logical line, because it
* produced very many display lines, which must be because
@@ -3306,6 +3335,7 @@ TkTextUpdateLineMetrics(
*/
if (pixelHeight == 0) {
+
/*
* These have already been stored, unless we just
* started the new line.
@@ -3327,6 +3357,7 @@ TkTextUpdateLineMetrics(
textPtr->dInfoPtr->metricEpoch = -1;
}
} else {
+
/*
* We must never recalculate the height of the last artificial
* line. It must stay at zero, and if we recalculate it, it will
@@ -3351,13 +3382,17 @@ TkTextUpdateLineMetrics(
}
}
if (doThisMuch == -1) {
+
/*
- * If we were requested to provide a full update, then also update the
- * scrollbar.
+ * If we were requested to update the entire range, then also update
+ * the scrollbar.
*/
GetYView(textPtr->interp, textPtr, 1);
}
+ if (fullUpdateRequested) {
+ GenerateWidgetViewSyncEvent(textPtr, 1);
+ }
return lineNum;
}
@@ -3526,8 +3561,12 @@ TextInvalidateLineMetrics(
textPtr->refCount++;
dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
AsyncUpdateLineMetrics, textPtr);
- GenerateWidgetViewSyncEvent(textPtr, 0);
}
+
+ /*
+ * The widget is out of sync: send a <<WidgetViewSync>> event.
+ */
+ GenerateWidgetViewSyncEvent(textPtr, 0);
}
/*
@@ -4544,7 +4583,7 @@ DisplayText(
dlPtr->spaceAbove,
dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, NULL,
- (Drawable) None, dlPtr->y + dlPtr->spaceAbove);
+ None, dlPtr->y + dlPtr->spaceAbove);
}
}
}
@@ -5180,7 +5219,7 @@ TkTextRelayoutWindow(
gcValues.graphics_exposures = False;
newGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues);
- if (dInfoPtr->copyGC != None) {
+ if (dInfoPtr->copyGC != NULL) {
Tk_FreeGC(textPtr->display, dInfoPtr->copyGC);
}
dInfoPtr->copyGC = newGC;
@@ -5269,9 +5308,7 @@ TkTextRelayoutWindow(
inSync = 0;
}
- if (!inSync) {
- GenerateWidgetViewSyncEvent(textPtr, 0);
- }
+ GenerateWidgetViewSyncEvent(textPtr, inSync);
}
}
@@ -6296,11 +6333,7 @@ TkTextPendingsync(
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- return (
- (!(dInfoPtr->flags & REDRAW_PENDING) &&
- (dInfoPtr->metricEpoch == -1) &&
- (dInfoPtr->lastMetricUpdateLine == dInfoPtr->currentMetricUpdateLine)) ?
- 0 : 1);
+ return ((dInfoPtr->flags & OUT_OF_SYNC) != 0);
}
/*
@@ -7994,7 +8027,7 @@ CharDisplayProc(
*/
if (!sValuePtr->elide && (numBytes > offsetBytes)
- && (stylePtr->fgGC != None)) {
+ && (stylePtr->fgGC != NULL)) {
#if TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 9ade3ad..13216ca 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -516,7 +516,7 @@ TkTextTagCmd(
tagPtr->affectsDisplay = 0;
tagPtr->affectsDisplayGeometry = 0;
if ((tagPtr->elideString != NULL)
- || (tagPtr->tkfont != None)
+ || (tagPtr->tkfont != NULL)
|| (tagPtr->justifyString != NULL)
|| (tagPtr->lMargin1String != NULL)
|| (tagPtr->lMargin2String != NULL)
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index d175ef9..868a8fa 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -2088,7 +2088,7 @@ void
Tk_UndefineCursor(
Tk_Window tkwin) /* Window to manipulate. */
{
- Tk_DefineCursor(tkwin, None);
+ Tk_DefineCursor(tkwin, NULL);
}
void
diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c
index 2fbcd76..e0886f2 100644
--- a/generic/ttk/ttkClassicTheme.c
+++ b/generic/ttk/ttkClassicTheme.c
@@ -5,9 +5,7 @@
*
*/
-#include <tk.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
+#include "tkInt.h"
#include "ttkTheme.h"
#define DEFAULT_BORDERWIDTH "2"
diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c
index 9d1963f..89bf028 100644
--- a/generic/ttk/ttkDefaultTheme.c
+++ b/generic/ttk/ttkDefaultTheme.c
@@ -4,12 +4,7 @@
* Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme
*/
-#include <math.h>
-#include <string.h>
-
-#include <tkInt.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
+#include "tkInt.h"
#include "ttkTheme.h"
#if defined(_WIN32)
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index f6a9c27..ebc485e 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -8,11 +8,7 @@
* Copyright (c) 2004 Joe English
*/
-#include <string.h>
-#include <stdio.h>
-#include <tkInt.h>
-#include <X11/Xatom.h>
-
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -333,7 +329,7 @@ EntryFetchSelection(
ClientData clientData, int offset, char *buffer, int maxBytes)
{
Entry *entryPtr = (Entry *) clientData;
- size_t byteCount;
+ int byteCount;
const char *string;
const char *selStart, *selEnd;
@@ -347,7 +343,7 @@ EntryFetchSelection(
selEnd = Tcl_UtfAtIndex(selStart,
entryPtr->entry.selectLast - entryPtr->entry.selectFirst);
byteCount = selEnd - selStart - offset;
- if (byteCount > (size_t)maxBytes) {
+ if (byteCount > maxBytes) {
/* @@@POSSIBLE BUG: Can transfer partial UTF-8 sequences. Is this OK? */
byteCount = maxBytes;
}
@@ -1155,7 +1151,7 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip)
mask |= GCForeground;
}
gc = Tk_GetGC(entryPtr->core.tkwin, mask, &gcValues);
- if (clip != None) {
+ if (clip != NULL) {
TkSetRegion(Tk_Display(entryPtr->core.tkwin), gc, clip);
}
return gc;
@@ -1265,7 +1261,7 @@ static void EntryDisplay(void *clientData, Drawable d)
cursorX = field.x + field.width - cursorWidth;
}
- gc = EntryGetGC(entryPtr, es.insertColorObj, None);
+ gc = EntryGetGC(entryPtr, es.insertColorObj, NULL);
XFillRectangle(Tk_Display(tkwin), d, gc,
cursorX, cursorY, cursorWidth, cursorHeight);
Tk_FreeGC(Tk_Display(tkwin), gc);
@@ -1297,7 +1293,7 @@ static void EntryDisplay(void *clientData, Drawable d)
* it from the Xft guts (if they're being used).
*/
#ifdef HAVE_XFT
- TkUnixSetXftClipRegion(None);
+ TkUnixSetXftClipRegion(NULL);
#endif
TkDestroyRegion(clipRegion);
}
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index 1037840..3cebc14 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -6,8 +6,7 @@
*
*/
-#include <tcl.h>
-#include <tkInt.h>
+#include "tkInt.h"
#include "ttkTheme.h"
/*----------------------------------------------------------------------
@@ -183,7 +182,7 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
if (clipRegion != NULL) {
#ifdef HAVE_XFT
- TkUnixSetXftClipRegion(None);
+ TkUnixSetXftClipRegion(NULL);
#endif
XSetClipMask(Tk_Display(tkwin), gc1, None);
XSetClipMask(Tk_Display(tkwin), gc2, None);
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 2fd90b6..2512c4b 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -7,7 +7,7 @@
*/
#include <string.h>
-#include <tk.h>
+#include "tkInt.h"
#include "ttkThemeInt.h"
#define MAX(a,b) (a > b ? a : b)
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index 2bd3ddb..184f5f2 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -34,7 +34,7 @@
* TtkScrollbarUpdateRequired, which will invoke step (5) (@@@ Fix this)
*/
-#include <tkInt.h>
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c
index 2941ca8..5b62f3c 100644
--- a/generic/ttk/ttkState.c
+++ b/generic/ttk/ttkState.c
@@ -131,7 +131,7 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr)
unsigned int mask = onbits | offbits;
Tcl_DString result;
int i;
- size_t len;
+ int len;
Tcl_DStringInit(&result);
@@ -147,14 +147,14 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr)
len = Tcl_DStringLength(&result);
if (len) {
/* 'len' includes extra trailing ' ' */
- objPtr->bytes = Tcl_Alloc(len);
+ objPtr->bytes = ckalloc(len);
objPtr->length = len-1;
strncpy(objPtr->bytes, Tcl_DStringValue(&result), len-1);
objPtr->bytes[len-1] = '\0';
} else {
/* empty string */
objPtr->length = 0;
- objPtr->bytes = Tcl_Alloc(1);
+ objPtr->bytes = ckalloc(1);
*objPtr->bytes = '\0';
}
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index c0bd784..cc75238 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -10,10 +10,7 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <stdlib.h>
-#include <string.h>
-#include <tk.h>
-#include <tkInt.h>
+#include "tkInt.h"
#include "ttkThemeInt.h"
#define PKG_ASSOC_KEY "Ttk"
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index bef84f3..b6616e1 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -6,7 +6,7 @@
#include <string.h>
#include <stdio.h>
-#include <tk.h>
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index c50efc5..d7f4b25 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -5,7 +5,7 @@
*/
#include <string.h>
-#include <tk.h>
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"