fixx11h.h
00001 //#ifdef don't do this, this file is supposed to be included 00002 //#define multiple times 00003 00004 /* Usage: 00005 00006 If you get compile errors caused by X11 includes (the line 00007 where first error appears contains word like None, Unsorted, 00008 Below, etc.), put #include <fixx11h.h> in the .cpp file 00009 (not .h file!) between the place where X11 headers are 00010 included and the place where the file with compile 00011 error is included (or the place where the compile error 00012 in the .cpp file occurs). 00013 00014 This file remaps X11 #defines to const variables or 00015 inline functions. The side effect may be that these 00016 symbols may now refer to different variables 00017 (e.g. if X11 #defined NoButton, after this file 00018 is included NoButton would no longer be X11's 00019 NoButton, but Qt::NoButton instead). At this time, 00020 there's no conflict known that could cause problems. 00021 00022 The original X11 symbols are still accessible 00023 (e.g. for None) as X::None, XNone, and also still 00024 None, unless name lookup finds different None 00025 first (in the current class, etc.) 00026 00027 Use 'Unsorted', 'Bool' and 'index' as templates. 00028 00029 */ 00030 00031 namespace X 00032 { 00033 00034 // template ---> 00035 // Affects: Should be without side effects. 00036 #ifdef Unsorted 00037 #ifndef FIXX11H_Unsorted 00038 #define FIXX11H_Unsorted 00039 const int XUnsorted = Unsorted; 00040 #undef Unsorted 00041 const int Unsorted = XUnsorted; 00042 #endif 00043 #undef Unsorted 00044 #endif 00045 // template <--- 00046 00047 // Affects: Should be without side effects. 00048 #ifdef None 00049 #ifndef FIXX11H_None 00050 #define FIXX11H_None 00051 const XID XNone = None; 00052 #undef None 00053 const XID None = XNone; 00054 #endif 00055 #undef None 00056 #endif 00057 00058 // template ---> 00059 // Affects: Should be without side effects. 00060 #ifndef _XTYPEDEF_BOOL 00061 #ifdef Bool 00062 #ifndef FIXX11H_Bool 00063 #define FIXX11H_Bool 00064 typedef Bool XBool; 00065 #undef Bool 00066 #define _XTYPEDEF_BOOL 00067 typedef XBool Bool; 00068 #endif 00069 #undef Bool 00070 #endif 00071 #endif // _XTYPEDEF_BOOL 00072 // template <--- 00073 00074 // Affects: Should be without side effects. 00075 #ifdef KeyPress 00076 #ifndef FIXX11H_KeyPress 00077 #define FIXX11H_KeyPress 00078 const int XKeyPress = KeyPress; 00079 #undef KeyPress 00080 const int KeyPress = XKeyPress; 00081 #endif 00082 #undef KeyPress 00083 #endif 00084 00085 // Affects: Should be without side effects. 00086 #ifdef KeyRelease 00087 #ifndef FIXX11H_KeyRelease 00088 #define FIXX11H_KeyRelease 00089 const int XKeyRelease = KeyRelease; 00090 #undef KeyRelease 00091 const int KeyRelease = XKeyRelease; 00092 #endif 00093 #undef KeyRelease 00094 #endif 00095 00096 // Affects: Should be without side effects. 00097 #ifdef Above 00098 #ifndef FIXX11H_Above 00099 #define FIXX11H_Above 00100 const int XAbove = Above; 00101 #undef Above 00102 const int Above = XAbove; 00103 #endif 00104 #undef Above 00105 #endif 00106 00107 // Affects: Should be without side effects. 00108 #ifdef Below 00109 #ifndef FIXX11H_Below 00110 #define FIXX11H_Below 00111 const int XBelow = Below; 00112 #undef Below 00113 const int Below = XBelow; 00114 #endif 00115 #undef Below 00116 #endif 00117 00118 // Affects: Should be without side effects. 00119 #ifdef FocusIn 00120 #ifndef FIXX11H_FocusIn 00121 #define FIXX11H_FocusIn 00122 const int XFocusIn = FocusIn; 00123 #undef FocusIn 00124 const int FocusIn = XFocusIn; 00125 #endif 00126 #undef FocusIn 00127 #endif 00128 00129 // Affects: Should be without side effects. 00130 #ifdef FocusOut 00131 #ifndef FIXX11H_FocusOut 00132 #define FIXX11H_FocusOut 00133 const int XFocusOut = FocusOut; 00134 #undef FocusOut 00135 const int FocusOut = XFocusOut; 00136 #endif 00137 #undef FocusOut 00138 #endif 00139 00140 // Affects: Should be without side effects. 00141 #ifdef Always 00142 #ifndef FIXX11H_Always 00143 #define FIXX11H_Always 00144 const int XAlways = Always; 00145 #undef Always 00146 const int Always = XAlways; 00147 #endif 00148 #undef Always 00149 #endif 00150 00151 // Affects: Should be without side effects. 00152 #ifdef Success 00153 #ifndef FIXX11H_Success 00154 #define FIXX11H_Success 00155 const int XSuccess = Success; 00156 #undef Success 00157 const int Success = XSuccess; 00158 #endif 00159 #undef Success 00160 #endif 00161 00162 // Affects: Should be without side effects. 00163 #ifdef GrayScale 00164 #ifndef FIXX11H_GrayScale 00165 #define FIXX11H_GrayScale 00166 const int XGrayScale = GrayScale; 00167 #undef GrayScale 00168 const int GrayScale = XGrayScale; 00169 #endif 00170 #undef GrayScale 00171 #endif 00172 00173 // Affects: Should be without side effects. 00174 #ifdef Status 00175 #ifndef FIXX11H_Status 00176 #define FIXX11H_Status 00177 typedef Status XStatus; 00178 #undef Status 00179 typedef XStatus Status; 00180 #endif 00181 #undef Status 00182 #endif 00183 00184 // Affects: Should be without side effects. 00185 #ifdef CursorShape 00186 #ifndef FIXX11H_CursorShape 00187 #define FIXX11H_CursorShape 00188 const int XCursorShape = CursorShape; 00189 #undef CursorShape 00190 const int CursorShape = CursorShape; 00191 #endif 00192 #undef CursorShape 00193 #endif 00194 00195 // template ---> 00196 // Affects: Should be without side effects. 00197 #ifdef index 00198 #ifndef FIXX11H_index 00199 #define FIXX11H_index 00200 inline 00201 char* Xindex( const char* s, int c ) 00202 { 00203 return index( s, c ); 00204 } 00205 #undef index 00206 inline 00207 char* index( const char* s, int c ) 00208 { 00209 return Xindex( s, c ); 00210 } 00211 #endif 00212 #undef index 00213 #endif 00214 // template <--- 00215 00216 #ifdef rindex 00217 // Affects: Should be without side effects. 00218 #ifndef FIXX11H_rindex 00219 #define FIXX11H_rindex 00220 inline 00221 char* Xrindex( const char* s, int c ) 00222 { 00223 return rindex( s, c ); 00224 } 00225 #undef rindex 00226 inline 00227 char* rindex( const char* s, int c ) 00228 { 00229 return Xrindex( s, c ); 00230 } 00231 #endif 00232 #undef rindex 00233 #endif 00234 } 00235 00236 using namespace X;