PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/thirdparty/libqnetwm/libqnetwm/fixx11h.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 243 lines | 173 code | 20 blank | 50 comment | 0 complexity | e45af8d0c330d259336db1a9162a329a MD5 | raw file
  1//#ifdef    don't do this, this file is supposed to be included
  2//#define   multiple times
  3
  4/* Usage:
  5
  6 If you get compile errors caused by X11 includes (the line
  7 where first error appears contains word like None, Unsorted,
  8 Below, etc.), put #include <fixx11h.h> in the .cpp file 
  9 (not .h file!) between the place where X11 headers are
 10 included and the place where the file with compile
 11 error is included (or the place where the compile error
 12 in the .cpp file occurs).
 13 
 14 This file remaps X11 #defines to const variables or
 15 inline functions. The side effect may be that these
 16 symbols may now refer to different variables
 17 (e.g. if X11 #defined NoButton, after this file
 18 is included NoButton would no longer be X11's
 19 NoButton, but Qt::NoButton instead). At this time,
 20 there's no conflict known that could cause problems.
 21
 22 The original X11 symbols are still accessible
 23 (e.g. for None) as X::None, XNone, and also still
 24 None, unless name lookup finds different None
 25 first (in the current class, etc.)
 26
 27 Use 'Unsorted', 'Bool' and 'index' as templates.
 28
 29*/
 30
 31namespace X
 32{
 33
 34// template --->
 35// Affects: Should be without side effects.
 36#ifdef Unsorted
 37#ifndef FIXX11H_Unsorted
 38#define FIXX11H_Unsorted
 39const int XUnsorted = Unsorted;
 40#undef Unsorted
 41const int Unsorted = XUnsorted;
 42#endif
 43#undef Unsorted
 44#endif
 45// template <---
 46
 47// Affects: Should be without side effects.
 48#ifdef None
 49#ifndef FIXX11H_None
 50#define FIXX11H_None
 51const XID XNone = None;
 52#undef None
 53const XID None = XNone;
 54#endif
 55#undef None
 56#endif
 57
 58// template --->
 59// Affects: Should be without side effects.
 60#ifdef Bool
 61#ifndef FIXX11H_Bool
 62#define FIXX11H_Bool
 63typedef Bool XBool;
 64#undef Bool
 65typedef XBool Bool;
 66#endif
 67#undef Bool
 68#endif
 69
 70#ifdef FontChange
 71#ifndef FIXX11H_FontChange
 72#define FIXX11H_FontChange
 73const int XFontChange = FontChange;
 74#undef FontChange
 75const int FontChange = XFontChange;
 76#endif
 77#undef FontChange
 78#endif
 79// template <---
 80
 81// Affects: Should be without side effects.
 82#ifdef KeyPress
 83#ifndef FIXX11H_KeyPress
 84#define FIXX11H_KeyPress
 85const int XKeyPress = KeyPress;
 86#undef KeyPress
 87const int KeyPress = XKeyPress;
 88#endif
 89#undef KeyPress
 90#endif
 91
 92// Affects: Should be without side effects.
 93#ifdef KeyRelease
 94#ifndef FIXX11H_KeyRelease
 95#define FIXX11H_KeyRelease
 96const int XKeyRelease = KeyRelease;
 97#undef KeyRelease
 98const int KeyRelease = XKeyRelease;
 99#endif
100#undef KeyRelease
101#endif
102
103// Affects: Should be without side effects.
104#ifdef Above
105#ifndef FIXX11H_Above
106#define FIXX11H_Above
107const int XAbove = Above;
108#undef Above
109const int Above = XAbove;
110#endif
111#undef Above
112#endif
113
114// Affects: Should be without side effects.
115#ifdef Below
116#ifndef FIXX11H_Below
117#define FIXX11H_Below
118const int XBelow = Below;
119#undef Below
120const int Below = XBelow;
121#endif
122#undef Below
123#endif
124
125// Affects: Should be without side effects.
126#ifdef FocusIn
127#ifndef FIXX11H_FocusIn
128#define FIXX11H_FocusIn
129const int XFocusIn = FocusIn;
130#undef FocusIn
131const int FocusIn = XFocusIn;
132#endif
133#undef FocusIn
134#endif
135
136// Affects: Should be without side effects.
137#ifdef FocusOut
138#ifndef FIXX11H_FocusOut
139#define FIXX11H_FocusOut
140const int XFocusOut = FocusOut;
141#undef FocusOut
142const int FocusOut = XFocusOut;
143#endif
144#undef FocusOut
145#endif
146
147// Affects: Should be without side effects.
148#ifdef Always
149#ifndef FIXX11H_Always
150#define FIXX11H_Always
151const int XAlways = Always;
152#undef Always
153const int Always = XAlways;
154#endif
155#undef Always
156#endif
157
158// Affects: Should be without side effects.
159#ifdef Success
160#ifndef FIXX11H_Success
161#define FIXX11H_Success
162const int XSuccess = Success;
163#undef Success
164const int Success = XSuccess;
165#endif
166#undef Success
167#endif
168
169// Affects: Should be without side effects.
170#ifdef GrayScale
171#ifndef FIXX11H_GrayScale
172#define FIXX11H_GrayScale
173const int XGrayScale = GrayScale;
174#undef GrayScale
175const int GrayScale = XGrayScale;
176#endif
177#undef GrayScale
178#endif
179
180// Affects: Should be without side effects.
181#ifdef Status
182#ifndef FIXX11H_Status
183#define FIXX11H_Status
184typedef Status XStatus;
185#undef Status
186typedef XStatus Status;
187#endif
188#undef Status
189#endif
190
191// Affects: Should be without side effects.
192#ifdef CursorShape
193#ifndef FIXX11H_CursorShape
194#define FIXX11H_CursorShape
195const int XCursorShape = CursorShape;
196#undef CursorShape
197const int CursorShape = CursorShape;
198#endif
199#undef CursorShape
200#endif
201
202// template --->
203// Affects: Should be without side effects.
204#ifdef index
205#ifndef FIXX11H_index
206#define FIXX11H_index
207inline
208char* Xindex( const char* s, int c )
209    {
210    return index( s, c );
211    }
212#undef index
213inline
214char* index( const char* s, int c )
215    {
216    return Xindex( s, c );
217    }
218#endif
219#undef index
220#endif
221// template <---
222
223#ifdef rindex
224// Affects: Should be without side effects.
225#ifndef FIXX11H_rindex
226#define FIXX11H_rindex
227inline
228char* Xrindex( const char* s, int c )
229    {
230    return rindex( s, c );
231    }
232#undef rindex
233inline
234char* rindex( const char* s, int c )
235    {
236    return Xrindex( s, c );
237    }
238#endif
239#undef rindex
240#endif
241}
242
243using namespace X;