KWindowSystem

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

KDE's Doxygen guidelines are available online.