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