summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-20 08:02:30 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-20 08:02:30 (GMT)
commit81b0bd7641a9d2f63154c97d41c27bbb696ef674 (patch)
treea17119411589e8c1291df53e2546243d84e78583 /xlib
parent93d974c265533cf2445446954346be8192e850a0 (diff)
downloadtk-81b0bd7641a9d2f63154c97d41c27bbb696ef674.zip
tk-81b0bd7641a9d2f63154c97d41c27bbb696ef674.tar.gz
tk-81b0bd7641a9d2f63154c97d41c27bbb696ef674.tar.bz2
Fix [9e31fd944934e269121fa78ff56b7b86f33e6db6|9e31fd9449]: X11/X.h and Windows.h have conflicting symbols.
Also fix a few newer (harmless) gcc warnings.
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 b18cb9e..e62f0de 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 = (TkpClipMask*) 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((char*) gc->clip_mask);
- gc->clip_mask = None;
+ gc->clip_mask = 0;
}
}
@@ -126,7 +126,7 @@ XCreateGC(
gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE +
gcCacheSize);
if (!gp) {
- return None;
+ return 0;
}
#define InitField(name,maskbit,default) \
@@ -145,11 +145,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);
@@ -158,7 +158,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);
@@ -269,7 +269,7 @@ int XFreeGC(
Display *d,
GC gc)
{
- if (gc != None) {
+ if (gc) {
FreeClipMask(gc);
TkpFreeGCCache(gc);
ckfree((char *) gc);
@@ -465,7 +465,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);
@@ -484,7 +484,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);