1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at qt-info@nokia.com.
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QT_X11_P_H
|
---|
43 | #define QT_X11_P_H
|
---|
44 |
|
---|
45 | //
|
---|
46 | // W A R N I N G
|
---|
47 | // -------------
|
---|
48 | //
|
---|
49 | // This file is not part of the Qt API. It exists purely as an
|
---|
50 | // implementation detail. This header file may change from version to
|
---|
51 | // version without notice, or even be removed.
|
---|
52 | //
|
---|
53 | // We mean it.
|
---|
54 | //
|
---|
55 |
|
---|
56 | #include "QtGui/qwindowdefs.h"
|
---|
57 | #include "QtCore/qlist.h"
|
---|
58 | #include "QtCore/qvariant.h"
|
---|
59 |
|
---|
60 | // the following is necessary to work around breakage in many versions
|
---|
61 | // of XFree86's Xlib.h still in use
|
---|
62 | // ### which versions?
|
---|
63 | #if defined(_XLIB_H_) // crude hack, but...
|
---|
64 | #error "cannot include <X11/Xlib.h> before this file"
|
---|
65 | #endif
|
---|
66 | #define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback
|
---|
67 | #define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback
|
---|
68 | #define XSetIMValues qt_XSetIMValues
|
---|
69 | #include <X11/Xlib.h>
|
---|
70 | #undef XRegisterIMInstantiateCallback
|
---|
71 | #undef XUnregisterIMInstantiateCallback
|
---|
72 | #undef XSetIMValues
|
---|
73 |
|
---|
74 | #include <X11/Xutil.h>
|
---|
75 | #include <X11/Xos.h>
|
---|
76 | #ifdef index
|
---|
77 | # undef index
|
---|
78 | #endif
|
---|
79 | #ifdef rindex
|
---|
80 | # undef rindex
|
---|
81 | #endif
|
---|
82 | #ifdef Q_OS_VXWORS
|
---|
83 | # ifdef open
|
---|
84 | # undef open
|
---|
85 | # endif
|
---|
86 | # ifdef getpid
|
---|
87 | # undef getpid
|
---|
88 | # endif
|
---|
89 | #endif // Q_OS_VXWORKS
|
---|
90 | #include <X11/Xatom.h>
|
---|
91 |
|
---|
92 | //#define QT_NO_SHAPE
|
---|
93 | #ifdef QT_NO_SHAPE
|
---|
94 | # define XShapeCombineRegion(a,b,c,d,e,f,g)
|
---|
95 | # define XShapeCombineMask(a,b,c,d,e,f,g)
|
---|
96 | #else
|
---|
97 | # include <X11/extensions/shape.h>
|
---|
98 | #endif // QT_NO_SHAPE
|
---|
99 |
|
---|
100 |
|
---|
101 | #if !defined (QT_NO_TABLET)
|
---|
102 | # include <X11/extensions/XInput.h>
|
---|
103 | #if defined (Q_OS_IRIX)
|
---|
104 | # include <X11/extensions/SGIMisc.h>
|
---|
105 | # include <wacom.h>
|
---|
106 | #endif
|
---|
107 | #endif // QT_NO_TABLET
|
---|
108 |
|
---|
109 |
|
---|
110 | // #define QT_NO_XINERAMA
|
---|
111 | #ifndef QT_NO_XINERAMA
|
---|
112 | # if 0 // ### Xsun, but how to detect it?
|
---|
113 | // Xinerama is only supported in Solaris 7 with patches 107648/108376 and
|
---|
114 | // Solaris 8 or above which introduce the X11R6.4 Xserver.
|
---|
115 | // To switch the Xinerama functionality on, you need to add the "+xinerama"
|
---|
116 | // argument to the Xsun start line.
|
---|
117 | // At least Solaris 7 and 8 are missing Xinerama system headers and function
|
---|
118 | // declarations (bug 4284701).
|
---|
119 | // The Xinerama API is not documented. In theory it could change but it
|
---|
120 | // probably won't because Sun are using it in at least dtlogin (bug 4221829).
|
---|
121 | extern "C" Bool XPanoramiXQueryExtension(
|
---|
122 | Display*,
|
---|
123 | int*,
|
---|
124 | int*
|
---|
125 | );
|
---|
126 | extern "C" Status XPanoramiXQueryVersion(
|
---|
127 | Display*,
|
---|
128 | int*,
|
---|
129 | int*
|
---|
130 | );
|
---|
131 | extern "C" Status XPanoramiXGetState(
|
---|
132 | Display*,
|
---|
133 | Drawable,
|
---|
134 | XPanoramiXInfo*
|
---|
135 | );
|
---|
136 | extern "C" Status XPanoramiXGetScreenCount(
|
---|
137 | Display *,
|
---|
138 | Drawable,
|
---|
139 | XPanoramiXInfo*
|
---|
140 | );
|
---|
141 | extern "C" Status XPanoramiXGetScreenSize(
|
---|
142 | Display*,
|
---|
143 | Drawable,
|
---|
144 | int,
|
---|
145 | XPanoramiXInfo*
|
---|
146 | );
|
---|
147 | # else // XFree86
|
---|
148 | // XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3).
|
---|
149 | extern "C" {
|
---|
150 | # include <X11/extensions/Xinerama.h>
|
---|
151 | }
|
---|
152 | # endif
|
---|
153 | #endif // QT_NO_XINERAMA
|
---|
154 |
|
---|
155 | // #define QT_NO_XRANDR
|
---|
156 | #ifndef QT_NO_XRANDR
|
---|
157 | # include <X11/extensions/Xrandr.h>
|
---|
158 | #endif // QT_NO_XRANDR
|
---|
159 |
|
---|
160 | // #define QT_NO_XRENDER
|
---|
161 | #ifndef QT_NO_XRENDER
|
---|
162 | # include <X11/extensions/Xrender.h>
|
---|
163 | #endif // QT_NO_XRENDER
|
---|
164 |
|
---|
165 | #ifndef QT_NO_XSYNC
|
---|
166 | extern "C" {
|
---|
167 | # include "X11/extensions/sync.h"
|
---|
168 | }
|
---|
169 | #endif
|
---|
170 |
|
---|
171 | // #define QT_NO_XKB
|
---|
172 | #ifndef QT_NO_XKB
|
---|
173 | # include <X11/XKBlib.h>
|
---|
174 | #endif // QT_NO_XKB
|
---|
175 |
|
---|
176 |
|
---|
177 | #if !defined(XlibSpecificationRelease)
|
---|
178 | # define X11R4
|
---|
179 | typedef char *XPointer;
|
---|
180 | #else
|
---|
181 | # undef X11R4
|
---|
182 | #endif
|
---|
183 |
|
---|
184 | // #define QT_NO_XIM
|
---|
185 | #if defined(X11R4)
|
---|
186 | // X11R4 does not have XIM
|
---|
187 | #define QT_NO_XIM
|
---|
188 | #elif defined(Q_OS_OSF) && (XlibSpecificationRelease < 6)
|
---|
189 | // broken in Xlib up to OSF/1 3.2
|
---|
190 | #define QT_NO_XIM
|
---|
191 | #elif defined(Q_OS_AIX)
|
---|
192 | // broken in Xlib up to what version of AIX?
|
---|
193 | #define QT_NO_XIM
|
---|
194 | #elif defined(QT_NO_DEBUG) && defined(Q_OS_IRIX)
|
---|
195 | // XmbLookupString broken on IRIX
|
---|
196 | // XCreateIC broken when compiling -64 on IRIX 6.5.2
|
---|
197 | #define QT_NO_XIM
|
---|
198 | #elif defined(Q_OS_HPUX) && defined(__LP64__)
|
---|
199 | // XCreateIC broken when compiling 64-bit ELF on HP-UX 11.0
|
---|
200 | #define QT_NO_XIM
|
---|
201 | #elif defined(Q_OS_SCO)
|
---|
202 | // ### suggested by user...
|
---|
203 | // ### #define QT_NO_XIM
|
---|
204 | #endif // QT_NO_XIM
|
---|
205 |
|
---|
206 | #ifndef QT_NO_XFIXES
|
---|
207 | typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *);
|
---|
208 | typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
|
---|
209 | typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);
|
---|
210 | typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask);
|
---|
211 | #endif // QT_NO_XFIXES
|
---|
212 |
|
---|
213 | #ifndef QT_NO_XCURSOR
|
---|
214 | #include <X11/Xcursor/Xcursor.h>
|
---|
215 | typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *);
|
---|
216 | #endif // QT_NO_XCURSOR
|
---|
217 |
|
---|
218 | #ifndef QT_NO_XINERAMA
|
---|
219 | typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base);
|
---|
220 | typedef Bool (*PtrXineramaIsActive)(Display *dpy);
|
---|
221 | typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number);
|
---|
222 | #endif // QT_NO_XINERAMA
|
---|
223 |
|
---|
224 | #ifndef QT_NO_XRANDR
|
---|
225 | typedef void (*PtrXRRSelectInput)(Display *, Window, int);
|
---|
226 | typedef int (*PtrXRRUpdateConfiguration)(XEvent *);
|
---|
227 | typedef int (*PtrXRRRootToScreen)(Display *, Window);
|
---|
228 | typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *);
|
---|
229 | #endif // QT_NO_XRANDR
|
---|
230 |
|
---|
231 | #ifndef QT_NO_XINPUT
|
---|
232 | typedef int (*PtrXCloseDevice)(Display *, XDevice *);
|
---|
233 | typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *);
|
---|
234 | typedef XDevice* (*PtrXOpenDevice)(Display *, XID);
|
---|
235 | typedef void (*PtrXFreeDeviceList)(XDeviceInfo *);
|
---|
236 | typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int);
|
---|
237 | #endif // QT_NO_XINPUT
|
---|
238 |
|
---|
239 | /*
|
---|
240 | * Solaris patch 108652-47 and higher fixes crases in
|
---|
241 | * XRegisterIMInstantiateCallback, but the function doesn't seem to
|
---|
242 | * work.
|
---|
243 | *
|
---|
244 | * Instead, we disabled R6 input, and open the input method
|
---|
245 | * immediately at application start.
|
---|
246 | */
|
---|
247 | #if !defined(QT_NO_XIM) && (XlibSpecificationRelease >= 6) && \
|
---|
248 | !defined(Q_OS_SOLARIS)
|
---|
249 | #define USE_X11R6_XIM
|
---|
250 |
|
---|
251 | //######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback
|
---|
252 | //######### and XUnregisterIMInstantiateCallback in at least version 3.3.2.
|
---|
253 | //######### Many old X11R6 header files lack XSetIMValues.
|
---|
254 | //######### Therefore, we have to declare these functions ourselves.
|
---|
255 |
|
---|
256 | extern "C" Bool XRegisterIMInstantiateCallback(
|
---|
257 | Display*,
|
---|
258 | struct _XrmHashBucketRec*,
|
---|
259 | char*,
|
---|
260 | char*,
|
---|
261 | XIMProc, //XFree86 has XIDProc, which has to be wrong
|
---|
262 | XPointer
|
---|
263 | );
|
---|
264 |
|
---|
265 | extern "C" Bool XUnregisterIMInstantiateCallback(
|
---|
266 | Display*,
|
---|
267 | struct _XrmHashBucketRec*,
|
---|
268 | char*,
|
---|
269 | char*,
|
---|
270 | XIMProc, //XFree86 has XIDProc, which has to be wrong
|
---|
271 | XPointer
|
---|
272 | );
|
---|
273 |
|
---|
274 | extern "C" char *XSetIMValues(XIM /* im */, ...);
|
---|
275 |
|
---|
276 | #endif
|
---|
277 |
|
---|
278 | #ifndef QT_NO_FONTCONFIG
|
---|
279 | #include <fontconfig/fontconfig.h>
|
---|
280 | #endif
|
---|
281 |
|
---|
282 | #ifndef QT_NO_XIM
|
---|
283 | // some platforms (eg. Solaris 2.51) don't have these defines in Xlib.h
|
---|
284 | #ifndef XNResetState
|
---|
285 | #define XNResetState "resetState"
|
---|
286 | #endif
|
---|
287 | #ifndef XIMPreserveState
|
---|
288 | #define XIMPreserveState (1L<<1)
|
---|
289 | #endif
|
---|
290 | #endif
|
---|
291 |
|
---|
292 |
|
---|
293 | #ifndef X11R4
|
---|
294 | # include <X11/Xlocale.h>
|
---|
295 | #endif // X11R4
|
---|
296 |
|
---|
297 |
|
---|
298 | #ifndef QT_NO_MITSHM
|
---|
299 | # include <X11/extensions/XShm.h>
|
---|
300 | #endif // QT_NO_MITSHM
|
---|
301 |
|
---|
302 | QT_BEGIN_NAMESPACE
|
---|
303 |
|
---|
304 | class QWidget;
|
---|
305 |
|
---|
306 | struct QX11InfoData {
|
---|
307 | uint ref;
|
---|
308 | int screen;
|
---|
309 | int dpiX;
|
---|
310 | int dpiY;
|
---|
311 | int depth;
|
---|
312 | int cells;
|
---|
313 | Colormap colormap;
|
---|
314 | Visual *visual;
|
---|
315 | bool defaultColormap;
|
---|
316 | bool defaultVisual;
|
---|
317 | int subpixel;
|
---|
318 | };
|
---|
319 |
|
---|
320 | class QDrag;
|
---|
321 | struct QXdndDropTransaction
|
---|
322 | {
|
---|
323 | Time timestamp;
|
---|
324 | Window target;
|
---|
325 | Window proxy_target;
|
---|
326 | QWidget *targetWidget;
|
---|
327 | QWidget *embedding_widget;
|
---|
328 | QDrag *object;
|
---|
329 | };
|
---|
330 |
|
---|
331 | class QMimeData;
|
---|
332 |
|
---|
333 | struct QX11Data;
|
---|
334 | extern Q_GUI_EXPORT QX11Data *qt_x11Data;
|
---|
335 |
|
---|
336 | enum DesktopEnvironment {
|
---|
337 | DE_UNKNOWN,
|
---|
338 | DE_KDE,
|
---|
339 | DE_GNOME,
|
---|
340 | DE_CDE,
|
---|
341 | DE_MEEGO_COMPOSITOR,
|
---|
342 | DE_4DWM
|
---|
343 | };
|
---|
344 |
|
---|
345 | struct QX11Data
|
---|
346 | {
|
---|
347 | static Qt::KeyboardModifiers translateModifiers(int s);
|
---|
348 |
|
---|
349 | Window findClientWindow(Window, Atom, bool);
|
---|
350 |
|
---|
351 | // from qclipboard_x11.cpp
|
---|
352 | bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout);
|
---|
353 | bool clipboardReadProperty(Window win, Atom property, bool deleteProperty,
|
---|
354 | QByteArray *buffer, int *size, Atom *type, int *format);
|
---|
355 | QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm);
|
---|
356 |
|
---|
357 | // from qdnd_x11.cpp
|
---|
358 | bool dndEnable(QWidget* w, bool on);
|
---|
359 | static void xdndSetup();
|
---|
360 | void xdndHandleEnter(QWidget *, const XEvent *, bool);
|
---|
361 | void xdndHandlePosition(QWidget *, const XEvent *, bool);
|
---|
362 | void xdndHandleStatus(QWidget *, const XEvent *, bool);
|
---|
363 | void xdndHandleLeave(QWidget *, const XEvent *, bool);
|
---|
364 | void xdndHandleDrop(QWidget *, const XEvent *, bool);
|
---|
365 | void xdndHandleFinished(QWidget *, const XEvent *, bool);
|
---|
366 | void xdndHandleSelectionRequest(const XSelectionRequestEvent *);
|
---|
367 | static bool xdndHandleBadwindow();
|
---|
368 | QByteArray xdndAtomToString(Atom a);
|
---|
369 | Atom xdndStringToAtom(const char *);
|
---|
370 |
|
---|
371 | QString xdndMimeAtomToString(Atom a);
|
---|
372 | Atom xdndMimeStringToAtom(const QString &mimeType);
|
---|
373 | QStringList xdndMimeFormatsForAtom(Atom a);
|
---|
374 | bool xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat);
|
---|
375 | QList<Atom> xdndMimeAtomsForFormat(const QString &format);
|
---|
376 | QVariant xdndMimeConvertToFormat(Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding);
|
---|
377 | Atom xdndMimeAtomForFormat(const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding);
|
---|
378 |
|
---|
379 | QList<QXdndDropTransaction> dndDropTransactions;
|
---|
380 |
|
---|
381 | // from qmotifdnd_x11.cpp
|
---|
382 | void motifdndHandle(QWidget *, const XEvent *, bool);
|
---|
383 | void motifdndEnable(QWidget *, bool);
|
---|
384 | QVariant motifdndObtainData(const char *format);
|
---|
385 | QByteArray motifdndFormat(int n);
|
---|
386 | bool motifdnd_active;
|
---|
387 |
|
---|
388 | Display *display;
|
---|
389 | char *displayName;
|
---|
390 | bool foreignDisplay;
|
---|
391 | // current focus model
|
---|
392 | enum {
|
---|
393 | FM_Unknown = -1,
|
---|
394 | FM_Other = 0,
|
---|
395 | FM_PointerRoot = 1
|
---|
396 | };
|
---|
397 | int focus_model;
|
---|
398 |
|
---|
399 | // true if Qt is compiled w/ RANDR support and RANDR is supported on the connected Display
|
---|
400 | bool use_xrandr;
|
---|
401 | int xrandr_major;
|
---|
402 | int xrandr_eventbase;
|
---|
403 | int xrandr_errorbase;
|
---|
404 |
|
---|
405 | // true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display
|
---|
406 | bool use_xrender;
|
---|
407 | int xrender_major;
|
---|
408 | int xrender_version;
|
---|
409 |
|
---|
410 | // true if Qt is compiled w/ XFIXES support and XFIXES is supported on the connected Display
|
---|
411 | bool use_xfixes;
|
---|
412 | int xfixes_major;
|
---|
413 | int xfixes_eventbase;
|
---|
414 | int xfixes_errorbase;
|
---|
415 |
|
---|
416 | #ifndef QT_NO_XFIXES
|
---|
417 | PtrXFixesQueryExtension ptrXFixesQueryExtension;
|
---|
418 | PtrXFixesQueryVersion ptrXFixesQueryVersion;
|
---|
419 | PtrXFixesSetCursorName ptrXFixesSetCursorName;
|
---|
420 | PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput;
|
---|
421 | #endif
|
---|
422 |
|
---|
423 | #ifndef QT_NO_XINPUT
|
---|
424 | PtrXCloseDevice ptrXCloseDevice;
|
---|
425 | PtrXListInputDevices ptrXListInputDevices;
|
---|
426 | PtrXOpenDevice ptrXOpenDevice;
|
---|
427 | PtrXFreeDeviceList ptrXFreeDeviceList;
|
---|
428 | PtrXSelectExtensionEvent ptrXSelectExtensionEvent;
|
---|
429 | #endif // QT_NO_XINPUT
|
---|
430 |
|
---|
431 |
|
---|
432 | // true if Qt is compiled w/ MIT-SHM support and MIT-SHM is supported on the connected Display
|
---|
433 | bool use_mitshm;
|
---|
434 | bool use_mitshm_pixmaps;
|
---|
435 | int mitshm_major;
|
---|
436 |
|
---|
437 | // true if Qt is compiled w/ Tablet support and we have a tablet.
|
---|
438 | bool use_xinput;
|
---|
439 | int xinput_major;
|
---|
440 | int xinput_eventbase;
|
---|
441 | int xinput_errorbase;
|
---|
442 |
|
---|
443 | // for XKEYBOARD support
|
---|
444 | bool use_xkb;
|
---|
445 | int xkb_major;
|
---|
446 | int xkb_eventbase;
|
---|
447 | int xkb_errorbase;
|
---|
448 |
|
---|
449 | QList<QWidget *> deferred_map;
|
---|
450 | struct ScrollInProgress {
|
---|
451 | long id;
|
---|
452 | QWidget* scrolled_widget;
|
---|
453 | int dx, dy;
|
---|
454 | };
|
---|
455 | long sip_serial;
|
---|
456 | QList<ScrollInProgress> sip_list;
|
---|
457 |
|
---|
458 | // window managers list of supported "stuff"
|
---|
459 | Atom *net_supported_list;
|
---|
460 | // list of virtual root windows
|
---|
461 | Window *net_virtual_root_list;
|
---|
462 | // client leader window
|
---|
463 | Window wm_client_leader;
|
---|
464 |
|
---|
465 | QX11InfoData *screens;
|
---|
466 | Visual **argbVisuals;
|
---|
467 | Colormap *argbColormaps;
|
---|
468 | int screenCount;
|
---|
469 | int defaultScreen;
|
---|
470 |
|
---|
471 | Time time;
|
---|
472 | Time userTime;
|
---|
473 |
|
---|
474 | QString default_im;
|
---|
475 |
|
---|
476 | // starts to ignore bad window errors from X
|
---|
477 | static inline void ignoreBadwindow() {
|
---|
478 | qt_x11Data->ignore_badwindow = true;
|
---|
479 | qt_x11Data->seen_badwindow = false;
|
---|
480 | }
|
---|
481 |
|
---|
482 | // ends ignoring bad window errors and returns whether an error had happened.
|
---|
483 | static inline bool badwindow() {
|
---|
484 | qt_x11Data->ignore_badwindow = false;
|
---|
485 | return qt_x11Data->seen_badwindow;
|
---|
486 | }
|
---|
487 |
|
---|
488 | bool ignore_badwindow;
|
---|
489 | bool seen_badwindow;
|
---|
490 |
|
---|
491 | // options
|
---|
492 | int visual_class;
|
---|
493 | int visual_id;
|
---|
494 | int color_count;
|
---|
495 | bool custom_cmap;
|
---|
496 |
|
---|
497 | // outside visual/colormap
|
---|
498 | Visual *visual;
|
---|
499 | Colormap colormap;
|
---|
500 |
|
---|
501 | #ifndef QT_NO_XRENDER
|
---|
502 | enum { solid_fill_count = 16 };
|
---|
503 | struct SolidFills {
|
---|
504 | XRenderColor color;
|
---|
505 | int screen;
|
---|
506 | Picture picture;
|
---|
507 | } solid_fills[solid_fill_count];
|
---|
508 | enum { pattern_fill_count = 16 };
|
---|
509 | struct PatternFills {
|
---|
510 | XRenderColor color;
|
---|
511 | XRenderColor bg_color;
|
---|
512 | int screen;
|
---|
513 | int style;
|
---|
514 | bool opaque;
|
---|
515 | Picture picture;
|
---|
516 | } pattern_fills[pattern_fill_count];
|
---|
517 | Picture getSolidFill(int screen, const QColor &c);
|
---|
518 | XRenderColor preMultiply(const QColor &c);
|
---|
519 | #endif
|
---|
520 |
|
---|
521 | bool has_fontconfig;
|
---|
522 | qreal fc_scale;
|
---|
523 | bool fc_antialias;
|
---|
524 | int fc_hint_style;
|
---|
525 |
|
---|
526 | char *startupId;
|
---|
527 |
|
---|
528 | DesktopEnvironment desktopEnvironment : 8;
|
---|
529 | uint desktopVersion : 8; /* Used only for KDE */
|
---|
530 |
|
---|
531 | /* Warning: if you modify this list, modify the names of atoms in qapplication_x11.cpp as well! */
|
---|
532 | enum X11Atom {
|
---|
533 | // window-manager <-> client protocols
|
---|
534 | WM_PROTOCOLS,
|
---|
535 | WM_DELETE_WINDOW,
|
---|
536 | WM_TAKE_FOCUS,
|
---|
537 | _NET_WM_PING,
|
---|
538 | _NET_WM_CONTEXT_HELP,
|
---|
539 | _NET_WM_SYNC_REQUEST,
|
---|
540 | _NET_WM_SYNC_REQUEST_COUNTER,
|
---|
541 |
|
---|
542 | // ICCCM window state
|
---|
543 | WM_STATE,
|
---|
544 | WM_CHANGE_STATE,
|
---|
545 |
|
---|
546 | // Session management
|
---|
547 | WM_CLIENT_LEADER,
|
---|
548 | WM_WINDOW_ROLE,
|
---|
549 | SM_CLIENT_ID,
|
---|
550 |
|
---|
551 | // Clipboard
|
---|
552 | CLIPBOARD,
|
---|
553 | INCR,
|
---|
554 | TARGETS,
|
---|
555 | MULTIPLE,
|
---|
556 | TIMESTAMP,
|
---|
557 | SAVE_TARGETS,
|
---|
558 | CLIP_TEMPORARY,
|
---|
559 | _QT_SELECTION,
|
---|
560 | _QT_CLIPBOARD_SENTINEL,
|
---|
561 | _QT_SELECTION_SENTINEL,
|
---|
562 | CLIPBOARD_MANAGER,
|
---|
563 |
|
---|
564 | RESOURCE_MANAGER,
|
---|
565 |
|
---|
566 | _XSETROOT_ID,
|
---|
567 |
|
---|
568 | _QT_SCROLL_DONE,
|
---|
569 | _QT_INPUT_ENCODING,
|
---|
570 |
|
---|
571 | _MOTIF_WM_HINTS,
|
---|
572 |
|
---|
573 | DTWM_IS_RUNNING,
|
---|
574 | ENLIGHTENMENT_DESKTOP,
|
---|
575 | _DT_SAVE_MODE,
|
---|
576 | _SGI_DESKS_MANAGER,
|
---|
577 |
|
---|
578 | // EWMH (aka NETWM)
|
---|
579 | _NET_SUPPORTED,
|
---|
580 | _NET_VIRTUAL_ROOTS,
|
---|
581 | _NET_WORKAREA,
|
---|
582 |
|
---|
583 | _NET_MOVERESIZE_WINDOW,
|
---|
584 | _NET_WM_MOVERESIZE,
|
---|
585 |
|
---|
586 | _NET_WM_NAME,
|
---|
587 | _NET_WM_ICON_NAME,
|
---|
588 | _NET_WM_ICON,
|
---|
589 |
|
---|
590 | _NET_WM_PID,
|
---|
591 |
|
---|
592 | _NET_WM_WINDOW_OPACITY,
|
---|
593 |
|
---|
594 | _NET_WM_STATE,
|
---|
595 | _NET_WM_STATE_ABOVE,
|
---|
596 | _NET_WM_STATE_BELOW,
|
---|
597 | _NET_WM_STATE_FULLSCREEN,
|
---|
598 | _NET_WM_STATE_MAXIMIZED_HORZ,
|
---|
599 | _NET_WM_STATE_MAXIMIZED_VERT,
|
---|
600 | _NET_WM_STATE_MODAL,
|
---|
601 | _NET_WM_STATE_STAYS_ON_TOP,
|
---|
602 | _NET_WM_STATE_DEMANDS_ATTENTION,
|
---|
603 |
|
---|
604 | _NET_WM_USER_TIME,
|
---|
605 | _NET_WM_USER_TIME_WINDOW,
|
---|
606 | _NET_WM_FULL_PLACEMENT,
|
---|
607 |
|
---|
608 | _NET_WM_WINDOW_TYPE,
|
---|
609 | _NET_WM_WINDOW_TYPE_DESKTOP,
|
---|
610 | _NET_WM_WINDOW_TYPE_DOCK,
|
---|
611 | _NET_WM_WINDOW_TYPE_TOOLBAR,
|
---|
612 | _NET_WM_WINDOW_TYPE_MENU,
|
---|
613 | _NET_WM_WINDOW_TYPE_UTILITY,
|
---|
614 | _NET_WM_WINDOW_TYPE_SPLASH,
|
---|
615 | _NET_WM_WINDOW_TYPE_DIALOG,
|
---|
616 | _NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
---|
617 | _NET_WM_WINDOW_TYPE_POPUP_MENU,
|
---|
618 | _NET_WM_WINDOW_TYPE_TOOLTIP,
|
---|
619 | _NET_WM_WINDOW_TYPE_NOTIFICATION,
|
---|
620 | _NET_WM_WINDOW_TYPE_COMBO,
|
---|
621 | _NET_WM_WINDOW_TYPE_DND,
|
---|
622 | _NET_WM_WINDOW_TYPE_NORMAL,
|
---|
623 | _KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
|
---|
624 |
|
---|
625 | _KDE_NET_WM_FRAME_STRUT,
|
---|
626 |
|
---|
627 | _NET_STARTUP_INFO,
|
---|
628 | _NET_STARTUP_INFO_BEGIN,
|
---|
629 |
|
---|
630 | _NET_SUPPORTING_WM_CHECK,
|
---|
631 |
|
---|
632 | _NET_WM_CM_S0,
|
---|
633 |
|
---|
634 | _NET_SYSTEM_TRAY_VISUAL,
|
---|
635 |
|
---|
636 | _NET_ACTIVE_WINDOW,
|
---|
637 |
|
---|
638 | // Property formats
|
---|
639 | COMPOUND_TEXT,
|
---|
640 | TEXT,
|
---|
641 | UTF8_STRING,
|
---|
642 |
|
---|
643 | // Xdnd
|
---|
644 | XdndEnter,
|
---|
645 | XdndPosition,
|
---|
646 | XdndStatus,
|
---|
647 | XdndLeave,
|
---|
648 | XdndDrop,
|
---|
649 | XdndFinished,
|
---|
650 | XdndTypelist,
|
---|
651 | XdndActionList,
|
---|
652 |
|
---|
653 | XdndSelection,
|
---|
654 |
|
---|
655 | XdndAware,
|
---|
656 | XdndProxy,
|
---|
657 |
|
---|
658 | XdndActionCopy,
|
---|
659 | XdndActionLink,
|
---|
660 | XdndActionMove,
|
---|
661 | XdndActionPrivate,
|
---|
662 |
|
---|
663 | // Motif DND
|
---|
664 | _MOTIF_DRAG_AND_DROP_MESSAGE,
|
---|
665 | _MOTIF_DRAG_INITIATOR_INFO,
|
---|
666 | _MOTIF_DRAG_RECEIVER_INFO,
|
---|
667 | _MOTIF_DRAG_WINDOW,
|
---|
668 | _MOTIF_DRAG_TARGETS,
|
---|
669 |
|
---|
670 | XmTRANSFER_SUCCESS,
|
---|
671 | XmTRANSFER_FAILURE,
|
---|
672 |
|
---|
673 | // Xkb
|
---|
674 | _XKB_RULES_NAMES,
|
---|
675 |
|
---|
676 | // XEMBED
|
---|
677 | _XEMBED,
|
---|
678 | _XEMBED_INFO,
|
---|
679 |
|
---|
680 | XWacomStylus,
|
---|
681 | XWacomCursor,
|
---|
682 | XWacomEraser,
|
---|
683 |
|
---|
684 | XTabletStylus,
|
---|
685 | XTabletEraser,
|
---|
686 |
|
---|
687 | NPredefinedAtoms,
|
---|
688 |
|
---|
689 | _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms,
|
---|
690 | NAtoms
|
---|
691 | };
|
---|
692 | Atom atoms[NAtoms];
|
---|
693 |
|
---|
694 | bool isSupportedByWM(Atom atom);
|
---|
695 |
|
---|
696 | bool compositingManagerRunning;
|
---|
697 |
|
---|
698 | #ifndef QT_NO_XCURSOR
|
---|
699 | PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor;
|
---|
700 | #endif // QT_NO_XCURSOR
|
---|
701 |
|
---|
702 | #ifndef QT_NO_XINERAMA
|
---|
703 | PtrXineramaQueryExtension ptrXineramaQueryExtension;
|
---|
704 | PtrXineramaIsActive ptrXineramaIsActive;
|
---|
705 | PtrXineramaQueryScreens ptrXineramaQueryScreens;
|
---|
706 | #endif // QT_NO_XINERAMA
|
---|
707 |
|
---|
708 | #ifndef QT_NO_XRANDR
|
---|
709 | PtrXRRSelectInput ptrXRRSelectInput;
|
---|
710 | PtrXRRUpdateConfiguration ptrXRRUpdateConfiguration;
|
---|
711 | PtrXRRRootToScreen ptrXRRRootToScreen;
|
---|
712 | PtrXRRQueryExtension ptrXRRQueryExtension;
|
---|
713 | #endif // QT_NO_XRANDR
|
---|
714 | };
|
---|
715 |
|
---|
716 | extern QX11Data *qt_x11Data;
|
---|
717 | #define ATOM(x) qt_x11Data->atoms[QX11Data::x]
|
---|
718 | #define X11 qt_x11Data
|
---|
719 |
|
---|
720 | // rename a couple of X defines to get rid of name clashes
|
---|
721 | // resolve the conflict between X11's FocusIn and QEvent::FocusIn
|
---|
722 | enum {
|
---|
723 | XFocusOut = FocusOut,
|
---|
724 | XFocusIn = FocusIn,
|
---|
725 | XKeyPress = KeyPress,
|
---|
726 | XKeyRelease = KeyRelease,
|
---|
727 | XNone = None,
|
---|
728 | XRevertToParent = RevertToParent,
|
---|
729 | XGrayScale = GrayScale,
|
---|
730 | XCursorShape = CursorShape
|
---|
731 | };
|
---|
732 | #undef FocusOut
|
---|
733 | #undef FocusIn
|
---|
734 | #undef KeyPress
|
---|
735 | #undef KeyRelease
|
---|
736 | #undef None
|
---|
737 | #undef RevertToParent
|
---|
738 | #undef GrayScale
|
---|
739 | #undef CursorShape
|
---|
740 |
|
---|
741 | #ifdef FontChange
|
---|
742 | #undef FontChange
|
---|
743 | #endif
|
---|
744 |
|
---|
745 | Q_DECLARE_TYPEINFO(XPoint, Q_PRIMITIVE_TYPE);
|
---|
746 | Q_DECLARE_TYPEINFO(XRectangle, Q_PRIMITIVE_TYPE);
|
---|
747 | Q_DECLARE_TYPEINFO(XChar2b, Q_PRIMITIVE_TYPE);
|
---|
748 | #ifndef QT_NO_XRENDER
|
---|
749 | Q_DECLARE_TYPEINFO(XGlyphElt32, Q_PRIMITIVE_TYPE);
|
---|
750 | #endif
|
---|
751 |
|
---|
752 |
|
---|
753 | QT_END_NAMESPACE
|
---|
754 |
|
---|
755 | #endif // QT_X11_P_H
|
---|