qx11info_x11.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QX11INFO_X11_H
00043 #define QX11INFO_X11_H
00044 
00045 #include <QtCore/qnamespace.h>
00046 
00047 typedef struct _XDisplay Display;
00048 
00049 QT_BEGIN_HEADER
00050 
00051 QT_BEGIN_NAMESPACE
00052 
00053 QT_MODULE(Gui)
00054 
00055 struct QX11InfoData;
00056 class QX11Info;
00057 class QPaintDevice;
00058 class QApplicationPrivate;
00059 class QX11InfoPrivate;
00060 struct QX11WindowAttributes;
00061 
00062 void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a);
00063 class Q_GUI_EXPORT QX11Info
00064 {
00065 public:
00066     QX11Info();
00067     ~QX11Info();
00068     QX11Info(const QX11Info &other);
00069     QX11Info &operator=(const QX11Info &other);
00070 
00071     static Display *display();
00072     static const char *appClass();
00073     int screen() const;
00074     int depth() const;
00075     int cells() const;
00076     Qt::HANDLE colormap() const;
00077     bool defaultColormap() const;
00078     void *visual() const;
00079     bool defaultVisual() const;
00080 
00081     static int appScreen();
00082     static int appDepth(int screen = -1);
00083     static int appCells(int screen = -1);
00084     static Qt::HANDLE appColormap(int screen = -1);
00085     static void *appVisual(int screen = -1);
00086     static Qt::HANDLE appRootWindow(int screen = -1);
00087     static bool appDefaultColormap(int screen = -1);
00088     static bool appDefaultVisual(int screen = -1);
00089     static int appDpiX(int screen = -1);
00090     static int appDpiY(int screen = -1);
00091     static void setAppDpiX(int screen, int dpi);
00092     static void setAppDpiY(int screen, int dpi);
00093     static unsigned long appTime();
00094     static unsigned long appUserTime();
00095     static void setAppTime(unsigned long time);
00096     static void setAppUserTime(unsigned long time);
00097     static bool isCompositingManagerRunning();
00098 
00099 protected:
00100     void copyX11Data(const QPaintDevice *);
00101     void cloneX11Data(const QPaintDevice *);
00102     void setX11Data(const QX11InfoData *);
00103     QX11InfoData* getX11Data(bool def = false) const;
00104 
00105     QX11InfoData *x11data;
00106 
00107     friend class QX11PaintEngine;
00108     friend class QPixmap;
00109     friend class QX11PixmapData;
00110     friend class QWidget;
00111     friend class QWidgetPrivate;
00112     friend class QGLWidget;
00113     friend void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual,
00114                         Qt::HANDLE colormap);
00115     friend void qt_cleanup();
00116     friend void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a);
00117 };
00118 
00119 QT_END_NAMESPACE
00120 
00121 QT_END_HEADER
00122 
00123 #endif // QX11INFO_X11_H