util/src/gui/kernel/qt_x11_p.h
changeset 7 f7bc934e204c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 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 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    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 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    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 QX11Data *qt_x11Data;
       
   335 
       
   336 enum DesktopEnvironment {
       
   337     DE_UNKNOWN,
       
   338     DE_KDE,
       
   339     DE_GNOME,
       
   340     DE_CDE,
       
   341     DE_4DWM
       
   342 };
       
   343 
       
   344 struct QX11Data
       
   345 {
       
   346     static Qt::KeyboardModifiers translateModifiers(int s);
       
   347 
       
   348     Window findClientWindow(Window, Atom, bool);
       
   349 
       
   350     // from qclipboard_x11.cpp
       
   351     bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout);
       
   352     bool clipboardReadProperty(Window win, Atom property, bool deleteProperty,
       
   353                             QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm);
       
   354     QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm);
       
   355 
       
   356     // from qdnd_x11.cpp
       
   357     bool dndEnable(QWidget* w, bool on);
       
   358     static void xdndSetup();
       
   359     void xdndHandleEnter(QWidget *, const XEvent *, bool);
       
   360     void xdndHandlePosition(QWidget *, const XEvent *, bool);
       
   361     void xdndHandleStatus(QWidget *, const XEvent *, bool);
       
   362     void xdndHandleLeave(QWidget *, const XEvent *, bool);
       
   363     void xdndHandleDrop(QWidget *, const XEvent *, bool);
       
   364     void xdndHandleFinished(QWidget *, const XEvent *, bool);
       
   365     void xdndHandleSelectionRequest(const XSelectionRequestEvent *);
       
   366     static bool xdndHandleBadwindow();
       
   367     QByteArray xdndAtomToString(Atom a);
       
   368     Atom xdndStringToAtom(const char *);
       
   369 
       
   370     QString xdndMimeAtomToString(Atom a);
       
   371     Atom xdndMimeStringToAtom(const QString &mimeType);
       
   372     QStringList xdndMimeFormatsForAtom(Atom a);
       
   373     bool xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat);
       
   374     QList<Atom> xdndMimeAtomsForFormat(const QString &format);
       
   375     QVariant xdndMimeConvertToFormat(Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding);
       
   376     Atom xdndMimeAtomForFormat(const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding);
       
   377 
       
   378     QList<QXdndDropTransaction> dndDropTransactions;
       
   379 
       
   380     // from qmotifdnd_x11.cpp
       
   381     void motifdndHandle(QWidget *, const XEvent *, bool);
       
   382     void motifdndEnable(QWidget *, bool);
       
   383     QVariant motifdndObtainData(const char *format);
       
   384     QByteArray motifdndFormat(int n);
       
   385     bool motifdnd_active;
       
   386 
       
   387     Display *display;
       
   388     char *displayName;
       
   389     bool foreignDisplay;
       
   390     // current focus model
       
   391     enum {
       
   392         FM_Unknown = -1,
       
   393         FM_Other = 0,
       
   394         FM_PointerRoot = 1
       
   395     };
       
   396     int focus_model;
       
   397 
       
   398     // true if Qt is compiled w/ RANDR support and RANDR is supported on the connected Display
       
   399     bool use_xrandr;
       
   400     int xrandr_major;
       
   401     int xrandr_eventbase;
       
   402     int xrandr_errorbase;
       
   403 
       
   404     // true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display
       
   405     bool use_xrender;
       
   406     int xrender_major;
       
   407     int xrender_version;
       
   408 
       
   409     // true if Qt is compiled w/ XFIXES support and XFIXES is supported on the connected Display
       
   410     bool use_xfixes;
       
   411     int xfixes_major;
       
   412     int xfixes_eventbase;
       
   413     int xfixes_errorbase;
       
   414 
       
   415 #ifndef QT_NO_XFIXES
       
   416     PtrXFixesQueryExtension ptrXFixesQueryExtension;
       
   417     PtrXFixesQueryVersion ptrXFixesQueryVersion;
       
   418     PtrXFixesSetCursorName ptrXFixesSetCursorName;
       
   419     PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput;
       
   420 #endif
       
   421 
       
   422 #ifndef QT_NO_XINPUT
       
   423     PtrXCloseDevice ptrXCloseDevice;
       
   424     PtrXListInputDevices ptrXListInputDevices;
       
   425     PtrXOpenDevice ptrXOpenDevice;
       
   426     PtrXFreeDeviceList ptrXFreeDeviceList;
       
   427     PtrXSelectExtensionEvent ptrXSelectExtensionEvent;
       
   428 #endif // QT_NO_XINPUT
       
   429 
       
   430 
       
   431     // true if Qt is compiled w/ MIT-SHM support and MIT-SHM is supported on the connected Display
       
   432     bool use_mitshm;
       
   433     bool use_mitshm_pixmaps;
       
   434     int mitshm_major;
       
   435 
       
   436     // true if Qt is compiled w/ Tablet support and we have a tablet.
       
   437     bool use_xinput;
       
   438     int xinput_major;
       
   439     int xinput_eventbase;
       
   440     int xinput_errorbase;
       
   441 
       
   442     QList<QWidget *> deferred_map;
       
   443     struct ScrollInProgress {
       
   444         long id;
       
   445         QWidget* scrolled_widget;
       
   446         int dx, dy;
       
   447     };
       
   448     long sip_serial;
       
   449     QList<ScrollInProgress> sip_list;
       
   450 
       
   451     // window managers list of supported "stuff"
       
   452     Atom *net_supported_list;
       
   453     // list of virtual root windows
       
   454     Window *net_virtual_root_list;
       
   455     // client leader window
       
   456     Window wm_client_leader;
       
   457 
       
   458     QX11InfoData *screens;
       
   459     Visual **argbVisuals;
       
   460     Colormap *argbColormaps;
       
   461     int screenCount;
       
   462     int defaultScreen;
       
   463 
       
   464     Time time;
       
   465     Time userTime;
       
   466 
       
   467     QString default_im;
       
   468 
       
   469     // starts to ignore bad window errors from X
       
   470     static inline void ignoreBadwindow() {
       
   471         qt_x11Data->ignore_badwindow = true;
       
   472         qt_x11Data->seen_badwindow = false;
       
   473     }
       
   474 
       
   475     // ends ignoring bad window errors and returns whether an error had happened.
       
   476     static inline bool badwindow() {
       
   477         qt_x11Data->ignore_badwindow = false;
       
   478         return qt_x11Data->seen_badwindow;
       
   479     }
       
   480 
       
   481     bool ignore_badwindow;
       
   482     bool seen_badwindow;
       
   483 
       
   484     // options
       
   485     int visual_class;
       
   486     int visual_id;
       
   487     int color_count;
       
   488     bool custom_cmap;
       
   489 
       
   490     // outside visual/colormap
       
   491     Visual *visual;
       
   492     Colormap colormap;
       
   493 
       
   494 #ifndef QT_NO_XRENDER
       
   495     enum { solid_fill_count = 16 };
       
   496     struct SolidFills {
       
   497         XRenderColor color;
       
   498         int screen;
       
   499         Picture picture;
       
   500     } solid_fills[solid_fill_count];
       
   501     enum { pattern_fill_count = 16 };
       
   502     struct PatternFills {
       
   503         XRenderColor color;
       
   504         XRenderColor bg_color;
       
   505         int screen;
       
   506         int style;
       
   507         bool opaque;
       
   508         Picture picture;
       
   509     } pattern_fills[pattern_fill_count];
       
   510     Picture getSolidFill(int screen, const QColor &c);
       
   511     XRenderColor preMultiply(const QColor &c);
       
   512 #endif
       
   513 
       
   514     bool has_fontconfig;
       
   515     qreal fc_scale;
       
   516     bool fc_antialias;
       
   517     int fc_hint_style;
       
   518 
       
   519     char *startupId;
       
   520 
       
   521     DesktopEnvironment desktopEnvironment : 8;
       
   522     uint desktopVersion : 8;  /* Used only for KDE */
       
   523 
       
   524     /* Warning: if you modify this list, modify the names of atoms in qapplication_x11.cpp as well! */
       
   525     enum X11Atom {
       
   526         // window-manager <-> client protocols
       
   527         WM_PROTOCOLS,
       
   528         WM_DELETE_WINDOW,
       
   529         WM_TAKE_FOCUS,
       
   530         _NET_WM_PING,
       
   531         _NET_WM_CONTEXT_HELP,
       
   532         _NET_WM_SYNC_REQUEST,
       
   533         _NET_WM_SYNC_REQUEST_COUNTER,
       
   534 
       
   535         // ICCCM window state
       
   536         WM_STATE,
       
   537         WM_CHANGE_STATE,
       
   538 
       
   539         // Session management
       
   540         WM_CLIENT_LEADER,
       
   541         WM_WINDOW_ROLE,
       
   542         SM_CLIENT_ID,
       
   543 
       
   544         // Clipboard
       
   545         CLIPBOARD,
       
   546         INCR,
       
   547         TARGETS,
       
   548         MULTIPLE,
       
   549         TIMESTAMP,
       
   550         SAVE_TARGETS,
       
   551         CLIP_TEMPORARY,
       
   552         _QT_SELECTION,
       
   553         _QT_CLIPBOARD_SENTINEL,
       
   554         _QT_SELECTION_SENTINEL,
       
   555         CLIPBOARD_MANAGER,
       
   556 
       
   557         RESOURCE_MANAGER,
       
   558 
       
   559         _XSETROOT_ID,
       
   560 
       
   561         _QT_SCROLL_DONE,
       
   562         _QT_INPUT_ENCODING,
       
   563 
       
   564         _MOTIF_WM_HINTS,
       
   565 
       
   566         DTWM_IS_RUNNING,
       
   567         KDE_FULL_SESSION,
       
   568         KWIN_RUNNING,
       
   569         KWM_RUNNING,
       
   570         GNOME_BACKGROUND_PROPERTIES,
       
   571         ENLIGHTENMENT_DESKTOP,
       
   572         _SGI_DESKS_MANAGER,
       
   573 
       
   574         // EWMH (aka NETWM)
       
   575         _NET_SUPPORTED,
       
   576         _NET_VIRTUAL_ROOTS,
       
   577         _NET_WORKAREA,
       
   578 
       
   579         _NET_MOVERESIZE_WINDOW,
       
   580         _NET_WM_MOVERESIZE,
       
   581 
       
   582         _NET_WM_NAME,
       
   583         _NET_WM_ICON_NAME,
       
   584         _NET_WM_ICON,
       
   585 
       
   586         _NET_WM_PID,
       
   587 
       
   588         _NET_WM_WINDOW_OPACITY,
       
   589 
       
   590         _NET_WM_STATE,
       
   591         _NET_WM_STATE_ABOVE,
       
   592         _NET_WM_STATE_BELOW,
       
   593         _NET_WM_STATE_FULLSCREEN,
       
   594         _NET_WM_STATE_MAXIMIZED_HORZ,
       
   595         _NET_WM_STATE_MAXIMIZED_VERT,
       
   596         _NET_WM_STATE_MODAL,
       
   597         _NET_WM_STATE_STAYS_ON_TOP,
       
   598         _NET_WM_STATE_DEMANDS_ATTENTION,
       
   599 
       
   600         _NET_WM_USER_TIME,
       
   601         _NET_WM_USER_TIME_WINDOW,
       
   602         _NET_WM_FULL_PLACEMENT,
       
   603 
       
   604         _NET_WM_WINDOW_TYPE,
       
   605         _NET_WM_WINDOW_TYPE_DESKTOP,
       
   606         _NET_WM_WINDOW_TYPE_DOCK,
       
   607         _NET_WM_WINDOW_TYPE_TOOLBAR,
       
   608         _NET_WM_WINDOW_TYPE_MENU,
       
   609         _NET_WM_WINDOW_TYPE_UTILITY,
       
   610         _NET_WM_WINDOW_TYPE_SPLASH,
       
   611         _NET_WM_WINDOW_TYPE_DIALOG,
       
   612         _NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
       
   613         _NET_WM_WINDOW_TYPE_POPUP_MENU,
       
   614         _NET_WM_WINDOW_TYPE_TOOLTIP,
       
   615         _NET_WM_WINDOW_TYPE_NOTIFICATION,
       
   616         _NET_WM_WINDOW_TYPE_COMBO,
       
   617         _NET_WM_WINDOW_TYPE_DND,
       
   618         _NET_WM_WINDOW_TYPE_NORMAL,
       
   619         _KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
       
   620 
       
   621         _KDE_NET_WM_FRAME_STRUT,
       
   622 
       
   623         _NET_STARTUP_INFO,
       
   624         _NET_STARTUP_INFO_BEGIN,
       
   625 
       
   626         _NET_SUPPORTING_WM_CHECK,
       
   627 
       
   628         _NET_WM_CM_S0,
       
   629 
       
   630         _NET_SYSTEM_TRAY_VISUAL,
       
   631 
       
   632         // Property formats
       
   633         COMPOUND_TEXT,
       
   634         TEXT,
       
   635         UTF8_STRING,
       
   636 
       
   637         // Xdnd
       
   638         XdndEnter,
       
   639         XdndPosition,
       
   640         XdndStatus,
       
   641         XdndLeave,
       
   642         XdndDrop,
       
   643         XdndFinished,
       
   644         XdndTypelist,
       
   645         XdndActionList,
       
   646 
       
   647         XdndSelection,
       
   648 
       
   649         XdndAware,
       
   650         XdndProxy,
       
   651 
       
   652         XdndActionCopy,
       
   653         XdndActionLink,
       
   654         XdndActionMove,
       
   655         XdndActionPrivate,
       
   656 
       
   657         // Motif DND
       
   658         _MOTIF_DRAG_AND_DROP_MESSAGE,
       
   659         _MOTIF_DRAG_INITIATOR_INFO,
       
   660         _MOTIF_DRAG_RECEIVER_INFO,
       
   661         _MOTIF_DRAG_WINDOW,
       
   662         _MOTIF_DRAG_TARGETS,
       
   663 
       
   664         XmTRANSFER_SUCCESS,
       
   665         XmTRANSFER_FAILURE,
       
   666 
       
   667         // Xkb
       
   668         _XKB_RULES_NAMES,
       
   669 
       
   670         // XEMBED
       
   671         _XEMBED,
       
   672         _XEMBED_INFO,
       
   673 
       
   674         XWacomStylus,
       
   675         XWacomCursor,
       
   676         XWacomEraser,
       
   677 
       
   678         XTabletStylus,
       
   679         XTabletEraser,
       
   680 
       
   681         NPredefinedAtoms,
       
   682 
       
   683         _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms,
       
   684         NAtoms
       
   685     };
       
   686     Atom atoms[NAtoms];
       
   687 
       
   688     bool isSupportedByWM(Atom atom);
       
   689 
       
   690     bool compositingManagerRunning;
       
   691 
       
   692 #ifndef QT_NO_XCURSOR
       
   693     PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor;
       
   694 #endif // QT_NO_XCURSOR
       
   695 
       
   696 #ifndef QT_NO_XINERAMA
       
   697     PtrXineramaQueryExtension ptrXineramaQueryExtension;
       
   698     PtrXineramaIsActive ptrXineramaIsActive;
       
   699     PtrXineramaQueryScreens ptrXineramaQueryScreens;
       
   700 #endif // QT_NO_XINERAMA
       
   701 
       
   702 #ifndef QT_NO_XRANDR
       
   703     PtrXRRSelectInput ptrXRRSelectInput;
       
   704     PtrXRRUpdateConfiguration ptrXRRUpdateConfiguration;
       
   705     PtrXRRRootToScreen ptrXRRRootToScreen;
       
   706     PtrXRRQueryExtension ptrXRRQueryExtension;
       
   707 #endif // QT_NO_XRANDR
       
   708 };
       
   709 
       
   710 extern QX11Data *qt_x11Data;
       
   711 #define ATOM(x) qt_x11Data->atoms[QX11Data::x]
       
   712 #define X11 qt_x11Data
       
   713 
       
   714 // rename a couple of X defines to get rid of name clashes
       
   715 // resolve the conflict between X11's FocusIn and QEvent::FocusIn
       
   716 enum {
       
   717     XFocusOut = FocusOut,
       
   718     XFocusIn = FocusIn,
       
   719     XKeyPress = KeyPress,
       
   720     XKeyRelease = KeyRelease,
       
   721     XNone = None,
       
   722     XRevertToParent = RevertToParent,
       
   723     XGrayScale = GrayScale,
       
   724     XCursorShape = CursorShape
       
   725 };
       
   726 #undef FocusOut
       
   727 #undef FocusIn
       
   728 #undef KeyPress
       
   729 #undef KeyRelease
       
   730 #undef None
       
   731 #undef RevertToParent
       
   732 #undef GrayScale
       
   733 #undef CursorShape
       
   734 
       
   735 #ifdef FontChange
       
   736 #undef FontChange
       
   737 #endif
       
   738 
       
   739 Q_DECLARE_TYPEINFO(XPoint, Q_PRIMITIVE_TYPE);
       
   740 Q_DECLARE_TYPEINFO(XRectangle, Q_PRIMITIVE_TYPE);
       
   741 Q_DECLARE_TYPEINFO(XChar2b, Q_PRIMITIVE_TYPE);
       
   742 #ifndef QT_NO_XRENDER
       
   743 Q_DECLARE_TYPEINFO(XGlyphElt32, Q_PRIMITIVE_TYPE);
       
   744 #endif
       
   745 
       
   746 
       
   747 QT_END_NAMESPACE
       
   748 
       
   749 #endif // QT_X11_P_H