summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-20 09:44:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-20 09:44:05 (GMT)
commite26cd8eb2b04a4bd764e382cbcbfe4b1030796c6 (patch)
tree6bca925436edc8dce431cfd10502d50117b62d46 /xlib
parent0c4227b6cc6e9716ddd086a75e45c4e9373fa51b (diff)
parent81b0bd7641a9d2f63154c97d41c27bbb696ef674 (diff)
downloadtk-e26cd8eb2b04a4bd764e382cbcbfe4b1030796c6.zip
tk-e26cd8eb2b04a4bd764e382cbcbfe4b1030796c6.tar.gz
tk-e26cd8eb2b04a4bd764e382cbcbfe4b1030796c6.tar.bz2
Fix [9e31fd9449]: X11/X.h and Windows.h have conflicting symbols
*** POTENTIAL INCOMPATIBILITY *** for Win32 only: On X11 and Mac, "None" can still be used as before
Diffstat (limited to 'xlib')
-rw-r--r--xlib/X11/X.h10
-rw-r--r--xlib/xgc.c22
-rw-r--r--xlib/ximage.c2
3 files changed, 19 insertions, 15 deletions
diff --git a/xlib/X11/X.h b/xlib/X11/X.h
index daf2283..ad8f630 100644
--- a/xlib/X11/X.h
+++ b/xlib/X11/X.h
@@ -73,7 +73,9 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
*****************************************************************/
-#define None 0L /* universal null resource or null atom */
+#ifndef _WIN32 /* prevent conflicting define against windows.h, bug [9e31fd9449] */
+# define None 0L /* universal null resource or null atom */
+#endif
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
@@ -179,7 +181,9 @@ are reserved in the protocol for errors and replies. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
-#define ControlMask (1<<2)
+#ifndef _WIN32 /* prevent conflicting define against windows.h, bug [9e31fd9449] */
+# define ControlMask (1<<2)
+#endif
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
@@ -294,7 +298,7 @@ are reserved in the protocol for errors and replies. */
/* Used in SetInputFocus, GetInputFocus */
-#define RevertToNone (int)None
+#define RevertToNone 0
#define RevertToPointerRoot (int)PointerRoot
#define RevertToParent 2
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 984c949..be66b21 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 == None) {
+ if (!clip_mask) {
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 != None) {
+ if (gc->clip_mask) {
#ifdef MAC_OSX_TK
if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) {
TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region);
}
#endif
ckfree(gc->clip_mask);
- gc->clip_mask = None;
+ gc->clip_mask = 0;
}
}
@@ -125,7 +125,7 @@ XCreateGC(
gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize);
if (!gp) {
- return None;
+ return 0;
}
#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, None);
- InitField(stipple, GCStipple, None);
+ InitField(tile, GCTile, 0);
+ InitField(stipple, GCStipple, 0);
InitField(ts_x_origin, GCTileStipXOrigin, 0);
InitField(ts_y_origin, GCTileStipYOrigin, 0);
- InitField(font, GCFont, None);
+ InitField(font, GCFont, 0);
InitField(subwindow_mode, GCSubwindowMode, ClipByChildren);
InitField(graphics_exposures, GCGraphicsExposures, True);
InitField(clip_x_origin, GCClipXOrigin, 0);
@@ -157,7 +157,7 @@ XCreateGC(
InitField(dashes, GCDashList, 4);
(&(gp->dashes))[1] = 0;
- gp->clip_mask = None;
+ gp->clip_mask = 0;
if (mask & GCClipMask) {
TkpClipMask *clip_mask = AllocClipMask(gp);
@@ -268,7 +268,7 @@ int XFreeGC(
Display *d,
GC gc)
{
- if (gc != None) {
+ if (gc) {
FreeClipMask(gc);
TkpFreeGCCache(gc);
ckfree(gc);
@@ -464,7 +464,7 @@ TkSetRegion(
GC gc,
TkRegion r)
{
- if (r == None) {
+ if (!r) {
Tcl_Panic("must not pass None to TkSetRegion for compatibility with X11; use XSetClipMask instead");
} else {
TkpClipMask *clip_mask = AllocClipMask(gc);
@@ -483,7 +483,7 @@ XSetClipMask(
GC gc,
Pixmap pixmap)
{
- if (pixmap == None) {
+ if (!pixmap) {
FreeClipMask(gc);
} else {
TkpClipMask *clip_mask = AllocClipMask(gc);
diff --git a/xlib/ximage.c b/xlib/ximage.c
index aaab946..f7bf1cc 100644
--- a/xlib/ximage.c
+++ b/xlib/ximage.c
@@ -47,7 +47,7 @@ XCreateBitmapFromData(
pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1);
gc = XCreateGC(display, pix, 0, NULL);
if (gc == NULL) {
- return None;
+ return 0;
}
ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width,
height, 8, (width + 7) / 8);