Qt 4.8
qxlibstatic.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QTESTLITESTATICINFO_H
43 #define QTESTLITESTATICINFO_H
44 
45 #include <QtCore/QTextStream>
46 #include <QtCore/QDataStream>
47 #include <QtCore/QMetaType>
48 #include <QtCore/QVariant>
49 
50 #if defined(_XLIB_H_) // crude hack, but...
51 #error "cannot include <X11/Xlib.h> before this file"
52 #endif
53 #define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback
54 #define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback
55 #define XSetIMValues qt_XSetIMValues
56 #include <X11/Xlib.h>
57 #undef XRegisterIMInstantiateCallback
58 #undef XUnregisterIMInstantiateCallback
59 #undef XSetIMValues
60 
61 #include <X11/Xutil.h>
62 #include <X11/Xos.h>
63 #ifdef index
64 # undef index
65 #endif
66 #ifdef rindex
67 # undef rindex
68 #endif
69 #ifdef Q_OS_VXWORS
70 # ifdef open
71 # undef open
72 # endif
73 # ifdef getpid
74 # undef getpid
75 # endif
76 #endif // Q_OS_VXWORKS
77 #include <X11/Xatom.h>
78 
79 //#define QT_NO_SHAPE
80 #ifdef QT_NO_SHAPE
81 # define XShapeCombineRegion(a,b,c,d,e,f,g)
82 # define XShapeCombineMask(a,b,c,d,e,f,g)
83 #else
84 # include <X11/extensions/shape.h>
85 #endif // QT_NO_SHAPE
86 
87 
88 #if !defined (QT_NO_TABLET)
89 # include <X11/extensions/XInput.h>
90 #if defined (Q_OS_IRIX)
91 # include <X11/extensions/SGIMisc.h>
92 # include <wacom.h>
93 #endif
94 #endif // QT_NO_TABLET
95 
96 
97 // #define QT_NO_XINERAMA
98 #ifndef QT_NO_XINERAMA
99 // XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3).
100 extern "C" {
101 # include <X11/extensions/Xinerama.h>
102 }
103 #endif // QT_NO_XINERAMA
104 
105 // #define QT_NO_XRANDR
106 #ifndef QT_NO_XRANDR
107 # include <X11/extensions/Xrandr.h>
108 #endif // QT_NO_XRANDR
109 
110 // #define QT_NO_XRENDER
111 #ifndef QT_NO_XRENDER
112 # include <X11/extensions/Xrender.h>
113 #endif // QT_NO_XRENDER
114 
115 #ifndef QT_NO_XSYNC
116 extern "C" {
117 # include "X11/extensions/sync.h"
118 }
119 #endif
120 
121 #ifndef QT_NO_XFIXES
122 #include <X11/extensions/Xfixes.h>
123 #endif // QT_NO_XFIXES
124 
125 // #define QT_NO_XKB
126 #ifndef QT_NO_XKB
127 # include <X11/XKBlib.h>
128 #endif // QT_NO_XKB
129 
130 
131 #if !defined(XlibSpecificationRelease)
132 # define X11R4
133 typedef char *XPointer;
134 #else
135 # undef X11R4
136 #endif
137 
138 #ifndef QT_NO_XFIXES
139 #include <X11/extensions/Xfixes.h>
140 typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *);
141 typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
142 typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);
143 typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask);
144 #endif // QT_NO_XFIXES
145 
146 #ifndef QT_NO_XCURSOR
147 #include <X11/Xcursor/Xcursor.h>
148 typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *);
149 #endif // QT_NO_XCURSOR
150 
151 #ifndef QT_NO_XINERAMA
152 typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base);
153 typedef Bool (*PtrXineramaIsActive)(Display *dpy);
154 typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number);
155 #endif // QT_NO_XINERAMA
156 
157 #ifndef QT_NO_XRANDR
158 typedef void (*PtrXRRSelectInput)(Display *, Window, int);
160 typedef int (*PtrXRRRootToScreen)(Display *, Window);
161 typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *);
162 #endif // QT_NO_XRANDR
163 
164 #ifndef QT_NO_XINPUT
165 typedef int (*PtrXCloseDevice)(Display *, XDevice *);
166 typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *);
167 typedef XDevice* (*PtrXOpenDevice)(Display *, XID);
168 typedef void (*PtrXFreeDeviceList)(XDeviceInfo *);
169 typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int);
170 #endif // QT_NO_XINPUT
171 
172 /*
173  * Solaris patch 108652-47 and higher fixes crases in
174  * XRegisterIMInstantiateCallback, but the function doesn't seem to
175  * work.
176  *
177  * Instead, we disabled R6 input, and open the input method
178  * immediately at application start.
179  */
180 
181 //######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback
182 //######### and XUnregisterIMInstantiateCallback in at least version 3.3.2.
183 //######### Many old X11R6 header files lack XSetIMValues.
184 //######### Therefore, we have to declare these functions ourselves.
185 
186 extern "C" Bool XRegisterIMInstantiateCallback(
187  Display*,
188  struct _XrmHashBucketRec*,
189  char*,
190  char*,
191  XIMProc, //XFree86 has XIDProc, which has to be wrong
192  XPointer
193 );
194 
195 extern "C" Bool XUnregisterIMInstantiateCallback(
196  Display*,
197  struct _XrmHashBucketRec*,
198  char*,
199  char*,
200  XIMProc, //XFree86 has XIDProc, which has to be wrong
201  XPointer
202 );
203 
204 #ifndef X11R4
205 # include <X11/Xlocale.h>
206 #endif // X11R4
207 
208 
209 #ifndef QT_NO_MITSHM
210 # include <X11/extensions/XShm.h>
211 #endif // QT_NO_MITSHM
212 
213 // rename a couple of X defines to get rid of name clashes
214 // resolve the conflict between X11's FocusIn and QEvent::FocusIn
215 enum {
216  XFocusOut = FocusOut,
217  XFocusIn = FocusIn,
218  XKeyPress = KeyPress,
219  XKeyRelease = KeyRelease,
221  XRevertToParent = RevertToParent,
222  XGrayScale = GrayScale,
224 };
225 #undef FocusOut
226 #undef FocusIn
227 #undef KeyPress
228 #undef KeyRelease
229 #undef None
230 #undef RevertToParent
231 #undef GrayScale
232 #undef CursorShape
233 
234 #ifdef FontChange
235 #undef FontChange
236 #endif
237 
238 
240 {
241 public:
242  enum X11Atom {
243  // window-manager <-> client protocols
251 
252  // ICCCM window state
255 
256  // Session management
260 
261  // Clipboard
273 
275 
277 
280 
282 
287 
288  // EWMH (aka NETWM)
292 
295 
299 
301 
303 
313 
317 
334 
336 
339 
341 
343 
345 
347 
348  // Property formats
352 
353  // Xdnd
362 
364 
367 
372 
373  // Motif DND
379 
382 
383  // Xkb
385 
386  // XEMBED
389 
393 
396 
398 
401  };
402 
403  static Atom atom(X11Atom atom);
404  static bool isSupportedByWM(Atom atom);
405 
406  static bool useXFixes();
407  static int xFixesEventBase();
408 
409  #ifndef QT_NO_XFIXES
411  #endif //QT_NO_XFIXES
412 
413  static QImage qimageFromXImage(XImage *xi);
414 
415 
416 };
417 
418 #endif // QTESTLITESTATICINFO_H
static bool isSupportedByWM(Atom atom)
void(* PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name)
Definition: qxlibstatic.h:142
char * XPointer
Definition: qxlibstatic.h:133
int(* PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int)
Definition: qxlibstatic.h:169
Cursor(* PtrXcursorLibraryLoadCursor)(Display *, const char *)
Definition: qxlibstatic.h:148
union _XEvent XEvent
Definition: qwindowdefs.h:116
void(* PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask)
Definition: qxlibstatic.h:143
int(* PtrXRRRootToScreen)(Display *, Window)
Definition: qxlibstatic.h:160
const char * name
Status(* PtrXFixesQueryVersion)(Display *, int *, int *)
Definition: qxlibstatic.h:141
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
#define None
Bool(* PtrXRRQueryExtension)(Display *, int *, int *)
Definition: qxlibstatic.h:161
#define XRegisterIMInstantiateCallback
Definition: qxlibstatic.h:53
static Atom atom(X11Atom atom)
char * XPointer
Definition: qt_x11_p.h:180
void(* PtrXFreeDeviceList)(XDeviceInfo *)
Definition: qxlibstatic.h:168
Bool(* PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base)
Definition: qxlibstatic.h:152
Bool(* PtrXFixesQueryExtension)(Display *, int *, int *)
Definition: qxlibstatic.h:140
struct _XDisplay Display
Definition: qwindowdefs.h:115
Bool(* PtrXineramaIsActive)(Display *dpy)
Definition: qxlibstatic.h:153
CursorShape
Definition: qnamespace.h:1262
static bool useXFixes()
int(* PtrXCloseDevice)(Display *, XDevice *)
Definition: qxlibstatic.h:165
static int xFixesEventBase()
static QImage qimageFromXImage(XImage *xi)
static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput()
#define XUnregisterIMInstantiateCallback
Definition: qxlibstatic.h:54
#define Status
Definition: qcursor_x11.cpp:59
unsigned long XID
Definition: qgtkstyle_p.h:71
int(* PtrXRRUpdateConfiguration)(XEvent *)
Definition: qxlibstatic.h:159
void(* PtrXRRSelectInput)(Display *, Window, int)
Definition: qxlibstatic.h:158