summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-01-08 08:31:34 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-01-08 08:31:34 (GMT)
commit1cf82956754b0b42ef212635195b5c29fc93a0fc (patch)
treeb6bf6eaff55be5c6fd20363aea6473c6bfbd76ad /xlib
parent726546cf2742672ce6de89b0500b3e750c6fe3b7 (diff)
parentd2747a371058fa4128dbd7896fe040f0b3ee6be7 (diff)
downloadtk-1cf82956754b0b42ef212635195b5c29fc93a0fc.zip
tk-1cf82956754b0b42ef212635195b5c29fc93a0fc.tar.gz
tk-1cf82956754b0b42ef212635195b5c29fc93a0fc.tar.bz2
Fix [9e31fd944934e269121fa78ff56b7b86f33e6db6|9e31fd9449]: X11/X.h and Windows.h have conflicting symbols.
*** POTENTIAL INCOMPATIBILITY *** on Windows only: gcc/clang/MSVC will generate new warnings in extensions when the "None" symbol is used incorrectly. Those warnings are all fixed in the core, that's what most of this commit is doing.
Diffstat (limited to 'xlib')
-rw-r--r--xlib/X11/X.h13
-rw-r--r--xlib/xgc.c10
2 files changed, 16 insertions, 7 deletions
diff --git a/xlib/X11/X.h b/xlib/X11/X.h
index daf2283..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 /* universal null resource or null atom */
+#ifndef _WIN32
+# define None 0L /* See bug [9e31fd9449] and below */
+#endif
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
@@ -179,13 +181,20 @@ are reserved in the protocol for errors and replies. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
-#define ControlMask (1<<2)
+#ifndef _WIN32
+# define ControlMask (1<<2) /* See bug [9e31fd9449] and below */
+#endif
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
#define Mod4Mask (1<<6)
#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
masks defined above. */
diff --git a/xlib/xgc.c b/xlib/xgc.c
index b18cb9e..38d2783 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 == NULL) {
clip_mask = (TkpClipMask*) ckalloc(sizeof(TkpClipMask));
gc->clip_mask = (Pixmap) clip_mask;
#ifdef MAC_OSX_TK
@@ -126,7 +126,7 @@ XCreateGC(
gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE +
gcCacheSize);
if (!gp) {
- return None;
+ return NULL;
}
#define InitField(name,maskbit,default) \
@@ -269,7 +269,7 @@ int XFreeGC(
Display *d,
GC gc)
{
- if (gc != None) {
+ if (gc != NULL) {
FreeClipMask(gc);
TkpFreeGCCache(gc);
ckfree((char *) gc);
@@ -465,8 +465,8 @@ TkSetRegion(
GC gc,
TkRegion r)
{
- if (r == None) {
- 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);