Xwindows.h revision 452262e1
1/*
2
3Copyright 1996, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
17SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
18ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization from
25The Open Group.
26
27*/
28
29/*
30 * This header file has the sole purpose of allowing the inclusion of
31 * windows.h without getting any name conflicts with X headers code, by
32 * renaming or disabling the conflicting definitions from windows.h
33 */
34
35/*
36 * Mingw.org versions of the Windows API headers actually avoid
37 * making the conflicting definitions if XFree86Server is defined, so we
38 * need to remember if that was defined and undefine it during including
39 * windows.h (so the conflicting definitions get wrapped correctly), and
40 * then redefine it afterwards. (This was never the correct thing to
41 * do as it's no help at all to X11 clients which also need to use the
42 * Win32 API)
43 */
44#undef _XFree86Server
45#ifdef XFree86Server
46# define _XFree86Server
47# undef XFree86Server
48#endif
49
50/*
51 * There doesn't seem to be a good way to wrap the min/max macros from
52 * windows.h, so we simply avoid defining them completely, allowing any
53 * pre-existing definition to stand.
54 *
55 */
56#define NOMINMAX
57
58/*
59 * mingw-w64 headers define BOOL as a typedef, protecting against macros
60 * mingw.org headers define BOOL in terms of WINBOOL
61 * ... so try to come up with something which works with both :-)
62 */
63#define _NO_BOOL_TYPEDEF
64#define BOOL WINBOOL
65#define INT32 wINT32
66#ifdef __x86_64__
67#define INT64 wINT64
68#define LONG64 wLONG64
69#endif
70#undef Status
71#define Status wStatus
72#define ATOM wATOM
73#define BYTE wBYTE
74#define FreeResource wFreeResource
75#pragma push_macro ("ControlMask")
76#undef ControlMask
77#include <windows.h>
78#undef NOMINMAX
79#undef Status
80#define Status int
81#undef BYTE
82#undef BOOL
83#undef INT32
84#undef INT64
85#undef LONG64
86#undef ATOM
87#undef FreeResource
88#pragma pop_macro ("ControlMask")
89#undef CreateWindowA
90
91/*
92 * Older version of this header used to name the windows API bool type wBOOL,
93 * rather than more standard name WINBOOL
94 */
95#define wBOOL WINBOOL
96
97#ifdef RESOURCE_H
98# undef RT_FONT
99# undef RT_CURSOR
100# define RT_FONT         ((RESTYPE)4)
101# define RT_CURSOR       ((RESTYPE)5)
102#endif
103
104#ifndef __CYGWIN__
105#define sleep(x) Sleep((x) * 1000)
106#endif
107
108#if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024)
109# undef PATH_MAX
110# define PATH_MAX 1024
111#endif
112
113#ifdef _XFree86Server
114# define XFree86Server
115# undef _XFree86Server
116#endif
117
118