| 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).
|
|---|
| 113 | extern "C" Bool XPanoramiXQueryExtension(
|
|---|
| 114 | Display*,
|
|---|
| 115 | int*,
|
|---|
| 116 | int*
|
|---|
| 117 | );
|
|---|
| 118 | extern "C" Status XPanoramiXQueryVersion(
|
|---|
| 119 | Display*,
|
|---|
| 120 | int*,
|
|---|
| 121 | int*
|
|---|
| 122 | );
|
|---|
| 123 | extern "C" Status XPanoramiXGetState(
|
|---|
| 124 | Display*,
|
|---|
| 125 | Drawable,
|
|---|
| 126 | XPanoramiXInfo*
|
|---|
| 127 | );
|
|---|
| 128 | extern "C" Status XPanoramiXGetScreenCount(
|
|---|
| 129 | Display *,
|
|---|
| 130 | Drawable,
|
|---|
| 131 | XPanoramiXInfo*
|
|---|
| 132 | );
|
|---|
| 133 | extern "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).
|
|---|
| 141 | extern "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
|
|---|
| 165 | typedef 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
|
|---|
| 193 | typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *);
|
|---|
| 194 | typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
|
|---|
| 195 | typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);
|
|---|
| 196 | typedef 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>
|
|---|
| 201 | typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *);
|
|---|
| 202 | #endif // QT_NO_XCURSOR
|
|---|
| 203 |
|
|---|
| 204 | #ifndef QT_NO_XINERAMA
|
|---|
| 205 | typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base);
|
|---|
| 206 | typedef Bool (*PtrXineramaIsActive)(Display *dpy);
|
|---|
| 207 | typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number);
|
|---|
| 208 | #endif // QT_NO_XINERAMA
|
|---|
| 209 |
|
|---|
| 210 | #ifndef QT_NO_XRANDR
|
|---|
| 211 | typedef void (*PtrXRRSelectInput)(Display *, Window, int);
|
|---|
| 212 | typedef int (*PtrXRRUpdateConfiguration)(XEvent *);
|
|---|
| 213 | typedef int (*PtrXRRRootToScreen)(Display *, Window);
|
|---|
| 214 | typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *);
|
|---|
| 215 | #endif // QT_NO_XRANDR
|
|---|
| 216 |
|
|---|
| 217 | #ifndef QT_NO_XINPUT
|
|---|
| 218 | typedef int (*PtrXCloseDevice)(Display *, XDevice *);
|
|---|
| 219 | typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *);
|
|---|
| 220 | typedef XDevice* (*PtrXOpenDevice)(Display *, XID);
|
|---|
| 221 | typedef void (*PtrXFreeDeviceList)(XDeviceInfo *);
|
|---|
| 222 | typedef 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 | */
|
|---|
| 233 | #if !defined(QT_NO_XIM) && (XlibSpecificationRelease >= 6) && \
|
|---|
| 234 | !defined(Q_OS_SOLARIS)
|
|---|
| 235 | #define USE_X11R6_XIM
|
|---|
| 236 |
|
|---|
| 237 | //######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback
|
|---|
| 238 | //######### and XUnregisterIMInstantiateCallback in at least version 3.3.2.
|
|---|
| 239 | //######### Many old X11R6 header files lack XSetIMValues.
|
|---|
| 240 | //######### Therefore, we have to declare these functions ourselves.
|
|---|
| 241 |
|
|---|
| 242 | extern "C" Bool XRegisterIMInstantiateCallback(
|
|---|
| 243 | Display*,
|
|---|
| 244 | struct _XrmHashBucketRec*,
|
|---|
| 245 | char*,
|
|---|
| 246 | char*,
|
|---|
| 247 | XIMProc, //XFree86 has XIDProc, which has to be wrong
|
|---|
| 248 | XPointer
|
|---|
| 249 | );
|
|---|
| 250 |
|
|---|
| 251 | extern "C" Bool XUnregisterIMInstantiateCallback(
|
|---|
| 252 | Display*,
|
|---|
| 253 | struct _XrmHashBucketRec*,
|
|---|
| 254 | char*,
|
|---|
| 255 | char*,
|
|---|
| 256 | XIMProc, //XFree86 has XIDProc, which has to be wrong
|
|---|
| 257 | XPointer
|
|---|
| 258 | );
|
|---|
| 259 |
|
|---|
| 260 | extern "C" char *XSetIMValues(XIM /* im */, ...);
|
|---|
| 261 |
|
|---|
| 262 | #endif
|
|---|
| 263 |
|
|---|
| 264 | #ifndef QT_NO_FONTCONFIG
|
|---|
| 265 | #include <fontconfig/fontconfig.h>
|
|---|
| 266 | #endif
|
|---|
| 267 |
|
|---|
| 268 | #ifndef QT_NO_XIM
|
|---|
| 269 | // some platforms (eg. Solaris 2.51) don't have these defines in Xlib.h
|
|---|
| 270 | #ifndef XNResetState
|
|---|
| 271 | #define XNResetState "resetState"
|
|---|
| 272 | #endif
|
|---|
| 273 | #ifndef XIMPreserveState
|
|---|
| 274 | #define XIMPreserveState (1L<<1)
|
|---|
| 275 | #endif
|
|---|
| 276 | #endif
|
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 | #ifndef X11R4
|
|---|
| 280 | # include <X11/Xlocale.h>
|
|---|
| 281 | #endif // X11R4
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 | #ifndef QT_NO_MITSHM
|
|---|
| 285 | # include <X11/extensions/XShm.h>
|
|---|
| 286 | #endif // QT_NO_MITSHM
|
|---|
| 287 |
|
|---|
| 288 | QT_BEGIN_NAMESPACE
|
|---|
| 289 |
|
|---|
| 290 | class QWidget;
|
|---|
| 291 |
|
|---|
| 292 | struct QX11InfoData {
|
|---|
| 293 | uint ref;
|
|---|
| 294 | int screen;
|
|---|
| 295 | int dpiX;
|
|---|
| 296 | int dpiY;
|
|---|
| 297 | int depth;
|
|---|
| 298 | int cells;
|
|---|
| 299 | Colormap colormap;
|
|---|
| 300 | Visual *visual;
|
|---|
| 301 | bool defaultColormap;
|
|---|
| 302 | bool defaultVisual;
|
|---|
| 303 | int subpixel;
|
|---|
| 304 | };
|
|---|
| 305 |
|
|---|
| 306 | class QDrag;
|
|---|
| 307 | struct QXdndDropTransaction
|
|---|
| 308 | {
|
|---|
| 309 | Time timestamp;
|
|---|
| 310 | Window target;
|
|---|
| 311 | Window proxy_target;
|
|---|
| 312 | QWidget *targetWidget;
|
|---|
| 313 | QWidget *embedding_widget;
|
|---|
| 314 | QDrag *object;
|
|---|
| 315 | };
|
|---|
| 316 |
|
|---|
| 317 | class QMimeData;
|
|---|
| 318 |
|
|---|
| 319 | struct QX11Data;
|
|---|
| 320 | extern QX11Data *qt_x11Data;
|
|---|
| 321 |
|
|---|
| 322 | enum DesktopEnvironment {
|
|---|
| 323 | DE_UNKNOWN,
|
|---|
| 324 | DE_KDE,
|
|---|
| 325 | DE_GNOME,
|
|---|
| 326 | DE_CDE,
|
|---|
| 327 | DE_4DWM
|
|---|
| 328 | };
|
|---|
| 329 |
|
|---|
| 330 | struct QX11Data
|
|---|
| 331 | {
|
|---|
| 332 | static Qt::KeyboardModifiers translateModifiers(int s);
|
|---|
| 333 |
|
|---|
| 334 | Window findClientWindow(Window, Atom, bool);
|
|---|
| 335 |
|
|---|
| 336 | // from qclipboard_x11.cpp
|
|---|
| 337 | bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout);
|
|---|
| 338 | bool clipboardReadProperty(Window win, Atom property, bool deleteProperty,
|
|---|
| 339 | QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm);
|
|---|
| 340 | QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm);
|
|---|
| 341 |
|
|---|
| 342 | // from qdnd_x11.cpp
|
|---|
| 343 | bool dndEnable(QWidget* w, bool on);
|
|---|
| 344 | static void xdndSetup();
|
|---|
| 345 | void xdndHandleEnter(QWidget *, const XEvent *, bool);
|
|---|
| 346 | void xdndHandlePosition(QWidget *, const XEvent *, bool);
|
|---|
| 347 | void xdndHandleStatus(QWidget *, const XEvent *, bool);
|
|---|
| 348 | void xdndHandleLeave(QWidget *, const XEvent *, bool);
|
|---|
| 349 | void xdndHandleDrop(QWidget *, const XEvent *, bool);
|
|---|
| 350 | void xdndHandleFinished(QWidget *, const XEvent *, bool);
|
|---|
| 351 | void xdndHandleSelectionRequest(const XSelectionRequestEvent *);
|
|---|
| 352 | static bool xdndHandleBadwindow();
|
|---|
| 353 | QByteArray xdndAtomToString(Atom a);
|
|---|
| 354 | Atom xdndStringToAtom(const char *);
|
|---|
| 355 |
|
|---|
| 356 | QString xdndMimeAtomToString(Atom a);
|
|---|
| 357 | Atom xdndMimeStringToAtom(const QString &mimeType);
|
|---|
| 358 | QStringList xdndMimeFormatsForAtom(Atom a);
|
|---|
| 359 | bool xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat);
|
|---|
| 360 | QList<Atom> xdndMimeAtomsForFormat(const QString &format);
|
|---|
| 361 | QVariant xdndMimeConvertToFormat(Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding);
|
|---|
| 362 | Atom xdndMimeAtomForFormat(const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding);
|
|---|
| 363 |
|
|---|
| 364 | QList<QXdndDropTransaction> dndDropTransactions;
|
|---|
| 365 |
|
|---|
| 366 | // from qmotifdnd_x11.cpp
|
|---|
| 367 | void motifdndHandle(QWidget *, const XEvent *, bool);
|
|---|
| 368 | void motifdndEnable(QWidget *, bool);
|
|---|
| 369 | QVariant motifdndObtainData(const char *format);
|
|---|
| 370 | QByteArray motifdndFormat(int n);
|
|---|
| 371 | bool motifdnd_active;
|
|---|
| 372 |
|
|---|
| 373 | Display *display;
|
|---|
| 374 | char *displayName;
|
|---|
| 375 | bool foreignDisplay;
|
|---|
| 376 | // current focus model
|
|---|
| 377 | enum {
|
|---|
| 378 | FM_Unknown = -1,
|
|---|
| 379 | FM_Other = 0,
|
|---|
| 380 | FM_PointerRoot = 1
|
|---|
| 381 | };
|
|---|
| 382 | int focus_model;
|
|---|
| 383 |
|
|---|
| 384 | // true if Qt is compiled w/ RANDR support and RANDR is supported on the connected Display
|
|---|
| 385 | bool use_xrandr;
|
|---|
| 386 | int xrandr_major;
|
|---|
| 387 | int xrandr_eventbase;
|
|---|
| 388 | int xrandr_errorbase;
|
|---|
| 389 |
|
|---|
| 390 | // true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display
|
|---|
| 391 | bool use_xrender;
|
|---|
| 392 | int xrender_major;
|
|---|
| 393 | int xrender_version;
|
|---|
| 394 |
|
|---|
| 395 | // true if Qt is compiled w/ XFIXES support and XFIXES is supported on the connected Display
|
|---|
| 396 | bool use_xfixes;
|
|---|
| 397 | int xfixes_major;
|
|---|
| 398 | int xfixes_eventbase;
|
|---|
| 399 | int xfixes_errorbase;
|
|---|
| 400 |
|
|---|
| 401 | #ifndef QT_NO_XFIXES
|
|---|
| 402 | PtrXFixesQueryExtension ptrXFixesQueryExtension;
|
|---|
| 403 | PtrXFixesQueryVersion ptrXFixesQueryVersion;
|
|---|
| 404 | PtrXFixesSetCursorName ptrXFixesSetCursorName;
|
|---|
| 405 | PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput;
|
|---|
| 406 | #endif
|
|---|
| 407 |
|
|---|
| 408 | #ifndef QT_NO_XINPUT
|
|---|
| 409 | PtrXCloseDevice ptrXCloseDevice;
|
|---|
| 410 | PtrXListInputDevices ptrXListInputDevices;
|
|---|
| 411 | PtrXOpenDevice ptrXOpenDevice;
|
|---|
| 412 | PtrXFreeDeviceList ptrXFreeDeviceList;
|
|---|
| 413 | PtrXSelectExtensionEvent ptrXSelectExtensionEvent;
|
|---|
| 414 | #endif // QT_NO_XINPUT
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 | // true if Qt is compiled w/ MIT-SHM support and MIT-SHM is supported on the connected Display
|
|---|
| 418 | bool use_mitshm;
|
|---|
| 419 | int mitshm_major;
|
|---|
| 420 |
|
|---|
| 421 | // true if Qt is compiled w/ Tablet support and we have a tablet.
|
|---|
| 422 | bool use_xinput;
|
|---|
| 423 | int xinput_major;
|
|---|
| 424 | int xinput_eventbase;
|
|---|
| 425 | int xinput_errorbase;
|
|---|
| 426 |
|
|---|
| 427 | QList<QWidget *> deferred_map;
|
|---|
| 428 | struct ScrollInProgress {
|
|---|
| 429 | long id;
|
|---|
| 430 | QWidget* scrolled_widget;
|
|---|
| 431 | int dx, dy;
|
|---|
| 432 | };
|
|---|
| 433 | long sip_serial;
|
|---|
| 434 | QList<ScrollInProgress> sip_list;
|
|---|
| 435 |
|
|---|
| 436 | // window managers list of supported "stuff"
|
|---|
| 437 | Atom *net_supported_list;
|
|---|
| 438 | // list of virtual root windows
|
|---|
| 439 | Window *net_virtual_root_list;
|
|---|
| 440 | // client leader window
|
|---|
| 441 | Window wm_client_leader;
|
|---|
| 442 |
|
|---|
| 443 | QX11InfoData *screens;
|
|---|
| 444 | Visual **argbVisuals;
|
|---|
| 445 | Colormap *argbColormaps;
|
|---|
| 446 | int screenCount;
|
|---|
| 447 | int defaultScreen;
|
|---|
| 448 |
|
|---|
| 449 | Time time;
|
|---|
| 450 | Time userTime;
|
|---|
| 451 |
|
|---|
| 452 | QString default_im;
|
|---|
| 453 |
|
|---|
| 454 | // starts to ignore bad window errors from X
|
|---|
| 455 | static inline void ignoreBadwindow() {
|
|---|
| 456 | qt_x11Data->ignore_badwindow = true;
|
|---|
| 457 | qt_x11Data->seen_badwindow = false;
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | // ends ignoring bad window errors and returns whether an error had happened.
|
|---|
| 461 | static inline bool badwindow() {
|
|---|
| 462 | qt_x11Data->ignore_badwindow = false;
|
|---|
| 463 | return qt_x11Data->seen_badwindow;
|
|---|
| 464 | }
|
|---|
| 465 |
|
|---|
| 466 | bool ignore_badwindow;
|
|---|
| 467 | bool seen_badwindow;
|
|---|
| 468 |
|
|---|
| 469 | // options
|
|---|
| 470 | int visual_class;
|
|---|
| 471 | int visual_id;
|
|---|
| 472 | int color_count;
|
|---|
| 473 | bool custom_cmap;
|
|---|
| 474 |
|
|---|
| 475 | // outside visual/colormap
|
|---|
| 476 | Visual *visual;
|
|---|
| 477 | Colormap colormap;
|
|---|
| 478 |
|
|---|
| 479 | #ifndef QT_NO_XRENDER
|
|---|
| 480 | enum { solid_fill_count = 16 };
|
|---|
| 481 | struct SolidFills {
|
|---|
| 482 | XRenderColor color;
|
|---|
| 483 | int screen;
|
|---|
| 484 | Picture picture;
|
|---|
| 485 | } solid_fills[solid_fill_count];
|
|---|
| 486 | enum { pattern_fill_count = 16 };
|
|---|
| 487 | struct PatternFills {
|
|---|
| 488 | XRenderColor color;
|
|---|
| 489 | XRenderColor bg_color;
|
|---|
| 490 | int screen;
|
|---|
| 491 | int style;
|
|---|
| 492 | bool opaque;
|
|---|
| 493 | Picture picture;
|
|---|
| 494 | } pattern_fills[pattern_fill_count];
|
|---|
| 495 | Picture getSolidFill(int screen, const QColor &c);
|
|---|
| 496 | XRenderColor preMultiply(const QColor &c);
|
|---|
| 497 | #endif
|
|---|
| 498 |
|
|---|
| 499 | bool has_fontconfig;
|
|---|
| 500 | qreal fc_scale;
|
|---|
| 501 | bool fc_antialias;
|
|---|
| 502 | int fc_hint_style;
|
|---|
| 503 |
|
|---|
| 504 | char *startupId;
|
|---|
| 505 | char *originalStartupId;
|
|---|
| 506 |
|
|---|
| 507 | DesktopEnvironment desktopEnvironment;
|
|---|
| 508 |
|
|---|
| 509 | /* Warning: if you modify this list, modify the names of atoms in qapplication_x11.cpp as well! */
|
|---|
| 510 | enum X11Atom {
|
|---|
| 511 | // window-manager <-> client protocols
|
|---|
| 512 | WM_PROTOCOLS,
|
|---|
| 513 | WM_DELETE_WINDOW,
|
|---|
| 514 | WM_TAKE_FOCUS,
|
|---|
| 515 | _NET_WM_PING,
|
|---|
| 516 | _NET_WM_CONTEXT_HELP,
|
|---|
| 517 |
|
|---|
| 518 | // ICCCM window state
|
|---|
| 519 | WM_STATE,
|
|---|
| 520 | WM_CHANGE_STATE,
|
|---|
| 521 |
|
|---|
| 522 | // Session management
|
|---|
| 523 | WM_CLIENT_LEADER,
|
|---|
| 524 | WM_WINDOW_ROLE,
|
|---|
| 525 | SM_CLIENT_ID,
|
|---|
| 526 |
|
|---|
| 527 | // Clipboard
|
|---|
| 528 | CLIPBOARD,
|
|---|
| 529 | INCR,
|
|---|
| 530 | TARGETS,
|
|---|
| 531 | MULTIPLE,
|
|---|
| 532 | TIMESTAMP,
|
|---|
| 533 | CLIP_TEMPORARY,
|
|---|
| 534 | _QT_SELECTION,
|
|---|
| 535 | _QT_CLIPBOARD_SENTINEL,
|
|---|
| 536 | _QT_SELECTION_SENTINEL,
|
|---|
| 537 |
|
|---|
| 538 | RESOURCE_MANAGER,
|
|---|
| 539 |
|
|---|
| 540 | _XSETROOT_ID,
|
|---|
| 541 |
|
|---|
| 542 | _QT_SCROLL_DONE,
|
|---|
| 543 | _QT_INPUT_ENCODING,
|
|---|
| 544 |
|
|---|
| 545 | _MOTIF_WM_HINTS,
|
|---|
| 546 |
|
|---|
| 547 | DTWM_IS_RUNNING,
|
|---|
| 548 | KDE_FULL_SESSION,
|
|---|
| 549 | KWIN_RUNNING,
|
|---|
| 550 | KWM_RUNNING,
|
|---|
| 551 | GNOME_BACKGROUND_PROPERTIES,
|
|---|
| 552 | ENLIGHTENMENT_DESKTOP,
|
|---|
| 553 | _SGI_DESKS_MANAGER,
|
|---|
| 554 |
|
|---|
| 555 | // EWMH (aka NETWM)
|
|---|
| 556 | _NET_SUPPORTED,
|
|---|
| 557 | _NET_VIRTUAL_ROOTS,
|
|---|
| 558 | _NET_WORKAREA,
|
|---|
| 559 |
|
|---|
| 560 | _NET_MOVERESIZE_WINDOW,
|
|---|
| 561 | _NET_WM_MOVERESIZE,
|
|---|
| 562 |
|
|---|
| 563 | _NET_WM_NAME,
|
|---|
| 564 | _NET_WM_ICON_NAME,
|
|---|
| 565 | _NET_WM_ICON,
|
|---|
| 566 |
|
|---|
| 567 | _NET_WM_PID,
|
|---|
| 568 |
|
|---|
| 569 | _NET_WM_WINDOW_OPACITY,
|
|---|
| 570 |
|
|---|
| 571 | _NET_WM_STATE,
|
|---|
| 572 | _NET_WM_STATE_ABOVE,
|
|---|
| 573 | _NET_WM_STATE_BELOW,
|
|---|
| 574 | _NET_WM_STATE_FULLSCREEN,
|
|---|
| 575 | _NET_WM_STATE_MAXIMIZED_HORZ,
|
|---|
| 576 | _NET_WM_STATE_MAXIMIZED_VERT,
|
|---|
| 577 | _NET_WM_STATE_MODAL,
|
|---|
| 578 | _NET_WM_STATE_STAYS_ON_TOP,
|
|---|
| 579 | _NET_WM_STATE_DEMANDS_ATTENTION,
|
|---|
| 580 |
|
|---|
| 581 | _NET_WM_USER_TIME,
|
|---|
| 582 | _NET_WM_USER_TIME_WINDOW,
|
|---|
| 583 | _NET_WM_FULL_PLACEMENT,
|
|---|
| 584 |
|
|---|
| 585 | _NET_WM_WINDOW_TYPE,
|
|---|
| 586 | _NET_WM_WINDOW_TYPE_DESKTOP,
|
|---|
| 587 | _NET_WM_WINDOW_TYPE_DOCK,
|
|---|
| 588 | _NET_WM_WINDOW_TYPE_TOOLBAR,
|
|---|
| 589 | _NET_WM_WINDOW_TYPE_MENU,
|
|---|
| 590 | _NET_WM_WINDOW_TYPE_UTILITY,
|
|---|
| 591 | _NET_WM_WINDOW_TYPE_SPLASH,
|
|---|
| 592 | _NET_WM_WINDOW_TYPE_DIALOG,
|
|---|
| 593 | _NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
|---|
| 594 | _NET_WM_WINDOW_TYPE_POPUP_MENU,
|
|---|
| 595 | _NET_WM_WINDOW_TYPE_TOOLTIP,
|
|---|
| 596 | _NET_WM_WINDOW_TYPE_NOTIFICATION,
|
|---|
| 597 | _NET_WM_WINDOW_TYPE_COMBO,
|
|---|
| 598 | _NET_WM_WINDOW_TYPE_DND,
|
|---|
| 599 | _NET_WM_WINDOW_TYPE_NORMAL,
|
|---|
| 600 | _KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
|
|---|
| 601 |
|
|---|
| 602 | _KDE_NET_WM_FRAME_STRUT,
|
|---|
| 603 |
|
|---|
| 604 | _NET_STARTUP_INFO,
|
|---|
| 605 | _NET_STARTUP_INFO_BEGIN,
|
|---|
| 606 |
|
|---|
| 607 | _NET_SUPPORTING_WM_CHECK,
|
|---|
| 608 |
|
|---|
| 609 | _NET_WM_CM_S0,
|
|---|
| 610 |
|
|---|
| 611 | _NET_SYSTEM_TRAY_VISUAL,
|
|---|
| 612 |
|
|---|
| 613 | // Property formats
|
|---|
| 614 | COMPOUND_TEXT,
|
|---|
| 615 | TEXT,
|
|---|
| 616 | UTF8_STRING,
|
|---|
| 617 |
|
|---|
| 618 | // Xdnd
|
|---|
| 619 | XdndEnter,
|
|---|
| 620 | XdndPosition,
|
|---|
| 621 | XdndStatus,
|
|---|
| 622 | XdndLeave,
|
|---|
| 623 | XdndDrop,
|
|---|
| 624 | XdndFinished,
|
|---|
| 625 | XdndTypelist,
|
|---|
| 626 | XdndActionList,
|
|---|
| 627 |
|
|---|
| 628 | XdndSelection,
|
|---|
| 629 |
|
|---|
| 630 | XdndAware,
|
|---|
| 631 | XdndProxy,
|
|---|
| 632 |
|
|---|
| 633 | XdndActionCopy,
|
|---|
| 634 | XdndActionLink,
|
|---|
| 635 | XdndActionMove,
|
|---|
| 636 | XdndActionPrivate,
|
|---|
| 637 |
|
|---|
| 638 | // Motif DND
|
|---|
| 639 | _MOTIF_DRAG_AND_DROP_MESSAGE,
|
|---|
| 640 | _MOTIF_DRAG_INITIATOR_INFO,
|
|---|
| 641 | _MOTIF_DRAG_RECEIVER_INFO,
|
|---|
| 642 | _MOTIF_DRAG_WINDOW,
|
|---|
| 643 | _MOTIF_DRAG_TARGETS,
|
|---|
| 644 |
|
|---|
| 645 | XmTRANSFER_SUCCESS,
|
|---|
| 646 | XmTRANSFER_FAILURE,
|
|---|
| 647 |
|
|---|
| 648 | // Xkb
|
|---|
| 649 | _XKB_RULES_NAMES,
|
|---|
| 650 |
|
|---|
| 651 | // XEMBED
|
|---|
| 652 | _XEMBED,
|
|---|
| 653 | _XEMBED_INFO,
|
|---|
| 654 |
|
|---|
| 655 | NPredefinedAtoms,
|
|---|
| 656 |
|
|---|
| 657 | _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms,
|
|---|
| 658 | NAtoms
|
|---|
| 659 | };
|
|---|
| 660 | Atom atoms[NAtoms];
|
|---|
| 661 |
|
|---|
| 662 | bool isSupportedByWM(Atom atom);
|
|---|
| 663 |
|
|---|
| 664 | bool compositingManagerRunning;
|
|---|
| 665 |
|
|---|
| 666 | #ifndef QT_NO_XCURSOR
|
|---|
| 667 | PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor;
|
|---|
| 668 | #endif // QT_NO_XCURSOR
|
|---|
| 669 |
|
|---|
| 670 | #ifndef QT_NO_XINERAMA
|
|---|
| 671 | PtrXineramaQueryExtension ptrXineramaQueryExtension;
|
|---|
| 672 | PtrXineramaIsActive ptrXineramaIsActive;
|
|---|
| 673 | PtrXineramaQueryScreens ptrXineramaQueryScreens;
|
|---|
| 674 | #endif // QT_NO_XINERAMA
|
|---|
| 675 |
|
|---|
| 676 | #ifndef QT_NO_XRANDR
|
|---|
| 677 | PtrXRRSelectInput ptrXRRSelectInput;
|
|---|
| 678 | PtrXRRUpdateConfiguration ptrXRRUpdateConfiguration;
|
|---|
| 679 | PtrXRRRootToScreen ptrXRRRootToScreen;
|
|---|
| 680 | PtrXRRQueryExtension ptrXRRQueryExtension;
|
|---|
| 681 | #endif // QT_NO_XRANDR
|
|---|
| 682 | };
|
|---|
| 683 |
|
|---|
| 684 | extern QX11Data *qt_x11Data;
|
|---|
| 685 | #define ATOM(x) qt_x11Data->atoms[QX11Data::x]
|
|---|
| 686 | #define X11 qt_x11Data
|
|---|
| 687 |
|
|---|
| 688 | // rename a couple of X defines to get rid of name clashes
|
|---|
| 689 | // resolve the conflict between X11's FocusIn and QEvent::FocusIn
|
|---|
| 690 | enum {
|
|---|
| 691 | XFocusOut = FocusOut,
|
|---|
| 692 | XFocusIn = FocusIn,
|
|---|
| 693 | XKeyPress = KeyPress,
|
|---|
| 694 | XKeyRelease = KeyRelease,
|
|---|
| 695 | XNone = None,
|
|---|
| 696 | XRevertToParent = RevertToParent,
|
|---|
| 697 | XGrayScale = GrayScale,
|
|---|
| 698 | XCursorShape = CursorShape
|
|---|
| 699 | };
|
|---|
| 700 | #undef FocusOut
|
|---|
| 701 | #undef FocusIn
|
|---|
| 702 | #undef KeyPress
|
|---|
| 703 | #undef KeyRelease
|
|---|
| 704 | #undef None
|
|---|
| 705 | #undef RevertToParent
|
|---|
| 706 | #undef GrayScale
|
|---|
| 707 | #undef CursorShape
|
|---|
| 708 |
|
|---|
| 709 | #ifdef FontChange
|
|---|
| 710 | #undef FontChange
|
|---|
| 711 | #endif
|
|---|
| 712 |
|
|---|
| 713 | Q_DECLARE_TYPEINFO(XPoint, Q_PRIMITIVE_TYPE);
|
|---|
| 714 | Q_DECLARE_TYPEINFO(XRectangle, Q_PRIMITIVE_TYPE);
|
|---|
| 715 | Q_DECLARE_TYPEINFO(XChar2b, Q_PRIMITIVE_TYPE);
|
|---|
| 716 | #ifndef QT_NO_XRENDER
|
|---|
| 717 | Q_DECLARE_TYPEINFO(XGlyphElt32, Q_PRIMITIVE_TYPE);
|
|---|
| 718 | #endif
|
|---|
| 719 |
|
|---|
| 720 |
|
|---|
| 721 | QT_END_NAMESPACE
|
|---|
| 722 |
|
|---|
| 723 | #endif // QT_X11_P_H
|
|---|