source: trunk/src/gui/kernel/qt_x11_p.h@ 331

Last change on this file since 331 was 2, checked in by Dmitry A. Kuminov, 17 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 19.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** 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 are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
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#include <X11/Xatom.h>
83
84//#define QT_NO_SHAPE
85#ifdef QT_NO_SHAPE
86# define XShapeCombineRegion(a,b,c,d,e,f,g)
87# define XShapeCombineMask(a,b,c,d,e,f,g)
88#else
89# include <X11/extensions/shape.h>
90#endif // QT_NO_SHAPE
91
92
93#if !defined (QT_NO_TABLET)
94# include <X11/extensions/XInput.h>
95#if defined (Q_OS_IRIX)
96# include <X11/extensions/SGIMisc.h>
97# include <wacom.h>
98#endif
99#endif // QT_NO_TABLET
100
101
102// #define QT_NO_XINERAMA
103#ifndef QT_NO_XINERAMA
104# if 0 // ### Xsun, but how to detect it?
105// Xinerama is only supported in Solaris 7 with patches 107648/108376 and
106// Solaris 8 or above which introduce the X11R6.4 Xserver.
107// To switch the Xinerama functionality on, you need to add the "+xinerama"
108// argument to the Xsun start line.
109// At least Solaris 7 and 8 are missing Xinerama system headers and function
110// declarations (bug 4284701).
111// The Xinerama API is not documented. In theory it could change but it
112// probably won't because Sun are using it in at least dtlogin (bug 4221829).
113extern "C" Bool XPanoramiXQueryExtension(
114 Display*,
115 int*,
116 int*
117);
118extern "C" Status XPanoramiXQueryVersion(
119 Display*,
120 int*,
121 int*
122);
123extern "C" Status XPanoramiXGetState(
124 Display*,
125 Drawable,
126 XPanoramiXInfo*
127);
128extern "C" Status XPanoramiXGetScreenCount(
129 Display *,
130 Drawable,
131 XPanoramiXInfo*
132);
133extern "C" Status XPanoramiXGetScreenSize(
134 Display*,
135 Drawable,
136 int,
137 XPanoramiXInfo*
138);
139# else // XFree86
140// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3).
141extern "C" {
142# include <X11/extensions/Xinerama.h>
143}
144# endif
145#endif // QT_NO_XINERAMA
146
147// #define QT_NO_XRANDR
148#ifndef QT_NO_XRANDR
149# include <X11/extensions/Xrandr.h>
150#endif // QT_NO_XRANDR
151
152// #define QT_NO_XRENDER
153#ifndef QT_NO_XRENDER
154# include <X11/extensions/Xrender.h>
155#endif // QT_NO_XRENDER
156
157// #define QT_NO_XKB
158#ifndef QT_NO_XKB
159# include <X11/XKBlib.h>
160#endif // QT_NO_XKB
161
162
163#if !defined(XlibSpecificationRelease)
164# define X11R4
165typedef char *XPointer;
166#else
167# undef X11R4
168#endif
169
170// #define QT_NO_XIM
171#if defined(X11R4)
172// X11R4 does not have XIM
173#define QT_NO_XIM
174#elif defined(Q_OS_OSF) && (XlibSpecificationRelease < 6)
175// broken in Xlib up to OSF/1 3.2
176#define QT_NO_XIM
177#elif defined(Q_OS_AIX)
178// broken in Xlib up to what version of AIX?
179#define QT_NO_XIM
180#elif defined(QT_NO_DEBUG) && defined(Q_OS_IRIX)
181// XmbLookupString broken on IRIX
182// XCreateIC broken when compiling -64 on IRIX 6.5.2
183#define QT_NO_XIM
184#elif defined(Q_OS_HPUX) && defined(__LP64__)
185// XCreateIC broken when compiling 64-bit ELF on HP-UX 11.0
186#define QT_NO_XIM
187#elif defined(Q_OS_SCO)
188// ### suggested by user...
189// ### #define QT_NO_XIM
190#endif // QT_NO_XIM
191
192#ifndef QT_NO_XFIXES
193typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *);
194typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
195typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);
196typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask);
197#endif // QT_NO_XFIXES
198
199#ifndef QT_NO_XCURSOR
200#include <X11/Xcursor/Xcursor.h>
201typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *);
202#endif // QT_NO_XCURSOR
203
204#ifndef QT_NO_XINERAMA
205typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base);
206typedef Bool (*PtrXineramaIsActive)(Display *dpy);
207typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number);
208#endif // QT_NO_XINERAMA
209
210#ifndef QT_NO_XRANDR
211typedef void (*PtrXRRSelectInput)(Display *, Window, int);
212typedef int (*PtrXRRUpdateConfiguration)(XEvent *);
213typedef int (*PtrXRRRootToScreen)(Display *, Window);
214typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *);
215#endif // QT_NO_XRANDR
216
217#ifndef QT_NO_XINPUT
218typedef int (*PtrXCloseDevice)(Display *, XDevice *);
219typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *);
220typedef XDevice* (*PtrXOpenDevice)(Display *, XID);
221typedef void (*PtrXFreeDeviceList)(XDeviceInfo *);
222typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int);
223#endif // QT_NO_XINPUT
224
225/*
226 * Solaris patch 108652-47 and higher fixes crases in
227 * XRegisterIMInstantiateCallback, but the function doesn't seem to
228 * work.
229 *
230 * Instead, we disabled R6 input, and open the input method
231 * immediately at application start.
232 */