summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/winfo.n3
-rw-r--r--generic/tk3d.c18
-rw-r--r--generic/tk3d.h4
-rw-r--r--generic/tkBind.c4
-rw-r--r--generic/tkBusy.c17
-rw-r--r--generic/tkButton.c20
-rw-r--r--generic/tkButton.h2
-rw-r--r--generic/tkCanvArc.c36
-rw-r--r--generic/tkCanvBmap.c4
-rw-r--r--generic/tkCanvImg.c2
-rw-r--r--generic/tkCanvLine.c26
-rw-r--r--generic/tkCanvPoly.c92
-rw-r--r--generic/tkCanvText.c76
-rw-r--r--generic/tkCanvUtil.c4
-rw-r--r--generic/tkCanvas.c6
-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.c10
-rw-r--r--generic/tkEntry.c10
-rw-r--r--generic/tkEntry.h6
-rw-r--r--generic/tkEvent.c4
-rw-r--r--generic/tkFrame.c4
-rw-r--r--generic/tkImage.c2
-rw-r--r--generic/tkImgBmap.c16
-rw-r--r--generic/tkImgPhInstance.c16
-rw-r--r--generic/tkListbox.c8
-rw-r--r--generic/tkMain.c4
-rw-r--r--generic/tkMenu.h8
-rw-r--r--generic/tkMenuDraw.c36
-rw-r--r--generic/tkMenubutton.c16
-rw-r--r--generic/tkMenubutton.h2
-rw-r--r--generic/tkMessage.c4
-rw-r--r--generic/tkOldConfig.c10
-rw-r--r--generic/tkPanedWindow.c6
-rw-r--r--generic/tkPlace.c2
-rw-r--r--generic/tkRectOval.c36
-rw-r--r--generic/tkScale.c12
-rw-r--r--generic/tkScale.h4
-rw-r--r--generic/tkScrollbar.h2
-rw-r--r--generic/tkText.c6
-rw-r--r--generic/tkText.h2
-rw-r--r--generic/tkTextDisp.c32
-rw-r--r--generic/tkTextTag.c6
-rw-r--r--generic/tkWindow.c6
-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
-rw-r--r--macosx/tkMacOSXDialog.c2
-rw-r--r--macosx/tkMacOSXSubwindows.c6
-rw-r--r--macosx/tkMacOSXWm.c50
-rw-r--r--tests/unixWm.test175
-rw-r--r--tests/wm.test2
-rw-r--r--unix/tkUnix3d.c12
-rw-r--r--unix/tkUnixMenubu.c12
-rw-r--r--unix/tkUnixRFont.c4
-rw-r--r--unix/tkUnixScrlbr.c12
-rw-r--r--unix/tkUnixWm.c67
-rw-r--r--win/stubs.c2
-rw-r--r--win/tkWin3d.c12
-rw-r--r--win/tkWinButton.c15
-rw-r--r--win/tkWinDialog.c4
-rw-r--r--win/tkWinDraw.c14
-rw-r--r--win/tkWinEmbed.c2
-rw-r--r--win/tkWinFont.c20
-rw-r--r--win/tkWinImage.c2
-rw-r--r--win/tkWinMenu.c4
-rw-r--r--win/tkWinPixmap.c2
-rw-r--r--win/tkWinPointer.c6
-rw-r--r--win/tkWinPort.h8
-rw-r--r--win/tkWinScrlbr.c2
-rw-r--r--win/tkWinWindow.c6
-rw-r--r--win/tkWinWm.c42
-rw-r--r--win/tkWinX.c18
-rw-r--r--win/ttkWinXPTheme.c2
-rw-r--r--xlib/X11/X.h12
-rw-r--r--xlib/xgc.c24
-rw-r--r--xlib/ximage.c2
-rw-r--r--xlib/xutil.c7
87 files changed, 655 insertions, 554 deletions
diff --git a/doc/winfo.n b/doc/winfo.n
index 5008448..a833e31 100644
--- a/doc/winfo.n
+++ b/doc/winfo.n
@@ -73,6 +73,9 @@ to the screen containing \fIwindow\fR; otherwise they refer to the
screen of the application's main window.
If no window in this application contains the point then an empty
string is returned.
+An empty string is also returned if the point lies in the title bar
+or border of its highest containing toplevel in this application.
+(Note that with some window managers the borders may be invisible.)
In selecting the containing window, children are given higher priority
than parents and among siblings the highest one in the stacking order is
chosen.
diff --git a/generic/tk3d.c b/generic/tk3d.c
index ce97a2e..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 = 0;
- borderPtr->darkGC = 0;
- borderPtr->lightGC = 0;
+ 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 c8f2610..70f10aa 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -3580,14 +3580,14 @@ DoWarp(
if ((dispPtr->warpWindow == NULL) ||
(Tk_IsMapped(dispPtr->warpWindow)
- && Tk_WindowId(dispPtr->warpWindow))) {
+ && (Tk_WindowId(dispPtr->warpWindow) != None))) {
TkpWarpPointer(dispPtr);
XForceScreenSaver(dispPtr->display, ScreenSaverReset);
}
if (dispPtr->warpWindow) {
Tcl_Release(dispPtr->warpWindow);
- dispPtr->warpWindow = 0;
+ dispPtr->warpWindow = NULL;
}
dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
}
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index d32800e..7bd6262 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -205,7 +205,7 @@ DoConfigureNotify(
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);
@@ -421,7 +421,7 @@ MakeTransparentWindowExist(
int notUsed;
TkDisplay *dispPtr;
- if (winPtr->window) {
+ if (winPtr->window != None) {
return; /* Window already exists. */
}
@@ -431,7 +431,7 @@ MakeTransparentWindowExist(
TkpMakeTransparentWindowExist(tkwin, parent);
- if (!winPtr->window) {
+ if (winPtr->window == None) {
return; /* Platform didn't make Window. */
}
@@ -458,7 +458,7 @@ MakeTransparentWindowExist(
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;
@@ -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 = 0;
+ 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) {
+ if (busyPtr->cursor != NULL) {
Tk_DefineCursor(tkBusy, busyPtr->cursor);
}
@@ -643,7 +644,7 @@ ConfigureBusy(
return TCL_ERROR;
}
if (busyPtr->cursor != oldCursor) {
- if (!busyPtr->cursor) {
+ 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 1cf6247..dc44189 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -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 cd9ab33..d9f0461 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -480,7 +480,7 @@ ConfigureArc(
} else {
newGC = NULL;
}
- if (arcPtr->outline.gc != None) {
+ if (arcPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), arcPtr->outline.gc);
}
arcPtr->outline.gc = newGC;
@@ -511,7 +511,9 @@ ConfigureArc(
}
}
- if ((arcPtr->style == ARC_STYLE) || (!color)) {
+ if (arcPtr->style == ARC_STYLE) {
+ newGC = NULL;
+ } else if (color == NULL) {
newGC = NULL;
} else {
gcValues.foreground = color->pixel;
@@ -528,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;
@@ -601,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);
}
}
@@ -732,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);
@@ -831,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;
@@ -865,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) {
@@ -1015,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;
}
@@ -1142,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;
}
@@ -1881,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",
@@ -1901,7 +1903,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (fillStipple) {
+ if (fillStipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
@@ -1910,7 +1912,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (arcPtr->outline.gc) {
+ if (arcPtr->outline.gc != NULL) {
Tcl_AppendToObj(psObj, "grestore gsave\n", -1);
}
} else {
@@ -1922,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",
@@ -1953,7 +1955,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (stipple) {
+ if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
@@ -1976,7 +1978,7 @@ ArcToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (stipple) {
+ if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index 42ea262..b9de07b 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -371,7 +371,7 @@ ConfigureBitmap(
}
}
- if (!bitmap) {
+ if (bitmap == None) {
newGC = NULL;
} else {
gcValues.foreground = fgColor->pixel;
@@ -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 f862238..b6c845d 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -523,10 +523,10 @@ ConfigureLine(
} else {
newGC = arrowGC = NULL;
}
- if (linePtr->outline.gc) {
+ if (linePtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc);
}
- if (linePtr->arrowGC) {
+ 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) {
@@ -654,7 +654,7 @@ ComputeLineBbox(
state = Canvas(canvas)->canvas_state;
}
- if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) {
+ if (!(linePtr->numPoints) || (state == TK_STATE_HIDDEN)) {
linePtr->header.x1 = -1;
linePtr->header.x2 = -1;
linePtr->header.y1 = -1;
@@ -667,7 +667,7 @@ ComputeLineBbox(
if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
@@ -840,7 +840,7 @@ DisplayLine(
int numPoints;
Tk_State state = itemPtr->state;
- if ((!linePtr->numPoints) || !linePtr->outline.gc) {
+ if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
}
@@ -2277,20 +2277,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;
}
}
@@ -2324,7 +2324,7 @@ LineToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (stipple) {
+ if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
@@ -2345,7 +2345,7 @@ LineToPostscript(
Tcl_ResetResult(interp);
if ((!linePtr->smooth) || (linePtr->numPoints < 3)) {
Tk_CanvasPsPath(interp, canvas, linePtr->coordPtr, linePtr->numPoints);
- } else if (!stipple && linePtr->smooth->postscriptProc) {
+ } else if ((stipple == None) && linePtr->smooth->postscriptProc) {
linePtr->smooth->postscriptProc(interp, canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps);
} else {
@@ -2495,7 +2495,7 @@ ArrowheadPostscript(
Tk_CanvasPsPath(interp, canvas, arrowPtr, PTS_IN_ARROW);
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (stipple) {
+ if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index d541b3b..be80378 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -270,10 +270,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;
@@ -453,11 +453,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;
@@ -478,9 +478,9 @@ ConfigurePolygon(
mask |= GCCapStyle|GCJoinStyle;
newGC = Tk_GetGC(tkwin, mask, &gcValues);
} else {
- newGC = 0;
+ newGC = NULL;
}
- if (polyPtr->outline.gc) {
+ if (polyPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc);
}
polyPtr->outline.gc = newGC;
@@ -491,24 +491,24 @@ ConfigurePolygon(
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;
+ newGC = NULL;
} else {
gcValues.foreground = color->pixel;
mask = GCForeground;
- if (stipple) {
+ if (stipple != None) {
gcValues.stipple = stipple;
gcValues.fill_style = FillStippled;
mask |= GCStipple|GCFillStyle;
@@ -518,13 +518,13 @@ ConfigurePolygon(
* Mac OS X CG drawing needs access to the outline linewidth
* even for fills (as linewidth controls antialiasing).
*/
- gcValues.line_width = polyPtr->outline.gc ?
+ gcValues.line_width = polyPtr->outline.gc != None ?
polyPtr->outline.gc->line_width : 0;
mask |= GCLineWidth;
#endif
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
- if (polyPtr->fillGC) {
+ if (polyPtr->fillGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC);
}
polyPtr->fillGC = newGC;
@@ -569,28 +569,28 @@ DeletePolygon(
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
Tk_DeleteOutline(display, &polyPtr->outline);
- if (polyPtr->coordPtr) {
+ if (polyPtr->coordPtr != NULL) {
ckfree(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 != NULL) {
Tk_FreeGC(display, polyPtr->fillGC);
}
}
@@ -694,7 +694,7 @@ ComputePolygonBbox(
}
}
- if (polyPtr->outline.gc) {
+ 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 && numPoints > 3) {
+ if (gc != NULL && numPoints > 3) {
XFillPolygon(display, drawable, gc, pointPtr, numPoints, Complex,
CoordModeOrigin);
}
- if (outlineGC) {
+ 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 && !polyPtr->outline.gc) ||
+ if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) ||
(polyPtr->numPoints < 1) ||
- (polyPtr->numPoints < 3 && !polyPtr->outline.gc)) {
+ (polyPtr->numPoints < 3 && polyPtr->outline.gc == NULL)) {
return;
}
@@ -894,14 +894,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;
}
}
@@ -911,7 +911,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 != 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) {
+ if (polyPtr->fillGC != NULL) {
XFillPolygon(display, drawable, polyPtr->fillGC, pointPtr,
numPoints, Complex, CoordModeOrigin);
}
- if (polyPtr->outline.gc) {
+ 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 && polyPtr->fillGC) {
+ 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 && (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 || (width <= 1)) {
+ if ((polyPtr->outline.gc == NULL) || (width <= 1)) {
goto donepoint;
}
@@ -1515,7 +1515,7 @@ PolygonToArea(
goto donearea;
}
- if (!polyPtr->outline.gc) {
+ if (polyPtr->outline.gc == NULL) {
goto donearea;
}
@@ -1829,13 +1829,13 @@ PolygonToPostscript(
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 != NULL) {
fillColor = polyPtr->activeFillColor;
}
- if (polyPtr->activeFillStipple) {
+ if (polyPtr->activeFillStipple != None) {
fillStipple = polyPtr->activeFillStipple;
}
} else if (state == TK_STATE_DISABLED) {
@@ -1845,13 +1845,13 @@ PolygonToPostscript(
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 != NULL) {
fillColor = polyPtr->disabledFillColor;
}
- if (polyPtr->disabledFillStipple) {
+ if (polyPtr->disabledFillStipple != None) {
fillStipple = polyPtr->disabledFillStipple;
}
}
@@ -1894,7 +1894,7 @@ PolygonToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (stipple) {
+ if (stipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
@@ -1926,7 +1926,7 @@ PolygonToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (fillStipple) {
+ if (fillStipple != None) {
Tcl_AppendToObj(psObj, "eoclip ", -1);
Tcl_ResetResult(interp);
@@ -1947,7 +1947,7 @@ PolygonToPostscript(
* Now draw the outline, if there is one.
*/
- if (color) {
+ if (color != NULL) {
Tcl_ResetResult(interp);
if (!polyPtr->smooth || !polyPtr->smooth->postscriptProc) {
Tk_CanvasPsPath(interp, canvas, polyPtr->coordPtr,
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 7f5f23d..279e548 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -256,9 +256,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;
@@ -269,9 +269,9 @@ CreateText(
textPtr->textLayout = NULL;
textPtr->actualWidth = 0;
textPtr->drawOrigin[0] = textPtr->drawOrigin[1] = 0.0;
- textPtr->gc = 0;
- textPtr->selTextGC = 0;
- textPtr->cursorOffGC = 0;
+ textPtr->gc = NULL;
+ textPtr->selTextGC = NULL;
+ textPtr->cursorOffGC = NULL;
textPtr->sine = 0.0;
textPtr->cosine = 1.0;
@@ -419,7 +419,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;
@@ -435,26 +435,26 @@ ConfigureText(
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 != 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) {
+ if (color != NULL) {
gcValues.foreground = color->pixel;
mask |= GCForeground;
- if (stipple) {
+ if (stipple != None) {
gcValues.stipple = stipple;
gcValues.fill_style = FillStippled;
mask |= GCStipple|GCFillStyle;
@@ -462,7 +462,7 @@ ConfigureText(
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
mask &= ~(GCTile|GCFillStyle|GCStipple);
- if (stipple) {
+ if (stipple != None) {
gcValues.stipple = stipple;
gcValues.fill_style = FillStippled;
mask |= GCStipple|GCFillStyle;
@@ -472,11 +472,11 @@ ConfigureText(
}
newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues);
}
- if (textPtr->gc) {
+ if (textPtr->gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->gc);
}
textPtr->gc = newGC;
- if (textPtr->selTextGC) {
+ 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 = 0;
+ newGC = NULL;
}
- if (textPtr->cursorOffGC) {
+ if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC);
}
textPtr->cursorOffGC = newGC;
@@ -568,37 +568,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 != NULL) {
Tk_FreeGC(display, textPtr->gc);
}
- if (textPtr->selTextGC) {
+ if (textPtr->selTextGC != NULL) {
Tk_FreeGC(display, textPtr->selTextGC);
}
- if (textPtr->cursorOffGC) {
+ if (textPtr->cursorOffGC != NULL) {
Tk_FreeGC(display, textPtr->cursorOffGC);
}
}
@@ -811,16 +811,16 @@ DisplayCanvText(
}
stipple = textPtr->stipple;
if (Canvas(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 == NULL) {
return;
}
@@ -830,7 +830,7 @@ DisplayCanvText(
* read-only.
*/
- if (stipple) {
+ if (stipple != None) {
Tk_CanvasSetOffset(canvas, textPtr->gc, &textPtr->tsoffset);
}
@@ -932,7 +932,7 @@ DisplayCanvText(
Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable,
textInfoPtr->insertBorder, points, 4,
textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED);
- } else if (textPtr->cursorOffGC) {
+ } 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
@@ -975,7 +975,7 @@ DisplayCanvText(
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
textPtr->underline);
- if (stipple) {
+ if (stipple != None) {
XSetTSOrigin(display, textPtr->gc, 0, 0);
}
}
@@ -1559,14 +1559,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 != NULL) {
color = textPtr->disabledColor;
}
- if (textPtr->disabledStipple) {
+ if (textPtr->disabledStipple != None) {
stipple = textPtr->disabledStipple;
}
}
@@ -1598,7 +1598,7 @@ TextToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (stipple) {
+ if (stipple != None) {
Tcl_ResetResult(interp);
Tk_CanvasPsStipple(interp, canvas, stipple);
Tcl_AppendPrintfToObj(psObj, "/StippleText {\n %s} bind def\n",
@@ -1633,7 +1633,7 @@ TextToPostscript(
Tcl_AppendPrintfToObj(psObj,
"] %d %g %g %s %s DrawText\n",
fm.linespace, x / -2.0, y / 2.0, justify,
- (stipple ? "true" : "false"));
+ ((stipple == None) ? "false" : "true"));
/*
* Plug the accumulated postscript back into the result.
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 5ab3a28..6ce671d 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -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 *)) {
@@ -1477,7 +1477,7 @@ Tk_CanvasPsOutline(
* Note that psObj might hold an invalid reference now.
*/
- if (stipple) {
+ if (stipple != None) {
Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", -1);
if (Tk_CanvasPsStipple(interp, canvas, stipple) != TCL_OK) {
return TCL_ERROR;
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 134ff8d..414c6fb 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -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;
@@ -2754,7 +2754,7 @@ CanvasEventProc(
for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL;
itemPtr = itemPtr->nextPtr) {
if (AlwaysRedraw(itemPtr)) {
- ItemDisplay(canvasPtr, itemPtr, 0, 0, 0, 0, 0);
+ ItemDisplay(canvasPtr, itemPtr, None, 0, 0, 0, 0);
}
}
}
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 0798067..ccb9914 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -245,7 +245,7 @@ Tk_GetColor(
*/
tkColPtr->magic = COLOR_MAGIC;
- tkColPtr->gc = 0;
+ 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 = 0;
+ 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 = 0;
+ 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 2465d5b..d3c8aad 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -800,11 +800,11 @@ DoObjConfig(
Tk_Cursor newCursor;
if (nullOK && ObjectIsEmpty(valuePtr)) {
- newCursor = 0;
+ 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 = 0;
+ 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) = 0;
+ *((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 18a0d72..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 0;
+ return NULL;
}
cursorPtr->objRefCount++;
return cursorPtr->cursor;
@@ -188,7 +188,11 @@ Tk_GetCursor(
* details on legal syntax. */
{
TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string);
- return cursorPtr ? cursorPtr->cursor : NULL;
+
+ if (cursorPtr == NULL) {
+ return NULL;
+ }
+ return cursorPtr->cursor;
}
/*
@@ -384,7 +388,7 @@ Tk_GetCursorFromData(
error:
Tcl_DeleteHashEntry(dataHashPtr);
- return 0;
+ return NULL;
}
/*
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 9df8da6..05a1a60 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -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);
@@ -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;
@@ -2459,7 +2459,7 @@ EntryEventProc(
} else {
cursor = NULL;
}
- if (cursor) {
+ if (cursor != NULL) {
Tk_DefineCursor(entryPtr->tkwin, cursor);
} else {
Tk_UndefineCursor(entryPtr->tkwin);
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index 15b4c21..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
@@ -221,7 +221,7 @@ typedef struct {
* value that the users requests. Malloc'ed */
char *valueFormat; /* Sprintf conversion specifier used for the
* value. */
- char digitFormat[14]; /* Sprintf conversion specifier computed from
+ char digitFormat[16]; /* Sprintf conversion specifier computed from
* digits and other information; used for the
* value. */
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index b68ba54..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 = 0;
+ ipPtr->winPtr = NULL;
}
}
ckfree(handlerPtr);
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 81b6405..ce7dc8c 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -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/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 aa977c4..f4ee407 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -403,18 +403,18 @@ ImgBmapConfigureInstance(
(unsigned) masterPtr->height);
}
- if (oldMask) {
+ if (oldMask != None) {
Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask);
}
- if (oldBitmap) {
+ if (oldBitmap != None) {
Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap);
}
- if (masterPtr->data) {
+ if (masterPtr->data != NULL) {
gcValues.foreground = instancePtr->fg->pixel;
gcValues.graphics_exposures = False;
mask = GCForeground|GCGraphicsExposures;
- if (instancePtr->bg) {
+ if (instancePtr->bg != NULL) {
gcValues.background = instancePtr->bg->pixel;
mask |= GCBackground;
if (instancePtr->mask != None) {
@@ -429,7 +429,7 @@ ImgBmapConfigureInstance(
} else {
gc = NULL;
}
- if (instancePtr->gc) {
+ if (instancePtr->gc != NULL) {
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
instancePtr->gc = gc;
@@ -441,7 +441,7 @@ ImgBmapConfigureInstance(
* it clear that this instance cannot be displayed. Then report the error.
*/
- if (instancePtr->gc) {
+ if (instancePtr->gc != NULL) {
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
instancePtr->gc = NULL;
@@ -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 27d2766..72ebcb8 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -167,7 +167,7 @@ TkImgPhotoConfigureInstance(
* has the side effect of allocating a pixmap for us.
*/
- if (!instancePtr->pixels || (instancePtr->error == NULL)
+ if ((instancePtr->pixels == None) || (instancePtr->error == NULL)
|| (instancePtr->width != masterPtr->width)
|| (instancePtr->height != masterPtr->height)) {
TkImgPhotoInstanceSetSize(instancePtr);
@@ -285,7 +285,7 @@ TkImgPhotoGet(
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;
@@ -621,7 +621,7 @@ TkImgPhotoDisplay(
* the image instance so it can't be displayed.
*/
- if (!instancePtr->pixels) {
+ if (instancePtr->pixels == None) {
return;
}
@@ -697,7 +697,7 @@ TkImgPhotoDisplay(
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);
@@ -784,7 +784,7 @@ TkImgPhotoInstanceSetSize(
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),
@@ -806,7 +806,7 @@ TkImgPhotoInstanceSetSize(
TkSetPixmapColormap(newPixmap, instancePtr->colormap);
- if (instancePtr->pixels) {
+ if (instancePtr->pixels != None) {
/*
* Copy any common pixels from the old pixmap and free it.
*/
@@ -1587,10 +1587,10 @@ TkImgDisposeInstance(
PhotoInstance *instancePtr = clientData;
PhotoInstance *prevPtr;
- if (instancePtr->pixels) {
+ if (instancePtr->pixels != None) {
Tk_FreePixmap(instancePtr->display, instancePtr->pixels);
}
- if (instancePtr->gc) {
+ 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 b2584da..b323845 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -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.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 e9b1c98..3abfc3c 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -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;
@@ -390,19 +390,19 @@ TkMenuConfigureEntryDrawOptions(
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 f0927c9..21da0d3 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -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 e44da06..9d02346 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -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) {
@@ -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 698e8a9..f20f38f 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -477,16 +477,16 @@ DoConfig(
Tk_Cursor newCursor, oldCursor;
if (nullValue) {
- newCursor = 0;
+ 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,7 +1022,7 @@ 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) = NULL;
}
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 8233d35..80ddb33 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -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;
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index c1b16b3..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 = 0;
+ 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 30e1d50..daae092 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -468,7 +468,7 @@ ConfigureRectOval(
} else {
newGC = NULL;
}
- if (rectOvalPtr->outline.gc) {
+ if (rectOvalPtr->outline.gc != NULL) {
Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->outline.gc);
}
rectOvalPtr->outline.gc = newGC;
@@ -499,7 +499,7 @@ ConfigureRectOval(
}
}
- if (!color) {
+ if (color == NULL) {
newGC = NULL;
} else {
gcValues.foreground = color->pixel;
@@ -516,13 +516,13 @@ ConfigureRectOval(
* fills (as linewidth controls antialiasing).
*/
- gcValues.line_width = rectOvalPtr->outline.gc ?
+ gcValues.line_width = rectOvalPtr->outline.gc != None ?
rectOvalPtr->outline.gc->line_width : 0;
mask |= GCLineWidth;
#endif
newGC = Tk_GetGC(tkwin, mask, &gcValues);
}
- if (rectOvalPtr->fillGC) {
+ 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;
@@ -1470,7 +1470,7 @@ RectOvalToPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (fillStipple) {
+ if (fillStipple != None) {
Tcl_AppendToObj(psObj, "clip ", -1);
Tcl_ResetResult(interp);
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 71de55f..6f61046 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -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 73678ed..4f28738 100644
--- a/generic/tkScale.h
+++ b/generic/tkScale.h
@@ -73,7 +73,7 @@ typedef struct TkScale {
* values. 0 means we get to choose the number
* based on resolution and/or the range of the
* scale. */
- char format[14]; /* Sprintf conversion specifier computed from
+ char format[16]; /* Sprintf conversion specifier computed from
* digits and other information. */
double bigIncrement; /* Amount to use for large increments to scale
* value. (0 means we pick a value). */
@@ -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.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/tkText.c b/generic/tkText.c
index 6c1512d..ab06089 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -2277,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)
@@ -2294,10 +2294,10 @@ ConfigureText(
if ((textPtr->selTagPtr->border != NULL)
|| (textPtr->selTagPtr->selBorder != NULL)
|| (textPtr->selTagPtr->reliefString != NULL)
- || textPtr->selTagPtr->bgStipple
+ || (textPtr->selTagPtr->bgStipple != None)
|| (textPtr->selTagPtr->fgColor != NULL)
|| (textPtr->selTagPtr->selFgColor != NULL)
- || textPtr->selTagPtr->fgStipple
+ || (textPtr->selTagPtr->fgStipple != None)
|| (textPtr->selTagPtr->overstrikeString != NULL)
|| (textPtr->selTagPtr->overstrikeColor != NULL)
|| (textPtr->selTagPtr->underlineString != NULL)
diff --git a/generic/tkText.h b/generic/tkText.h
index 4703703..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
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 4fb30e0..2551c16 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -730,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);
@@ -862,7 +862,7 @@ GetStyle(
border = tagPtr->selBorder;
}
- if ((tagPtr->selFgColor) && (isSelected)) {
+ if ((tagPtr->selFgColor != NULL) && isSelected) {
fgColor = tagPtr->selFgColor;
}
@@ -889,11 +889,11 @@ GetStyle(
styleValues.bgStipple = tagPtr->bgStipple;
bgStipplePrio = tagPtr->priority;
}
- if (fgColor && (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;
}
@@ -931,9 +931,9 @@ GetStyle(
&& (tagPtr->priority > overstrikePrio)) {
styleValues.overstrike = tagPtr->overstrike;
overstrikePrio = tagPtr->priority;
- if (tagPtr->overstrikeColor) {
+ if (tagPtr->overstrikeColor != NULL) {
styleValues.overstrikeColor = tagPtr->overstrikeColor;
- } else if (fgColor) {
+ } else if (fgColor != NULL) {
styleValues.overstrikeColor = fgColor;
}
}
@@ -976,9 +976,9 @@ GetStyle(
&& (tagPtr->priority > underlinePrio)) {
styleValues.underline = tagPtr->underline;
underlinePrio = tagPtr->priority;
- if (tagPtr->underlineColor) {
+ if (tagPtr->underlineColor != NULL) {
styleValues.underlineColor = tagPtr->underlineColor;
- } else if (fgColor) {
+ } else if (fgColor != NULL) {
styleValues.underlineColor = fgColor;
}
}
@@ -1076,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) {
+ if (stylePtr->ulGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->ulGC);
}
- if (stylePtr->ovGC) {
+ if (stylePtr->ovGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->ovGC);
}
Tcl_DeleteHashEntry(stylePtr->hPtr);
@@ -2690,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.
*/
@@ -4583,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);
}
}
}
@@ -5219,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;
@@ -8027,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 3a7052a..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)
@@ -534,10 +534,10 @@ TkTextTagCmd(
if ((tagPtr->border != NULL)
|| (tagPtr->selBorder != NULL)
|| (tagPtr->reliefString != NULL)
- || tagPtr->bgStipple
+ || (tagPtr->bgStipple != None)
|| (tagPtr->fgColor != NULL)
|| (tagPtr->selFgColor != NULL)
- || tagPtr->fgStipple
+ || (tagPtr->fgStipple != None)
|| (tagPtr->overstrikeString != NULL)
|| (tagPtr->overstrikeColor != NULL)
|| (tagPtr->underlineString != NULL)
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 839e860..868a8fa 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -474,9 +474,9 @@ GetScreen(
dispPtr->lastEventTime = CurrentTime;
dispPtr->bindInfoStale = 1;
- dispPtr->cursorFont = 0;
+ dispPtr->cursorFont = None;
dispPtr->warpWindow = NULL;
- dispPtr->multipleAtom = 0;
+ dispPtr->multipleAtom = None;
/*
* By default we do want to collapse motion events in
@@ -2357,7 +2357,7 @@ Tk_IdToWindow(
break;
}
}
- if (!window) {
+ if (window == None) {
return NULL;
}
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 a8bb717..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, 0);
+ 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"
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index fd1ec22..e828b39 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -1950,7 +1950,7 @@ FontchooserParentEventHandler(
if (eventPtr->type == DestroyNotify) {
Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask,
FontchooserParentEventHandler, fcdPtr);
- fcdPtr->parent = NULL;
+ fcdPtr->parent = None;
FontchooserHideCmd(NULL, NULL, 0, NULL);
}
}
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 0f9214f..7bc807a 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -157,11 +157,15 @@ XMapWindow(
* the app to activate too early can make the menu bar
* unresponsive.
*/
+ TkMacOSXApplyWindowAttributes(macWin->winPtr, win);
+ [win setExcludedFromWindowsMenu:NO];
[NSApp activateIgnoringOtherApps:NO];
+ [[win contentView] setNeedsDisplay:YES];
if ( [win canBecomeKeyWindow] ) {
[win makeKeyAndOrderFront:NSApp];
+ } else {
+ [win orderFrontRegardless];
}
- TkMacOSXApplyWindowAttributes(macWin->winPtr, win);
} else {
/*
* Rebuild the container's clipping region and display
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 5cf0820..eb826a6 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -152,13 +152,13 @@ static const struct {
typedef enum {
WMATT_ALPHA, WMATT_FULLSCREEN, WMATT_MODIFIED, WMATT_NOTIFY,
WMATT_TITLEPATH, WMATT_TOPMOST, WMATT_TRANSPARENT,
- _WMATT_LAST_ATTRIBUTE
+ WMATT_TYPE, _WMATT_LAST_ATTRIBUTE
} WmAttribute;
static const char *const WmAttributeNames[] = {
"-alpha", "-fullscreen", "-modified", "-notify",
"-titlepath", "-topmost", "-transparent",
- NULL
+ "-type", NULL
};
/*
@@ -594,7 +594,8 @@ SetWindowSizeLimits(
*
* FrontWindowAtPoint --
*
- * Find frontmost toplevel window at a given screen location.
+ * Find frontmost toplevel window at a given screen location which has the
+ * specified mainPtr. If the location is in the title bar, return NULL.
*
* Results:
* TkWindow*.
@@ -607,7 +608,8 @@ SetWindowSizeLimits(
static TkWindow*
FrontWindowAtPoint(
- int x, int y)
+ int x,
+ int y)
{
NSPoint p = NSMakePoint(x, tkMacOSXZeroScreenHeight - y);
NSArray *windows = [NSApp orderedWindows];
@@ -615,11 +617,28 @@ FrontWindowAtPoint(
for (NSWindow *w in windows) {
winPtr = TkMacOSXGetTkWindow(w);
- if (winPtr && NSMouseInRect(p, [w frame], NO)) {
- break;
+ if (winPtr) {
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ NSRect windowFrame = [w frame];
+ NSRect contentFrame = [w frame];
+ contentFrame.size.height = [[w contentView] frame].size.height;
+ /*
+ * For consistency with other platforms, points in the
+ * title bar are not considered to be contained in the
+ * window.
+ */
+
+ if ((wmPtr->hints.initial_state == NormalState ||
+ wmPtr->hints.initial_state == ZoomState)) {
+ if (NSMouseInRect(p, contentFrame, NO)) {
+ return winPtr;
+ } else if (NSMouseInRect(p, windowFrame, NO)) {
+ return NULL;
+ }
+ }
}
}
- return winPtr;
+ return NULL;
}
/*
@@ -814,10 +833,6 @@ TkWmMapWindow(
*/
XMapWindow(winPtr->display, winPtr->window);
-
- /*Add window to Window menu.*/
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
- [win setExcludedFromWindowsMenu:NO];
}
/*
@@ -1301,7 +1316,7 @@ WmSetAttribute(
#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070)
[macWindow toggleFullScreen:macWindow];
#else
- TKLog(@"The fullscreen attribute is ignored on this system..");
+ TKLog(@"The fullscreen attribute is ignored on this system.");
#endif
}
break;
@@ -1379,6 +1394,9 @@ WmSetAttribute(
TK_PARENT_WINDOW);
}
break;
+ case WMATT_TYPE:
+ TKLog(@"The type attribute is ignored on macOS.");
+ break;
case _WMATT_LAST_ATTRIBUTE:
default:
return TCL_ERROR;
@@ -1429,6 +1447,9 @@ WmGetAttribute(
case WMATT_TRANSPARENT:
result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
break;
+ case WMATT_TYPE:
+ result = Tcl_NewStringObj("unsupported", -1);
+ break;
case _WMATT_LAST_ATTRIBUTE:
default:
break;
@@ -4386,7 +4407,7 @@ Tk_CoordsToWindow(
* that contains point. */
int x, y; /* Coordinates in winPtr. */
int tmpx, tmpy, bd;
-
+
/*
* Step 1: find the top-level window that contains the desired point.
*/
@@ -4456,6 +4477,9 @@ Tk_CoordsToWindow(
}
winPtr = nextPtr;
}
+ if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
+ return NULL;
+ }
return (Tk_Window) winPtr;
}
diff --git a/tests/unixWm.test b/tests/unixWm.test
index a0224a1..12a2142 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -808,14 +808,15 @@ test unixWm-22.2 {Tk_WmCmd procedure, "iconbitmap" option} {unix testwrapper} {
WM_HINTS] 0]]]
lappend result [wm iconbitmap .t] $bit
} {{} questhead 0x4 {} 0x0}
-test unixWm-22.3.1 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \
-{unix notAqua} {
- list [catch {wm iconbitmap .t bad-bitmap} msg] $msg
-} {1 {bitmap "bad-bitmap" not defined}}
-test unixWm-22.3.2 {Tk_WmCmd procedure, "iconbitmap" option for Aqua only} \
-Aqua {
+if {[tk windowingsystem] == "aqua"} {
+ set result_22_3 {0 {}}
+} else {
+ set result_22_3 {1 {bitmap "bad-bitmap" not defined}}
+}
+test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \
+unix {
list [catch {wm iconbitmap .t bad-bitmap} msg] $msg
-} {1 {}}
+} $result_22_3
test unixWm-23.1 {Tk_WmCmd procedure, "iconify" option} unix {
list [catch {wm iconify .t 12} msg] $msg
@@ -1218,13 +1219,14 @@ test unixWm-34.2 {Tk_WmCmd procedure, "sizefrom" option} {unix testwrapper} {
test unixWm-34.3 {Tk_WmCmd procedure, "sizefrom" option} unix {
list [catch {wm sizefrom .t none} msg] $msg
} {1 {bad argument "none": must be program or user}}
-
-test unixWm-35.1.1 {Tk_WmCmd procedure, "state" option} {unix notAqua} {
- list [catch {wm state .t 1} msg] $msg
-} {1 {bad argument "1": must be normal, iconic, or withdrawn}}
-test unixWm-35.1.2 {Tk_WmCmd procedure, "state" option} Aqua {
+if {[tk windowingsystem] == "aqua"} {
+ set result_35_1 {1 {bad argument "1": must be normal, iconic, withdrawn, or zoomed}}
+} else {
+ set result_35_1 {1 {bad argument "1": must be normal, iconic, or withdrawn}}
+}
+test unixWm-35.1 {Tk_WmCmd procedure, "state" option} {unix notAqua} {
list [catch {wm state .t 1} msg] $msg
-} {1 {bad argument "1": must be normal, iconic, withdrawn, or zoomed}}
+} $result_35_1
test unixWm-35.2 {Tk_WmCmd procedure, "state" option} unix {
list [catch {wm state .t iconic 1} msg] $msg
} {1 {wrong # args: should be "wm state window ?state?"}}
@@ -1777,88 +1779,103 @@ test unixWm-49.2 {Tk_GetRootCoords procedure, menubars} {unix testmenubar} {
} {52 7 12 62}
deleteWindows
-wm iconify .
-test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords} unix {
- deleteWindows
+wm withdraw .
+if {[tk windowingsystem] == "aqua"} {
+ # Modern mac windows have no border.
+ set result_50_1 {{} {} .t .t .t2 {} .t2 .t .t}
+} else {
+ # Windows are assumed to have a border (invisible in Gnome 3).
+ set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t}
+}
+test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} unix {
+ update
toplevel .t -width 300 -height 400 -bg green
- wm geom .t +40+0
+ wm geom .t +100+100
tkwait visibility .t
- toplevel .t2 -width 100 -height 80 -bg red
- wm geom .t2 +140+200
+ toplevel .t2 -width 100 -height 200 -bg red
+ wm geom .t2 +200+200
tkwait visibility .t2
raise .t2
+ update
set x [winfo rootx .t]
set y [winfo rooty .t]
- list [winfo containing [expr $x - 30] [expr $y + 250]] \
- [winfo containing [expr $x - 1] [expr $y + 250]] \
- [winfo containing $x [expr $y + 250]] \
- [winfo containing [expr $x + 99] [expr $y + 250]] \
- [winfo containing [expr $x + 100] [expr $y + 250]] \
- [winfo containing [expr $x + 199] [expr $y + 250]] \
- [winfo containing [expr $x + 200] [expr $y + 250]] \
- [winfo containing [expr $x + 220] [expr $y + 250]]
-} {{} {} .t {} .t2 .t2 {} .t}
+ list [winfo containing [expr $x - 30] [expr $y + 250]] \
+ [winfo containing [expr $x - 1] [expr $y + 250]] \
+ [winfo containing $x [expr $y + 250]] \
+ [winfo containing [expr $x + 99] [expr $y + 250]] \
+ [winfo containing [expr $x + 100] [expr $y + 250]] \
+ [winfo containing [expr $x + 150] [expr $y + 90]] \
+ [winfo containing [expr $x + 199] [expr $y + 250]] \
+ [winfo containing [expr $x + 200] [expr $y + 250]] \
+ [winfo containing [expr $x + 220] [expr $y + 250]] \
+} $result_50_1
test unixWm-50.2 {Tk_CoordsToWindow procedure, finding a toplevel, y-coords and overrideredirect} unix {
deleteWindows
- toplevel .t -width 300 -height 400 -bg yellow
- wm geom .t +0+50
+ toplevel .t -width 400 -height 300 -bg yellow
+ wm geom .t +100+100
tkwait visibility .t
- toplevel .t2 -width 100 -height 80 -bg blue
+ toplevel .t2 -width 200 -height 100 -bg blue
wm overrideredirect .t2 1
- wm geom .t2 +100+200
+ wm geom .t2 +200+200
tkwait visibility .t2
raise .t2
set x [winfo rootx .t]
set y [winfo rooty .t]
set y2 [winfo rooty .t2]
- list [winfo containing [expr $x +150] 10] \
- [winfo containing [expr $x +150] [expr $y - 1]] \
- [winfo containing [expr $x +150] $y] \
- [winfo containing [expr $x +150] [expr $y2 - 1]] \
- [winfo containing [expr $x +150] $y2] \
- [winfo containing [expr $x +150] [expr $y2 + 79]] \
- [winfo containing [expr $x +150] [expr $y2 + 80]] \
- [winfo containing [expr $x +150] [expr $y + 450]]
+ list [winfo containing [expr $x +200] [expr $y - 30]] \
+ [winfo containing [expr $x +200] [expr $y - 1]] \
+ [winfo containing [expr $x +200] $y] \
+ [winfo containing [expr $x +200] [expr $y2 - 1]] \
+ [winfo containing [expr $x +200] $y2] \
+ [winfo containing [expr $x +200] [expr $y2 + 99]] \
+ [winfo containing [expr $x +200] [expr $y2 + 100]] \
+ [winfo containing [expr $x +200] [expr $y + 450]]
} {{} {} .t .t .t2 .t2 .t {}}
test unixWm-50.3 {
Tk_CoordsToWindow procedure, finding a toplevel with embedding
-} -constraints tempNotWin -setup {
+} tempNotWin {
deleteWindows
+ catch {interp delete slave}
+
toplevel .t -width 300 -height 400 -bg blue
- wm geom .t +0+50
- frame .t.f -container 1
+ wm geom .t +100+100
+ frame .t.f -container 1 -bg red
place .t.f -x 150 -y 50
tkwait visibility .t.f
- setupbg
-} -body {
- dobg "
+ update
+ interp create slave
+ load {} Tk slave
+ slave alias frameid winfo id .t.f
+ slave eval {
wm withdraw .
- toplevel .x -width 100 -height 80 -use [winfo id .t.f] -bg yellow
- tkwait visibility .x"
- set result [dobg {
- set x [winfo rootx .x]
- set y [winfo rooty .x]
- list [winfo containing [expr $x - 1] [expr $y + 50]] \
- [winfo containing $x [expr $y +50]]
- }]
+ toplevel .x -width 100 -height 80 -use [frameid] -bg yellow
+ tkwait visibility .x
+ update
+ set x [winfo rootx .x]
+ set y [winfo rooty .x]
+ }
+ set result [list [slave eval {winfo containing [expr $x - 1] [expr $y + 50]}] \
+ [slave eval {winfo containing $x [expr $y + 50]}]]
+ interp delete slave
set x [winfo rootx .t]
set y [winfo rooty .t]
lappend result [winfo containing [expr $x + 200] [expr $y + 49]] \
- [winfo containing [expr $x + 200] [expr $y +50]]
-} -cleanup {
- cleanupbg
-} -result {{} .x .t .t.f}
+ [winfo containing [expr $x + 200] [expr $y +50]]
+ set result
+} {{} .x .t .t.f}
test unixWm-50.4 {Tk_CoordsToWindow procedure, window in other application} unix {
destroy .t
+
catch {interp delete slave}
toplevel .t -width 200 -height 200 -bg green
- wm geometry .t +0+0
+ wm geometry .t +100+100
tkwait visibility .t
+ update
interp create slave
load {} Tk slave
- slave eval {wm geometry . 200x200+0+0; tkwait visibility .}
- set result [list [winfo containing 100 100] \
- [slave eval {winfo containing 100 100}]]
+ slave eval {wm geometry . 200x200+100+100; tkwait visibility . ; update}
+ set result [list [winfo containing 200 200] \
+ [slave eval {winfo containing 200 200}]]
interp delete slave
set result
} {{} .}
@@ -1876,13 +1893,13 @@ test unixWm-50.5 {Tk_CoordsToWindow procedure, handling menubars} {unix testmenu
update
set x [winfo rootx .t]
set y [winfo rooty .t]
- list [winfo containing $x [expr $y - 31]] \
- [winfo containing $x [expr $y - 30]] \
- [winfo containing [expr $x + 50] [expr $y - 19]] \
- [winfo containing [expr $x + 50] [expr $y - 18]] \
- [winfo containing [expr $x + 50] $y] \
- [winfo containing [expr $x + 11] [expr $y + 152]] \
- [winfo containing [expr $x + 12] [expr $y + 152]]
+ list [winfo containing $x [expr $y - 31]] \
+ [winfo containing $x [expr $y - 30]] \
+ [winfo containing [expr $x + 50] [expr $y - 19]] \
+ [winfo containing [expr $x + 50] [expr $y - 18]] \
+ [winfo containing [expr $x + 50] $y] \
+ [winfo containing [expr $x + 11] [expr $y + 152]] \
+ [winfo containing [expr $x + 12] [expr $y + 152]]
} {{} .t.menu .t.menu .t.menu.f .t .t .t.f}
test unixWm-50.6 {Tk_CoordsToWindow procedure, embedding within one app.} unix {
deleteWindows
@@ -1947,6 +1964,7 @@ test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
tkwait visibility .t2
set result [list [winfo containing 100 100]]
wm iconify .t2
+ animationDelay
lappend result [winfo containing 100 100]
} {.t2 .t}
test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix {
@@ -2032,6 +2050,7 @@ test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapp
test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix {
foreach w {.t .t2 .t3} {
destroy $w
+ update
toplevel $w -width 200 -height 200 -bg green
wm geometry $w +0+0
}
@@ -2068,13 +2087,19 @@ test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix
raise .t2
lappend result [winfo containing $x $y]
} {.t2 .t .t2}
+# The mac won't put an overrideredirect window above the root,
+if {[tk windowingsystem] == "aqua"} {
+ wm withdraw .
+}
test unixWm-51.9 {TkWmRestackToplevel procedure, other window overrideredirect} unix {
foreach w {.t .t2 .t3} {
destroy $w
+ update
toplevel $w -width 200 -height 200 -bg green
wm overrideredirect $w 1
wm geometry $w +0+0
tkwait visibility $w
+ update
}
lower .t3 .t2
update
@@ -2090,6 +2115,9 @@ test unixWm-51.9 {TkWmRestackToplevel procedure, other window overrideredirect}
lower .t2
lappend result [winfo containing $x $y]
} {.t2 .t3}
+if {[tk windowingsystem] == "aqua"} {
+ wm deiconify .
+}
test unixWm-51.10 {TkWmRestackToplevel procedure, don't move window that's already in the right place} unix {
makeToplevels
raise .raise1
@@ -2465,11 +2493,18 @@ test unixWm-59.3 {exit processing} unix {
# NOTE: since [wm attributes] is not guaranteed to have any effect,
# the only thing we can really test here is the syntax.
#
+if {[tk windowingsystem] == "aqua"} {
+ set result_60_1 {-alpha 1.0 -fullscreen 0 -modified 0 -notify 0\
+ -titlepath {} -topmost 0 -transparent 0\
+ -type unsupported}
+} else {
+ set result_60_1 {-alpha 1.0 -topmost 0 -zoomed 0 -fullscreen 0 -type {}}
+}
test unixWm-60.1 {wm attributes - test} -constraints unix -body {
destroy .t
toplevel .t
wm attributes .t
-} -result [list -alpha 1.0 -topmost 0 -zoomed 0 -fullscreen 0 -type {}]
+} -result $result_60_1
test unixWm-60.2 {wm attributes - test} -constraints unix -body {
destroy .t
diff --git a/tests/wm.test b/tests/wm.test
index f56eaa7..7b81985 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -140,7 +140,7 @@ test wm-attributes-1.2.4 {usage} -constraints {unix notAqua} -returnCodes error
} -result {bad attribute "_": must be -alpha, -topmost, -zoomed, -fullscreen, or -type}
test wm-attributes-1.2.5 {usage} -constraints aqua -returnCodes error -body {
wm attributes . _
-} -result {bad attribute "_": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, or -transparent}
+} -result {bad attribute "_": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type}
### wm client ###
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index 58004d9..2969de1 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -76,7 +76,7 @@ TkpFreeBorder(
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
Display *display = DisplayOfScreen(borderPtr->screen);
- if (unixBorderPtr->solidGC != None) {
+ if (unixBorderPtr->solidGC != NULL) {
Tk_FreeGC(display, unixBorderPtr->solidGC);
}
}
@@ -124,7 +124,7 @@ Tk_3DVerticalBevel(
GC left, right;
Display *display = Tk_Display(tkwin);
- if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) {
+ if ((borderPtr->lightGC == NULL) && (relief != TK_RELIEF_FLAT)) {
TkpGetShadows(borderPtr, tkwin);
}
@@ -159,7 +159,7 @@ Tk_3DVerticalBevel(
(unsigned) width, (unsigned) height);
} else if (relief == TK_RELIEF_SOLID) {
UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr;
- if (unixBorderPtr->solidGC == None) {
+ if (unixBorderPtr->solidGC == NULL) {
XGCValues gcValues;
gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
@@ -220,7 +220,7 @@ Tk_3DHorizontalBevel(
/* Initializations needed only to prevent
* compiler warnings. */
- if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT) &&
+ if ((borderPtr->lightGC == NULL) && (relief != TK_RELIEF_FLAT) &&
(relief != TK_RELIEF_SOLID)) {
TkpGetShadows(borderPtr, tkwin);
}
@@ -246,7 +246,7 @@ Tk_3DHorizontalBevel(
bottomGC = borderPtr->darkGC;
break;
case TK_RELIEF_SOLID:
- if (unixBorderPtr->solidGC == None) {
+ if (unixBorderPtr->solidGC == NULL) {
XGCValues gcValues;
gcValues.foreground = BlackPixelOfScreen(borderPtr->screen);
@@ -344,7 +344,7 @@ TkpGetShadows(
int r, g, b;
XGCValues gcValues;
- if (borderPtr->lightGC != None) {
+ if (borderPtr->lightGC != NULL) {
return;
}
stressed = TkpCmapStressed(tkwin, borderPtr->colormap);
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 6cb80f4..2c6b99b 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -92,10 +92,10 @@ TkpDisplayMenuButton(
border = mbPtr->normalBorder;
}
- if (mbPtr->image) {
+ if (mbPtr->image != NULL) {
Tk_SizeOfImage(mbPtr->image, &width, &height);
haveImage = 1;
- } else if (mbPtr->bitmap) {
+ } else if (mbPtr->bitmap != None) {
Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
haveImage = 1;
}
@@ -183,7 +183,7 @@ TkpDisplayMenuButton(
if (mbPtr->image != NULL) {
Tk_RedrawImage(mbPtr->image, 0, 0, width, height, pixmap,
imageXOffset, imageYOffset);
- } else if (mbPtr->bitmap) {
+ } else if (mbPtr->bitmap != None) {
XSetClipOrigin(mbPtr->display, gc, imageXOffset, imageYOffset);
XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap,
gc, 0, 0, (unsigned) width, (unsigned) height,
@@ -203,7 +203,7 @@ TkpDisplayMenuButton(
if (mbPtr->image != NULL) {
Tk_RedrawImage(mbPtr->image, 0, 0, width, height, pixmap,
imageXOffset, imageYOffset);
- } else if (mbPtr->bitmap) {
+ } else if (mbPtr->bitmap != None) {
XSetClipOrigin(mbPtr->display, gc, x, y);
XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap,
gc, 0, 0, (unsigned) width, (unsigned) height,
@@ -358,10 +358,10 @@ TkpComputeMenuButtonGeometry(
txtHeight = 0;
avgWidth = 0;
- if (mbPtr->image) {
+ if (mbPtr->image != NULL) {
Tk_SizeOfImage(mbPtr->image, &width, &height);
haveImage = 1;
- } else if (mbPtr->bitmap) {
+ } else if (mbPtr->bitmap != None) {
Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
haveImage = 1;
}
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 70aebfa..2430134 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -937,7 +937,7 @@ Tk_DrawChars(
doUnderlineStrikeout:
if (tsdPtr->clipRegion != None) {
- XftDrawSetClip(fontPtr->ftDraw, None);
+ XftDrawSetClip(fontPtr->ftDraw, NULL);
}
if (fontPtr->font.fa.underline != 0) {
XFillRectangle(display, drawable, gc, xStart,
@@ -1183,7 +1183,7 @@ TkDrawAngledChars(
doUnderlineStrikeout:
if (tsdPtr->clipRegion != None) {
- XftDrawSetClip(fontPtr->ftDraw, None);
+ XftDrawSetClip(fontPtr->ftDraw, NULL);
}
if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) {
XPoint points[5];
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 2446c3f..9b75431 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -65,8 +65,8 @@ TkpCreateScrollbar(
{
UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar));
- scrollPtr->troughGC = None;
- scrollPtr->copyGC = None;
+ scrollPtr->troughGC = NULL;
+ scrollPtr->copyGC = NULL;
Tk_CreateEventHandler(tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
@@ -366,10 +366,10 @@ TkpDestroyScrollbar(
{
UnixScrollbar *unixScrollPtr = (UnixScrollbar *)scrollPtr;
- if (unixScrollPtr->troughGC != None) {
+ if (unixScrollPtr->troughGC != NULL) {
Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC);
}
- if (unixScrollPtr->copyGC != None) {
+ if (unixScrollPtr->copyGC != NULL) {
Tk_FreeGC(scrollPtr->display, unixScrollPtr->copyGC);
}
}
@@ -406,11 +406,11 @@ TkpConfigureScrollbar(
gcValues.foreground = scrollPtr->troughColorPtr->pixel;
new = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues);
- if (unixScrollPtr->troughGC != None) {
+ if (unixScrollPtr->troughGC != NULL) {
Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC);
}
unixScrollPtr->troughGC = new;
- if (unixScrollPtr->copyGC == None) {
+ if (unixScrollPtr->copyGC == NULL) {
gcValues.graphics_exposures = False;
unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin,
GCGraphicsExposures, &gcValues);
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 19ac86c..8944ecc 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -5785,6 +5785,18 @@ Tk_GetRootCoords(
*----------------------------------------------------------------------
*/
+static int PointInWindow(
+ int x,
+ int y,
+ WmInfo *wmPtr)
+{
+ XWindowChanges changes = wmPtr->winPtr->changes;
+ return (x >= changes.x &&
+ x < changes.x + changes.width &&
+ y >= changes.y - wmPtr->menuHeight &&
+ y < changes.y + changes.height);
+}
+
Tk_Window
Tk_CoordsToWindow(
int rootX, int rootY, /* Coordinates of point in root window. If a
@@ -5855,13 +5867,38 @@ Tk_CoordsToWindow(
}
for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
wmPtr = wmPtr->nextPtr) {
- if (wmPtr->reparent == child) {
- goto gotToplevel;
+ if (wmPtr->winPtr->mainPtr == NULL) {
+ continue;
+ }
+ if (child == wmPtr->reparent) {
+ if (PointInWindow(x, y, wmPtr)) {
+ goto gotToplevel;
+ } else {
+
+ /*
+ * Return NULL if the point is in the title bar or border.
+ */
+
+ return NULL;
+ }
}
if (wmPtr->wrapperPtr != NULL) {
if (child == wmPtr->wrapperPtr->window) {
goto gotToplevel;
- }
+ } else if (wmPtr->winPtr->flags & TK_EMBEDDED &&
+ TkpGetOtherWindow(wmPtr->winPtr) == NULL) {
+
+ /*
+ * This toplevel is embedded in a window belonging to
+ * a different application.
+ */
+
+ int rx, ry;
+ Tk_GetRootCoords((Tk_Window) wmPtr->winPtr, &rx, &ry);
+ childX -= rx;
+ childY -= ry;
+ goto gotToplevel;
+ }
} else if (child == wmPtr->winPtr->window) {
goto gotToplevel;
}
@@ -5883,9 +5920,6 @@ Tk_CoordsToWindow(
handler = NULL;
}
winPtr = wmPtr->winPtr;
- if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
- return NULL;
- }
/*
* Step 3: at this point winPtr and wmPtr refer to the toplevel that
@@ -5942,27 +5976,30 @@ Tk_CoordsToWindow(
if (nextPtr == NULL) {
break;
}
- winPtr = nextPtr;
- x -= winPtr->changes.x;
- y -= winPtr->changes.y;
- if ((winPtr->flags & TK_CONTAINER)
- && (winPtr->flags & TK_BOTH_HALVES)) {
+ x -= nextPtr->changes.x;
+ y -= nextPtr->changes.y;
+ if ((nextPtr->flags & TK_CONTAINER)
+ && (nextPtr->flags & TK_BOTH_HALVES)) {
/*
* The window containing the point is a container, and the
* embedded application is in this same process. Switch over to
* the toplevel for the embedded application and start processing
* that toplevel from scratch.
*/
-
- winPtr = TkpGetOtherWindow(winPtr);
+ winPtr = TkpGetOtherWindow(nextPtr);
if (winPtr == NULL) {
- return NULL;
+ return (Tk_Window) nextPtr;
}
wmPtr = winPtr->wmInfoPtr;
childX = x;
childY = y;
goto gotToplevel;
- }
+ } else {
+ winPtr = nextPtr;
+ }
+ }
+ if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
+ return NULL;
}
return (Tk_Window) winPtr;
}
diff --git a/win/stubs.c b/win/stubs.c
index 24df27c..1cf23ef 100644
--- a/win/stubs.c
+++ b/win/stubs.c
@@ -397,7 +397,7 @@ XGetWindowProperty(
unsigned long *bytes_after_return,
unsigned char **prop_return)
{
- *actual_type_return = 0;
+ *actual_type_return = None;
*actual_format_return = 0;
*nitems_return = 0;
*bytes_after_return = 0;
diff --git a/win/tkWin3d.c b/win/tkWin3d.c
index bf7a539..9f7ca22 100644
--- a/win/tkWin3d.c
+++ b/win/tkWin3d.c
@@ -127,7 +127,7 @@ Tk_3DVerticalBevel(
HDC dc = TkWinGetDrawableDC(display, drawable, &state);
int half;
- if (!borderPtr->lightGC && (relief != TK_RELIEF_FLAT)) {
+ if ((borderPtr->lightGC == NULL) && (relief != TK_RELIEF_FLAT)) {
TkpGetShadows(borderPtr, tkwin);
}
@@ -222,7 +222,7 @@ Tk_3DHorizontalBevel(
HDC dc = TkWinGetDrawableDC(display, drawable, &state);
int topColor, bottomColor;
- if (!borderPtr->lightGC && (relief != TK_RELIEF_FLAT)) {
+ if ((borderPtr->lightGC == NULL) && (relief != TK_RELIEF_FLAT)) {
TkpGetShadows(borderPtr, tkwin);
}
@@ -339,7 +339,7 @@ TkpGetShadows(
int r, g, b;
XGCValues gcValues;
- if (borderPtr->lightGC) {
+ if (borderPtr->lightGC != NULL) {
return;
}
@@ -465,10 +465,10 @@ TkpGetShadows(
return;
}
- if (!borderPtr->shadow) {
+ if (borderPtr->shadow == None) {
borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin,
Tk_GetUid("gray50"));
- if (!borderPtr->shadow) {
+ if (borderPtr->shadow == None) {
Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
}
}
@@ -540,7 +540,7 @@ TkWinGetBorderPixels(
{
WinBorder *borderPtr = (WinBorder *) border;
- if (!borderPtr->info.lightGC) {
+ if (borderPtr->info.lightGC == NULL) {
TkpGetShadows(&borderPtr->info, tkwin);
}
switch (which) {
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index 32c2499..ee0ce82 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -127,7 +127,7 @@ InitBoxes(void)
HRSRC hrsrc;
HGLOBAL hblk;
LPBITMAPINFOHEADER newBitmap;
- DWORD size;
+ size_t size;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -146,8 +146,9 @@ InitBoxes(void)
if (tsdPtr->boxesPtr != NULL && !(tsdPtr->boxesPtr->biWidth % 4)
&& !(tsdPtr->boxesPtr->biHeight % 2)) {
- size = tsdPtr->boxesPtr->biSize + (1 << tsdPtr->boxesPtr->biBitCount)
- * sizeof(RGBQUAD) + tsdPtr->boxesPtr->biSizeImage;
+ size = tsdPtr->boxesPtr->biSize
+ + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount)
+ + tsdPtr->boxesPtr->biSizeImage;
newBitmap = ckalloc(size);
memcpy(newBitmap, tsdPtr->boxesPtr, size);
tsdPtr->boxesPtr = newBitmap;
@@ -156,7 +157,7 @@ InitBoxes(void)
tsdPtr->boxesPalette = (DWORD*) (((LPSTR) tsdPtr->boxesPtr)
+ tsdPtr->boxesPtr->biSize);
tsdPtr->boxesBits = ((LPSTR) tsdPtr->boxesPalette)
- + ((1 << tsdPtr->boxesPtr->biBitCount) * sizeof(RGBQUAD));
+ + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount);
} else {
tsdPtr->boxesPtr = NULL;
}
@@ -433,10 +434,10 @@ TkpDisplayButton(
* Display image or bitmap or text for button.
*/
- if (butPtr->image) {
+ if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &width, &height);
haveImage = 1;
- } else if (butPtr->bitmap) {
+ } else if (butPtr->bitmap != None) {
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
haveImage = 1;
}
@@ -839,7 +840,7 @@ TkpComputeButtonGeometry(
if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &imgWidth, &imgHeight);
haveImage = 1;
- } else if (butPtr->bitmap) {
+ } else if (butPtr->bitmap != None) {
Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap,
&imgWidth, &imgHeight);
haveImage = 1;
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 6795ef3..366485b 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -3351,7 +3351,7 @@ FontchooserConfigureCmd(
Tk_Window parent = Tk_NameToWindow(interp,
Tcl_GetString(objv[i+1]), tkwin);
- if (!parent) {
+ if (parent == NULL) {
return TCL_ERROR;
}
if (hdPtr->parentObj) {
@@ -3446,7 +3446,7 @@ FontchooserShowCmd(
if (hdPtr->parentObj) {
parent = Tk_NameToWindow(interp, Tcl_GetString(hdPtr->parentObj),
tkwin);
- if (!parent) {
+ if (parent == NULL) {
return TCL_ERROR;
}
}
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 2c35d3b..e13a5e5 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -644,7 +644,7 @@ XFillRectangles(
TkWinDCState state;
HBRUSH brush, oldBrush;
- if (!d) {
+ if (d == None) {
return BadDrawable;
}
@@ -654,7 +654,7 @@ XFillRectangles(
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
- && gc->stipple) {
+ && gc->stipple != None) {
TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple;
HBRUSH stipple;
HBITMAP oldBitmap, bitmap;
@@ -818,7 +818,7 @@ RenderObject(
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
- && gc->stipple) {
+ && gc->stipple != None) {
TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple;
HDC dcMem;
@@ -942,7 +942,7 @@ XDrawLines(
TkWinDCState state;
HDC dc;
- if (!d) {
+ if (d == None) {
return BadDrawable;
}
@@ -987,7 +987,7 @@ XFillPolygon(
TkWinDCState state;
HDC dc;
- if (!d) {
+ if (d == None) {
return BadDrawable;
}
@@ -1029,7 +1029,7 @@ XDrawRectangle(
HBRUSH oldBrush;
HDC dc;
- if (!d) {
+ if (d == None) {
return BadDrawable;
}
@@ -1214,7 +1214,7 @@ DrawOrFillArc(
int xstart, ystart, xend, yend;
double radian_start, radian_end, xr, yr;
- if (!d) {
+ if (d == None) {
return BadDrawable;
}
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 25bb6f8..43c5e25 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -242,7 +242,7 @@ TkpUseWindow(
*/
/*
- if (winPtr->window) {
+ if (winPtr->window != None) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't modify container after widget is created", -1));
Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL);
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 977086b..e47637c 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -519,7 +519,7 @@ TkpGetFontFromAttributes(
tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr;
window = Tk_WindowId(tkwin);
- hwnd = window ? TkWinGetHWND(window) : NULL;
+ hwnd = (window == None) ? NULL : TkWinGetHWND(window);
hdc = GetDC(hwnd);
/*
@@ -632,7 +632,7 @@ TkpGetFontFamilies(
Tcl_Obj *resultObj;
window = Tk_WindowId(tkwin);
- hwnd = window ? TkWinGetHWND(window) : NULL;
+ hwnd = (window == None) ? NULL : TkWinGetHWND(window);
hdc = GetDC(hwnd);
resultObj = Tcl_NewObj();
@@ -988,7 +988,7 @@ Tk_MeasureChars(
}
*lengthPtr = curX;
- return p - source;
+ return (int)(p - source);
}
/*
@@ -1089,7 +1089,7 @@ Tk_DrawChars(
fontPtr = (WinFont *) gc->font;
display->request++;
- if (!drawable) {
+ if (drawable == None) {
return;
}
@@ -1097,14 +1097,14 @@ Tk_DrawChars(
SetROP2(dc, tkpWinRopModes[gc->function]);
- if (gc->clip_mask &&
+ if ((gc->clip_mask != None) &&
((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) {
SelectClipRgn(dc, (HRGN)((TkpClipMask *)gc->clip_mask)->value.region);
}
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
- && gc->stipple) {
+ && gc->stipple != None) {
TkWinDrawable *twdPtr = (TkWinDrawable *) gc->stipple;
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
@@ -1237,7 +1237,7 @@ TkDrawAngledChars(
fontPtr = (WinFont *) gc->font;
display->request++;
- if (!drawable) {
+ if (drawable == None) {
return;
}
@@ -1245,14 +1245,14 @@ TkDrawAngledChars(
SetROP2(dc, tkpWinRopModes[gc->function]);
- if (gc->clip_mask &&
+ if ((gc->clip_mask != None) &&
((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) {
SelectClipRgn(dc, (HRGN)((TkpClipMask *)gc->clip_mask)->value.region);
}
if ((gc->fill_style == FillStippled
|| gc->fill_style == FillOpaqueStippled)
- && gc->stipple) {
+ && gc->stipple != None) {
TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple;
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
@@ -1568,7 +1568,7 @@ InitFont(
TCHAR buf[LF_FACESIZE];
window = Tk_WindowId(tkwin);
- hwnd = window ? TkWinGetHWND(window) : NULL;
+ hwnd = (window == None) ? NULL : TkWinGetHWND(window);
hdc = GetDC(hwnd);
oldFont = SelectObject(hdc, hFont);
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index d61b84a..0a8ef73 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -347,7 +347,7 @@ XGetImageZPixmap(
size = sizeof(BITMAPINFO);
if (depth <= 8) {
- size += sizeof(unsigned short) * (1 << depth);
+ size += sizeof(unsigned short) << depth;
}
bmInfo = ckalloc(size);
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index b03cf6d..dd7d1cb 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -2364,7 +2364,7 @@ DrawMenuEntryLabel(
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
(unsigned) width, (unsigned) height);
} else if ((mePtr->image != NULL)
- && menuPtr->disabledImageGC) {
+ && (menuPtr->disabledImageGC != NULL)) {
XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
leftEdge + imageXOffset,
(int) (y + (mePtr->height - imageHeight)/2 + imageYOffset),
@@ -3005,7 +3005,7 @@ MenuSelectEvent(
Tk_MakeWindowExist(menuPtr->tkwin);
event.event = Tk_WindowId(menuPtr->tkwin);
event.root = XRootWindow(menuPtr->display, 0);
- event.subwindow = 0;
+ event.subwindow = None;
event.time = TkpGetMS();
root.msgpos = GetMessagePos();
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index a45a322..aa1ebde 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -115,7 +115,7 @@ Tk_GetPixmap(
if (newTwdPtr->bitmap.handle == NULL) {
ckfree(newTwdPtr);
- return 0;
+ return None;
}
return (Pixmap) newTwdPtr;
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index 869c059..6f1f840 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -401,7 +401,7 @@ XGetInputFocus(
{
Tk_Window tkwin = Tk_HWNDToWindow(GetFocus());
- *focus_return = tkwin ? Tk_WindowId(tkwin) : 0;
+ *focus_return = tkwin ? Tk_WindowId(tkwin) : None;
*revert_to_return = RevertToParent;
display->request++;
return Success;
@@ -432,7 +432,7 @@ XSetInputFocus(
Time time)
{
display->request++;
- if (focus) {
+ if (focus != None) {
SetFocus(Tk_GetHWND(focus));
}
return Success;
@@ -479,7 +479,7 @@ TkpChangeFocus(
}
}
- if (!winPtr->window) {
+ if (winPtr->window == None) {
Tcl_Panic("ChangeXFocus got null X window");
}
diff --git a/win/tkWinPort.h b/win/tkWinPort.h
index d9e7812..f5ac68b 100644
--- a/win/tkWinPort.h
+++ b/win/tkWinPort.h
@@ -90,6 +90,10 @@
* See ticket [916c1095438eae56]: GetVersionExW triggers warnings
*/
#if defined(_MSC_VER)
+# pragma warning(disable:4267)
+# pragma warning(disable:4244)
+# pragma warning(disable:4311)
+# pragma warning(disable:4312)
# pragma warning(disable:4996)
#endif
@@ -117,7 +121,7 @@
*/
#define TkpDefineNativeBitmaps()
-#define TkpCreateNativeBitmap(display, source) 0
-#define TkpGetNativeAppBitmap(display, name, w, h) 0
+#define TkpCreateNativeBitmap(display, source) None
+#define TkpGetNativeAppBitmap(display, name, w, h) None
#endif /* _WINPORT */
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 5393054..1b3717e 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -237,7 +237,7 @@ CreateProc(
for (winPtr = ((TkWindow*)tkwin)->nextPtr; winPtr != NULL;
winPtr = winPtr->nextPtr) {
- if ((winPtr->window) && !(winPtr->flags & TK_TOP_HIERARCHY)) {
+ if ((winPtr->window != None) && !(winPtr->flags & TK_TOP_HIERARCHY)) {
TkWinSetWindowPos(scrollPtr->hwnd, Tk_GetHWND(winPtr->window),
Below);
break;
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index d037f07..385e72b 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -233,7 +233,7 @@ TkpScanWindowId(
if (tkwin) {
*idPtr = Tk_WindowId(tkwin);
} else {
- *idPtr = 0;
+ *idPtr = None;
}
return TCL_OK;
}
@@ -264,7 +264,7 @@ TkpMakeWindow(
int style;
HWND hwnd;
- if (parent) {
+ if (parent != None) {
parentWin = Tk_GetHWND(parent);
style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
} else {
@@ -674,7 +674,7 @@ XConfigureWindow(
if (valueMask & CWStackMode) {
HWND sibling;
- if ((valueMask & CWSibling) && values->sibling) {
+ if ((valueMask & CWSibling) && (values->sibling != None)) {
sibling = Tk_GetHWND(values->sibling);
} else {
sibling = NULL;
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 7c73094..97cf255 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -978,7 +978,7 @@ WinSetIcon(
NULL);
return TCL_ERROR;
}
- if (!Tk_WindowId(tkw)) {
+ if (Tk_WindowId(tkw) == None) {
Tk_MakeWindowExist(tkw);
}
@@ -1144,7 +1144,7 @@ TkWinGetIcon(
}
}
- if (!Tk_WindowId(tkwin)) {
+ if (Tk_WindowId(tkwin) == None) {
Tk_MakeWindowExist(tkwin);
}
@@ -1922,11 +1922,11 @@ TkWmNewWindow(
wmPtr->hints.flags = InputHint | StateHint;
wmPtr->hints.input = True;
wmPtr->hints.initial_state = NormalState;
- wmPtr->hints.icon_pixmap = 0;
- wmPtr->hints.icon_window = 0;
+ wmPtr->hints.icon_pixmap = None;
+ wmPtr->hints.icon_window = None;
wmPtr->hints.icon_x = wmPtr->hints.icon_y = 0;
- wmPtr->hints.icon_mask = 0;
- wmPtr->hints.window_group = 0;
+ wmPtr->hints.icon_mask = None;
+ wmPtr->hints.window_group = None;
/*
* Default the maximum dimensions to the size of the display.
@@ -2007,7 +2007,7 @@ UpdateWrapper(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- if (!winPtr->window) {
+ if (winPtr->window == None) {
/*
* Ensure existence of the window to update the wrapper for.
*/
@@ -2625,7 +2625,7 @@ TkWmDeadWindow(
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, wmPtr2->winPtr);
wmPtr2->masterPtr = NULL;
- if (wmPtr2->wrapper
+ if ((wmPtr2->wrapper != NULL)
&& !(wmPtr2->flags & (WM_NEVER_MAPPED))) {
UpdateWrapper(wmPtr2->winPtr);
}
@@ -3433,7 +3433,7 @@ WmColormapwindowsCmd(
if (winPtr2 == winPtr) {
gotToplevel = 1;
}
- if (!winPtr2->window) {
+ if (winPtr2->window == None) {
Tk_MakeWindowExist((Tk_Window) winPtr2);
}
cmapList[i] = winPtr2;
@@ -3721,7 +3721,7 @@ WmFrameCmd(
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (!Tk_WindowId((Tk_Window) winPtr)) {
+ if (Tk_WindowId((Tk_Window) winPtr) == None) {
Tk_MakeWindowExist((Tk_Window) winPtr);
}
hwnd = wmPtr->wrapper;
@@ -4023,9 +4023,9 @@ WmIconbitmapCmd(
string = Tcl_GetString(objv[objc-1]);
if (*string == '\0') {
- if (wmPtr->hints.icon_pixmap) {
+ if (wmPtr->hints.icon_pixmap != None) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
- wmPtr->hints.icon_pixmap = 0;
+ wmPtr->hints.icon_pixmap = None;
}
wmPtr->hints.flags &= ~IconPixmapHint;
if (WinSetIcon(interp, NULL, (Tk_Window) useWinPtr) != TCL_OK) {
@@ -4078,7 +4078,7 @@ WmIconbitmapCmd(
Tcl_ResetResult(interp);
pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, string);
- if (!pixmap) {
+ if (pixmap == None) {
return TCL_ERROR;
}
wmPtr->hints.icon_pixmap = pixmap;
@@ -4206,13 +4206,13 @@ WmIconmaskCmd(
}
argv3 = Tcl_GetString(objv[3]);
if (*argv3 == '\0') {
- if (wmPtr->hints.icon_mask) {
+ if (wmPtr->hints.icon_mask != None) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask);
}
wmPtr->hints.flags &= ~IconMaskHint;
} else {
pixmap = Tk_GetBitmap(interp, tkwin, argv3);
- if (!pixmap) {
+ if (pixmap == None) {
return TCL_ERROR;
}
wmPtr->hints.icon_mask = pixmap;
@@ -6427,7 +6427,7 @@ Tk_GetRootCoords(
* If the window is mapped, let Windows figure out the translation.
*/
- if (winPtr->window) {
+ if (winPtr->window != None) {
HWND hwnd = Tk_GetHWND(winPtr->window);
POINT point;
@@ -6854,7 +6854,7 @@ TkWmRestackToplevel(
* (mapping it may give it a reparent window).
*/
- if (!winPtr->window) {
+ if (winPtr->window == None) {
Tk_MakeWindowExist((Tk_Window) winPtr);
}
if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
@@ -6864,7 +6864,7 @@ TkWmRestackToplevel(
? winPtr->wmInfoPtr->wrapper : Tk_GetHWND(winPtr->window);
if (otherPtr != NULL) {
- if (!otherPtr->window) {
+ if (otherPtr->window == None) {
Tk_MakeWindowExist((Tk_Window) otherPtr);
}
if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
@@ -6915,7 +6915,7 @@ TkWmAddToColormapWindows(
TkWindow **oldPtr, **newPtr;
int count, i;
- if (!winPtr->window) {
+ if (winPtr->window == None) {
return;
}
@@ -7350,7 +7350,7 @@ GenerateConfigureNotify(
event.xconfigure.y = winPtr->changes.y;
event.xconfigure.width = winPtr->changes.width;
event.xconfigure.height = winPtr->changes.height;
- event.xconfigure.above = 0;
+ event.xconfigure.above = None;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
}
@@ -8623,7 +8623,7 @@ TkpWinToplevelDetachWindow(
SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0);
winPtr->flags &= ~TK_EMBEDDED;
winPtr->privatePtr = NULL;
- wmPtr->wrapper = 0;
+ wmPtr->wrapper = NULL;
if (state >= 0 && state <= 3) {
wmPtr->hints.initial_state = state;
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 661be57..ec1fef3 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -522,10 +522,10 @@ TkWinDisplayChanged(
screen->root_visual->bits_per_rgb = screen->root_depth;
ReleaseDC(NULL, dc);
- if (screen->cmap) {
+ if (screen->cmap != None) {
XFreeColormap(display, screen->cmap);
}
- screen->cmap = XCreateColormap(display, 0, screen->root_visual,
+ screen->cmap = XCreateColormap(display, None, screen->root_visual,
AllocNone);
}
@@ -585,7 +585,7 @@ TkpOpenDisplay(
twdPtr = ckalloc(sizeof(TkWinDrawable));
if (twdPtr == NULL) {
- return 0;
+ return NULL;
}
twdPtr->type = TWD_WINDOW;
twdPtr->window.winPtr = NULL;
@@ -598,7 +598,7 @@ TkpOpenDisplay(
screen->white_pixel = RGB(255, 255, 255);
screen->black_pixel = RGB(0, 0, 0);
- screen->cmap = 0;
+ screen->cmap = None;
display->screens = screen;
display->nscreens = 1;
@@ -655,10 +655,10 @@ TkpCloseDisplay(
if (display->screens->root_visual != NULL) {
ckfree(display->screens->root_visual);
}
- if (display->screens->root) {
+ if (display->screens->root != None) {
ckfree(display->screens->root);
}
- if (display->screens->cmap) {
+ if (display->screens->cmap != None) {
XFreeColormap(display, display->screens->cmap);
}
ckfree(display->screens);
@@ -998,7 +998,7 @@ GenerateXEvent(
}
winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
- if (!winPtr || !winPtr->window) {
+ if (!winPtr || winPtr->window == None) {
return;
}
@@ -1121,7 +1121,7 @@ GenerateXEvent(
*/
event.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum);
- event.xbutton.subwindow = 0;
+ event.xbutton.subwindow = None;
event.xbutton.x = clientPoint.x;
event.xbutton.y = clientPoint.y;
event.xbutton.x_root = root.point.x;
@@ -1623,7 +1623,7 @@ HandleIMEComposition(
event.xkey.display = winPtr->display;
event.xkey.window = winPtr->window;
event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum);
- event.xkey.subwindow = 0;
+ event.xkey.subwindow = None;
event.xkey.state = TkWinGetModifierState();
event.xkey.time = TkpGetMS();
event.xkey.same_screen = True;
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index de207ad..3de1504 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -455,7 +455,7 @@ InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d)
{
Window win = Tk_WindowId(tkwin);
- if (win) {
+ if (win != None) {
elementData->hwnd = Tk_GetHWND(win);
} else {
elementData->hwnd = elementData->procs->stubWindow;
diff --git a/xlib/X11/X.h b/xlib/X11/X.h
index 316683b..b43967e 100644
--- a/xlib/X11/X.h
+++ b/xlib/X11/X.h
@@ -73,7 +73,9 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
*****************************************************************/
-/* define None 0L See bug [9e31fd9449] and below */
+#ifndef _WIN32
+# define None 0L /* See bug [9e31fd9449] and below */
+#endif
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
@@ -179,7 +181,9 @@ are reserved in the protocol for errors and replies. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
-/* define ControlMask (1<<2) See bug [9e31fd9449] and below */
+#ifndef _WIN32
+# define ControlMask (1<<2) /* See bug [9e31fd9449] and below */
+#endif
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
@@ -187,7 +191,9 @@ are reserved in the protocol for errors and replies. */
#define Mod5Mask (1<<7)
/* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */
+#ifdef _WIN32
enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) };
+#endif
/* modifier names. Used to build a SetModifierMapping request or
to read a GetModifierMapping request. These correspond to the
@@ -297,7 +303,7 @@ enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) };
/* Used in SetInputFocus, GetInputFocus */
-#define RevertToNone 0
+#define RevertToNone (int)None
#define RevertToPointerRoot (int)PointerRoot
#define RevertToParent 2
diff --git a/xlib/xgc.c b/xlib/xgc.c
index be66b21..b85fe39 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -50,7 +50,7 @@
static TkpClipMask *AllocClipMask(GC gc) {
TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask;
- if (!clip_mask) {
+ if (clip_mask == NULL) {
clip_mask = ckalloc(sizeof(TkpClipMask));
gc->clip_mask = (Pixmap) clip_mask;
#ifdef MAC_OSX_TK
@@ -78,14 +78,14 @@ static TkpClipMask *AllocClipMask(GC gc) {
*/
static void FreeClipMask(GC gc) {
- if (gc->clip_mask) {
+ if (gc->clip_mask != None) {
#ifdef MAC_OSX_TK
if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) {
TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region);
}
#endif
ckfree(gc->clip_mask);
- gc->clip_mask = 0;
+ gc->clip_mask = None;
}
}
@@ -125,7 +125,7 @@ XCreateGC(
gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize);
if (!gp) {
- return 0;
+ return NULL;
}
#define InitField(name,maskbit,default) \
@@ -144,11 +144,11 @@ XCreateGC(
InitField(fill_style, GCFillStyle, FillSolid);
InitField(fill_rule, GCFillRule, WindingRule);
InitField(arc_mode, GCArcMode, ArcPieSlice);
- InitField(tile, GCTile, 0);
- InitField(stipple, GCStipple, 0);
+ InitField(tile, GCTile, None);
+ InitField(stipple, GCStipple, None);
InitField(ts_x_origin, GCTileStipXOrigin, 0);
InitField(ts_y_origin, GCTileStipYOrigin, 0);
- InitField(font, GCFont, 0);
+ InitField(font, GCFont, None);
InitField(subwindow_mode, GCSubwindowMode, ClipByChildren);
InitField(graphics_exposures, GCGraphicsExposures, True);
InitField(clip_x_origin, GCClipXOrigin, 0);
@@ -157,7 +157,7 @@ XCreateGC(
InitField(dashes, GCDashList, 4);
(&(gp->dashes))[1] = 0;
- gp->clip_mask = 0;
+ gp->clip_mask = None;
if (mask & GCClipMask) {
TkpClipMask *clip_mask = AllocClipMask(gp);
@@ -268,7 +268,7 @@ int XFreeGC(
Display *d,
GC gc)
{
- if (gc) {
+ if (gc != NULL) {
FreeClipMask(gc);
TkpFreeGCCache(gc);
ckfree(gc);
@@ -464,8 +464,8 @@ TkSetRegion(
GC gc,
TkRegion r)
{
- if (!r) {
- Tcl_Panic("must not pass None to TkSetRegion for compatibility with X11; use XSetClipMask instead");
+ if (r == NULL) {
+ Tcl_Panic("must not pass NULL to TkSetRegion for compatibility with X11; use XSetClipMask instead");
} else {
TkpClipMask *clip_mask = AllocClipMask(gc);
@@ -483,7 +483,7 @@ XSetClipMask(
GC gc,
Pixmap pixmap)
{
- if (!pixmap) {
+ if (pixmap == None) {
FreeClipMask(gc);
} else {
TkpClipMask *clip_mask = AllocClipMask(gc);
diff --git a/xlib/ximage.c b/xlib/ximage.c
index f7bf1cc..aaab946 100644
--- a/xlib/ximage.c
+++ b/xlib/ximage.c
@@ -47,7 +47,7 @@ XCreateBitmapFromData(
pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1);
gc = XCreateGC(display, pix, 0, NULL);
if (gc == NULL) {
- return 0;
+ return None;
}
ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width,
height, 8, (width + 7) / 8);
diff --git a/xlib/xutil.c b/xlib/xutil.c
index 7b69e18..1e81549 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -9,12 +9,7 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include <stdlib.h>
-#include <tk.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
+#include "tkInt.h"
/*
*----------------------------------------------------------------------