diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-06-05 18:04:58 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-06-05 18:18:47 +0100 |
commit | 1defe6b37c23941fe2a67ad4fa66e8ab5f37f9b3 (patch) | |
tree | eb38b8156edb90d98629b3d5a2bea2e6542be911 | |
parent | 32d14e349964c5b16e83eda902d9724aac380b59 (diff) |
Cygwin/X: Don't destroy min/max macros in Xwindows.h
Now that macros named min/max rather than MIN/MAX are used consistently in the
X server, we need to ensure they work for Xwin builds. Change Xwindows.h from
simply destroying any definition of min/max, to avoiding defining them but
allowing any pre-existing definition to stand.
Also, try to improve the comment describing why this madness is needed in the
first place, and remove a no-longer needed macro definition of sleep()
-rw-r--r-- | Xwindows.h | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -28,18 +28,29 @@ The Open Group. */ /* - * This header file has for sole purpose to allow to include windows.h - * without getting any name conflicts with our code. - * Conflicts come from the fact that including windows.h actually pulls - * in the whole Windows API... + * This header file has the sole purpose of allowing the inclusion of + * windows.h without getting any name conflicts with X headers code, by + * renaming the conflicting definitions from windows.h + * + * Some (non-Microsoft) versions of the Windows API headers actually avoid + * making the conflicting definitions if XFree86Server is defined, so we + * need to remember if that was defined and undefine it during including + * windows.h (so the conflicting definitions get wrapped correctly), and + * then redefine it afterwards... + * + * There doesn't seem to be a good way to wrap the min/max macros from + * windows.h, so we simply avoid defining them completely, allowing any + * pre-existing definition to stand. + * */ #undef _XFree86Server -#ifdef XFree86Server +#ifdef XFree86Server #define _XFree86Server #undef XFree86Server #endif +#define NOMINMAX #define BOOL wBOOL #define INT32 wINT32 #undef Status @@ -48,6 +59,7 @@ The Open Group. #define BYTE wBYTE #define FreeResource wFreeResource #include <windows.h> +#undef NOMINMAX #undef Status #define Status int #undef BYTE @@ -56,8 +68,6 @@ The Open Group. #undef ATOM #undef FreeResource #undef CreateWindowA -#undef min -#undef max #ifdef RESOURCE_H #undef RT_FONT @@ -66,8 +76,6 @@ The Open Group. #define RT_CURSOR ((RESTYPE)5) #endif -#define sleep(x) Sleep((x) * 1000) - #if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024) #undef PATH_MAX #define PATH_MAX 1024 |