File indexing completed on 2024-04-28 03:59:24
0001 /* 0002 SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 //#ifdef don't do this, this file is supposed to be included 0008 //#define multiple times 0009 0010 #include <QtGlobal> 0011 0012 /* Usage: 0013 0014 If you get compile errors caused by X11 includes (the line 0015 where first error appears contains word like None, Unsorted, 0016 Below, etc.), put #include <fixx11h.h> in the .cpp file 0017 (not .h file!) between the place where X11 headers are 0018 included and the place where the file with compile 0019 error is included (or the place where the compile error 0020 in the .cpp file occurs). 0021 0022 This file remaps X11 #defines to const variables or 0023 inline functions. The side effect may be that these 0024 symbols may now refer to different variables 0025 (e.g. if X11 #defined NoButton, after this file 0026 is included NoButton would no longer be X11's 0027 NoButton, but Qt::NoButton instead). At this time, 0028 there's no conflict known that could cause problems. 0029 0030 The original X11 symbols are still accessible 0031 (e.g. for None) as X::None, XNone, and also still 0032 None, unless name lookup finds different None 0033 first (in the current class, etc.) 0034 0035 Use 'Unsorted', 'Bool' and 'index' as templates. 0036 0037 */ 0038 0039 namespace X 0040 { 0041 // template ---> 0042 // Affects: Should be without side effects. 0043 #ifdef Unsorted 0044 #ifndef FIXX11H_Unsorted 0045 #define FIXX11H_Unsorted 0046 const int XUnsorted = Unsorted; 0047 #undef Unsorted 0048 const int Unsorted = XUnsorted; 0049 #endif 0050 #undef Unsorted 0051 #endif 0052 // template <--- 0053 0054 // Affects: Should be without side effects. 0055 #ifdef None 0056 #ifndef FIXX11H_None 0057 #define FIXX11H_None 0058 const XID XNone = None; 0059 #undef None 0060 const XID None = XNone; 0061 #endif 0062 #undef None 0063 #endif 0064 0065 // template ---> 0066 // Affects: Should be without side effects. 0067 #ifdef Bool 0068 #ifndef FIXX11H_Bool 0069 #define FIXX11H_Bool 0070 #ifdef _XTYPEDEF_BOOL /* Xdefs.h has typedef'ed Bool already */ 0071 #undef Bool 0072 #else 0073 typedef Bool XBool; 0074 #undef Bool 0075 typedef XBool Bool; 0076 #endif 0077 #endif 0078 #undef Bool 0079 #define _XTYPEDEF_BOOL 0080 #endif 0081 // template <--- 0082 0083 // Affects: Should be without side effects. 0084 #ifdef KeyPress 0085 #ifndef FIXX11H_KeyPress 0086 #define FIXX11H_KeyPress 0087 const int XKeyPress = KeyPress; 0088 #undef KeyPress 0089 const int KeyPress = XKeyPress; 0090 #endif 0091 #undef KeyPress 0092 #endif 0093 0094 // Affects: Should be without side effects. 0095 #ifdef KeyRelease 0096 #ifndef FIXX11H_KeyRelease 0097 #define FIXX11H_KeyRelease 0098 const int XKeyRelease = KeyRelease; 0099 #undef KeyRelease 0100 const int KeyRelease = XKeyRelease; 0101 #endif 0102 #undef KeyRelease 0103 #endif 0104 0105 // Affects: Should be without side effects. 0106 #ifdef Above 0107 #ifndef FIXX11H_Above 0108 #define FIXX11H_Above 0109 const int XAbove = Above; 0110 #undef Above 0111 const int Above = XAbove; 0112 #endif 0113 #undef Above 0114 #endif 0115 0116 // Affects: Should be without side effects. 0117 #ifdef Below 0118 #ifndef FIXX11H_Below 0119 #define FIXX11H_Below 0120 const int XBelow = Below; 0121 #undef Below 0122 const int Below = XBelow; 0123 #endif 0124 #undef Below 0125 #endif 0126 0127 // Affects: Should be without side effects. 0128 #ifdef FocusIn 0129 #ifndef FIXX11H_FocusIn 0130 #define FIXX11H_FocusIn 0131 const int XFocusIn = FocusIn; 0132 #undef FocusIn 0133 const int FocusIn = XFocusIn; 0134 #endif 0135 #undef FocusIn 0136 #endif 0137 0138 // Affects: Should be without side effects. 0139 #ifdef FocusOut 0140 #ifndef FIXX11H_FocusOut 0141 #define FIXX11H_FocusOut 0142 const int XFocusOut = FocusOut; 0143 #undef FocusOut 0144 const int FocusOut = XFocusOut; 0145 #endif 0146 #undef FocusOut 0147 #endif 0148 0149 // Affects: Should be without side effects. 0150 #ifdef Always 0151 #ifndef FIXX11H_Always 0152 #define FIXX11H_Always 0153 const int XAlways = Always; 0154 #undef Always 0155 const int Always = XAlways; 0156 #endif 0157 #undef Always 0158 #endif 0159 0160 // Affects: Should be without side effects. 0161 #ifdef Expose 0162 #ifndef FIXX11H_Expose 0163 #define FIXX11H_Expose 0164 const int XExpose = Expose; 0165 #undef Expose 0166 const int Expose = XExpose; 0167 #endif 0168 #undef Expose 0169 #endif 0170 0171 // Affects: Should be without side effects. 0172 #ifdef Success 0173 #ifndef FIXX11H_Success 0174 #define FIXX11H_Success 0175 const int XSuccess = Success; 0176 #undef Success 0177 const int Success = XSuccess; 0178 #endif 0179 #undef Success 0180 #endif 0181 0182 // Affects: Should be without side effects. 0183 #ifdef GrayScale 0184 #ifndef FIXX11H_GrayScale 0185 #define FIXX11H_GrayScale 0186 const int XGrayScale = GrayScale; 0187 #undef GrayScale 0188 const int GrayScale = XGrayScale; 0189 #endif 0190 #undef GrayScale 0191 #endif 0192 0193 // Affects: Should be without side effects. 0194 #ifdef Status 0195 #ifndef FIXX11H_Status 0196 #define FIXX11H_Status 0197 typedef Status XStatus; 0198 #undef Status 0199 typedef XStatus Status; 0200 #endif 0201 #undef Status 0202 #endif 0203 0204 // template ---> 0205 // Affects: Should be without side effects. 0206 #ifdef CursorShape 0207 #ifndef FIXX11H_CursorShape 0208 #define FIXX11H_CursorShape 0209 const int XCursorShape = CursorShape; 0210 #undef CursorShape 0211 const int CursorShape = XCursorShape; 0212 #endif 0213 #undef CursorShape 0214 #endif 0215 // template <--- 0216 0217 // template ---> 0218 // Affects: Should be without side effects. 0219 #ifdef FontChange 0220 #ifndef FIXX11H_FontChange 0221 #define FIXX11H_FontChange 0222 const int XFontChange = FontChange; 0223 #undef FontChange 0224 const int FontChange = XFontChange; 0225 #endif 0226 #undef FontChange 0227 #endif 0228 // template <--- 0229 0230 // Affects: Should be without side effects. 0231 #ifdef NormalState 0232 #ifndef FIXX11H_NormalState 0233 #define FIXX11H_NormalState 0234 const int XNormalState = NormalState; 0235 #undef NormalState 0236 const int NormalState = XNormalState; 0237 #endif 0238 #undef NormalState 0239 #endif 0240 0241 // template ---> 0242 // Affects: Should be without side effects. 0243 #ifdef index 0244 #ifndef FIXX11H_index 0245 #define FIXX11H_index 0246 inline const char *Xindex(const char *s, int c) 0247 { 0248 return index(s, c); 0249 } 0250 #undef index 0251 inline const char *index(const char *s, int c) 0252 { 0253 return Xindex(s, c); 0254 } 0255 #endif 0256 #undef index 0257 #endif 0258 // template <--- 0259 0260 #ifdef rindex 0261 // Affects: Should be without side effects. 0262 #ifndef FIXX11H_rindex 0263 #define FIXX11H_rindex 0264 inline const char *Xrindex(const char *s, int c) 0265 { 0266 return rindex(s, c); 0267 } 0268 #undef rindex 0269 inline const char *rindex(const char *s, int c) 0270 { 0271 return Xrindex(s, c); 0272 } 0273 #endif 0274 #undef rindex 0275 #endif 0276 } 0277 0278 using namespace X;