From efd4bad24508b1f23d339963b87cb69674d71015 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 3 Jan 2019 20:53:24 +0000 Subject: [PATCH 1/2] Fix for conflicting symbols in X.h and Windows.h Backported from Tcl/Tk 8.6.10: see https://core.tcl-lang.org/tk/info/9e31fd944934 Fixes #87 --- pTk/mTk/xlib/X11/X.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pTk/mTk/xlib/X11/X.h b/pTk/mTk/xlib/X11/X.h index a1cf10c8..e40ec07e 100644 --- a/pTk/mTk/xlib/X11/X.h +++ b/pTk/mTk/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 { 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. */ From 9e35a0719ae8d12f56bc831626babe9919a67f39 Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Sun, 5 Nov 2023 13:02:57 +0100 Subject: [PATCH 2/2] define None+ControlMask so these are still available in Tk::XS (GH #87) --- pTk/mTk/xlib/X11/X.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pTk/mTk/xlib/X11/X.h b/pTk/mTk/xlib/X11/X.h index e40ec07e..3dd12f3b 100644 --- a/pTk/mTk/xlib/X11/X.h +++ b/pTk/mTk/xlib/X11/X.h @@ -75,6 +75,8 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs #ifndef _WIN32 # define None 0L /* See bug [9e31fd9449] and below */ +#else +# define None None /* uses the enum below */ #endif #define ParentRelative 1L /* background pixmap in CreateWindow @@ -183,6 +185,8 @@ are reserved in the protocol for errors and replies. */ #define LockMask (1<<1) #ifndef _WIN32 # define ControlMask (1<<2) /* See bug [9e31fd9449] and below */ +#else +# define ControlMask ControlMask /* uses the enum below */ #endif #define Mod1Mask (1<<3) #define Mod2Mask (1<<4)