1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 // The header <X11/X.h> defines "None" as a macro that expands to "0L".
8 // This is terrible because many enumerations have an enumerator named "None".
9 // To work around this, we undefine the macro "None", and define a replacement
10 // macro named "X11None".
11 // Include this header after including X11 headers, where necessary.
12 #ifdef None
13 #  undef None
14 #  define X11None 0L
15 // <X11/X.h> also defines "RevertToNone" as a macro that expands to "(int)None".
16 // Since we are undefining "None", that stops working. To keep it working,
17 // we undefine "RevertToNone" and redefine it in terms of "X11None".
18 #  ifdef RevertToNone
19 #    undef RevertToNone
20 #    define RevertToNone (int)X11None
21 #  endif
22 #endif
23 
24 // X11 also defines Always, which conflicts with some style system enum variant
25 // names, so get rid of that too, given we don't use it anywhere else.
26 #ifdef Always
27 #  undef Always
28 #endif
29 
30 // And Complex...
31 #ifdef Complex
32 #  undef Complex
33 #endif
34 
35 #ifdef CurrentTime
36 #  undef CurrentTime
37 #  define X11CurrentTime 0L
38 #endif
39 
40 // X11/Xlib.h also defines True and False, get rid of those too for
41 // the same reasons as above...
42 #ifdef True
43 #  undef True
44 #  define X11True 1
45 #endif
46 #ifdef False
47 #  undef False
48 #  define X11False 0
49 #endif
50