From a78f51acfc86636a1fc46395959a8de7a0eb1e8c Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 9 Aug 2017 11:51:23 +0000 Subject: [PATCH] an attempt to solve the "Status" as well as "QPaintEngine::X11" problem unfortunetly some deeclarative sources still exhibit it, most of the cruft is in private headers and I've not observed the problem as often so this is nothing but a good start, to be continue.. Signed-off-by: Ivailo Monev --- CMakeLists.txt | 6 +- src/core/io/qdatastream.cpp | 6 +- src/core/io/qdatastream.h | 12 +- src/core/io/qsettings.cpp | 6 +- src/core/io/qsettings.h | 12 +- src/core/io/qsettings_p.h | 4 +- src/core/io/qtextstream.cpp | 14 +- src/core/io/qtextstream.h | 10 +- src/gui/dialogs/qdialog.cpp | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- src/gui/graphicsview/qgraphicsview.cpp | 4 +- src/gui/image/qiconloader.cpp | 6 +- src/gui/image/qpixmap.cpp | 2 +- src/gui/image/qpixmap_x11.cpp | 238 +++--- src/gui/kernel/qapplication.cpp | 6 +- src/gui/kernel/qapplication_x11.cpp | 730 +++++++++---------- src/gui/kernel/qclipboard_x11.cpp | 120 +-- src/gui/kernel/qcursor_x11.cpp | 24 +- src/gui/kernel/qdesktopwidget_x11.cpp | 22 +- src/gui/kernel/qdnd_x11.cpp | 160 ++-- src/gui/kernel/qeventdispatcher_x11.cpp | 16 +- src/gui/kernel/qguieventdispatcher_glib.cpp | 16 +- src/gui/kernel/qguiplatformplugin.cpp | 20 +- src/gui/kernel/qkde.cpp | 6 +- src/gui/kernel/qkeymapper_x11.cpp | 14 +- src/gui/kernel/qmotifdnd_x11.cpp | 32 +- src/gui/kernel/qt_x11_p.h | 1 - src/gui/kernel/qwidget_x11.cpp | 376 +++++----- src/gui/kernel/qx11embed_x11.cpp | 8 +- src/gui/kernel/qx11info_x11.cpp | 64 +- src/gui/painting/qcolormap_x11.cpp | 36 +- src/gui/painting/qpaintengine_x11.cpp | 144 ++-- src/gui/painting/qprinter.cpp | 4 +- src/gui/painting/qwindowsurface_raster.cpp | 22 +- src/gui/painting/qwindowsurface_x11.cpp | 42 +- src/gui/styles/qcommonstyle.cpp | 4 +- src/gui/text/qfont.cpp | 2 +- src/gui/text/qfontdatabase_x11.h | 18 +- src/gui/text/qfontengine_x11.cpp | 26 +- src/gui/widgets/qcombobox.cpp | 2 +- src/gui/widgets/qmenu.cpp | 4 +- src/gui/widgets/qsizegrip.cpp | 10 +- src/network/access/qabstractnetworkcache.cpp | 2 +- src/tools/qtconfig/mainwindow.cpp | 2 +- 44 files changed, 1123 insertions(+), 1134 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 091901912..bb981acf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -616,12 +616,16 @@ add_subdirectory(src/sql) add_subdirectory(src/svg) add_subdirectory(src/test) add_subdirectory(src/uitools) + +# generators add_subdirectory(src/tools) + +# tests and benchmarks if(ENABLE_TESTING) add_subdirectory(tests) endif() -# utilities needed for Katie maintainance +# utilities for maintainance if(KATIE_UTILS) add_subdirectory(util) endif() diff --git a/src/core/io/qdatastream.cpp b/src/core/io/qdatastream.cpp index 5101be088..bfc685a36 100644 --- a/src/core/io/qdatastream.cpp +++ b/src/core/io/qdatastream.cpp @@ -215,7 +215,7 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QDataStream::StreamStatus + \enum QDataStream::DataStatus This enum describes the current status of the data stream. @@ -450,7 +450,7 @@ void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision \sa Status setStatus() resetStatus() */ -QDataStream::StreamStatus QDataStream::status() const +QDataStream::DataStatus QDataStream::status() const { return q_status; } @@ -473,7 +473,7 @@ void QDataStream::resetStatus() \sa Status status() resetStatus() */ -void QDataStream::setStatus(StreamStatus status) +void QDataStream::setStatus(DataStatus status) { if (q_status == Ok) q_status = status; diff --git a/src/core/io/qdatastream.h b/src/core/io/qdatastream.h index 389d80cd4..0faac2042 100644 --- a/src/core/io/qdatastream.h +++ b/src/core/io/qdatastream.h @@ -86,7 +86,7 @@ public: LittleEndian = QSysInfo::LittleEndian }; - enum StreamStatus { + enum DataStatus { Ok, ReadPastEnd, ReadCorruptData, @@ -109,8 +109,8 @@ public: bool atEnd() const; - StreamStatus status() const; - void setStatus(StreamStatus status); + DataStatus status() const; + void setStatus(DataStatus status); void resetStatus(); FloatingPointPrecision floatingPointPrecision() const; @@ -168,7 +168,7 @@ private: bool noswap; ByteOrder byteorder; int ver; - StreamStatus q_status; + DataStatus q_status; }; @@ -321,7 +321,7 @@ QDataStream& operator<<(QDataStream &out, const QSet &set) template Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QHash &hash) { - QDataStream::StreamStatus oldStatus = in.status(); + QDataStream::DataStatus oldStatus = in.status(); in.resetStatus(); hash.clear(); @@ -360,7 +360,7 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator<<(QDataStream &out, const QHash Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap &map) { - QDataStream::StreamStatus oldStatus = in.status(); + QDataStream::DataStatus oldStatus = in.status(); in.resetStatus(); map.clear(); diff --git a/src/core/io/qsettings.cpp b/src/core/io/qsettings.cpp index 579f0b595..3dfd14d8c 100644 --- a/src/core/io/qsettings.cpp +++ b/src/core/io/qsettings.cpp @@ -382,7 +382,7 @@ void QSettingsPrivate::beginGroupOrArray(const QSettingsGroup &group) first error that occurred. We always allow clearing errors. */ -void QSettingsPrivate::setStatus(QSettings::Status status) const +void QSettingsPrivate::setStatus(QSettings::SettingsStatus status) const { if (status == QSettings::NoError || this->status == QSettings::NoError) this->status = status; @@ -2167,7 +2167,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \sa QVariant, QSessionManager, {Settings Editor Example}, {Application Example} */ -/*! \enum QSettings::Status +/*! \enum QSettings::SettingsStatus The following status values are possible: @@ -2635,7 +2635,7 @@ QTextCodec *QSettings::iniCodec() const \sa sync() */ -QSettings::Status QSettings::status() const +QSettings::SettingsStatus QSettings::status() const { Q_D(const QSettings); return d->status; diff --git a/src/core/io/qsettings.h b/src/core/io/qsettings.h index 2844dd6c0..9710bddb9 100644 --- a/src/core/io/qsettings.h +++ b/src/core/io/qsettings.h @@ -48,14 +48,8 @@ QT_BEGIN_HEADER #ifndef QT_NO_SETTINGS -#include - QT_BEGIN_NAMESPACE -#ifdef Status -#error qsettings.h must be included before any header file that defines Status -#endif - class QIODevice; class QSettingsPrivate; @@ -73,7 +67,7 @@ class Q_CORE_EXPORT QSettings Q_DECLARE_PRIVATE(QSettings) public: - enum Status { + enum SettingsStatus { NoError = 0, AccessError, FormatError @@ -113,7 +107,7 @@ public: QSettings(Scope scope, const QString &organization, const QString &application = QString(), QObject *parent = Q_NULLPTR); QSettings(Format format, Scope scope, const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = Q_NULLPTR); QSettings(const QString &fileName, Format format, QObject *parent = Q_NULLPTR); explicit QSettings(QObject *parent = Q_NULLPTR); #else @@ -129,7 +123,7 @@ public: void clear(); void sync(); - Status status() const; + SettingsStatus status() const; void beginGroup(const QString &prefix); void endGroup(); diff --git a/src/core/io/qsettings_p.h b/src/core/io/qsettings_p.h index a283938ba..906b9960f 100644 --- a/src/core/io/qsettings_p.h +++ b/src/core/io/qsettings_p.h @@ -200,7 +200,7 @@ public: QString actualKey(const QString &key) const; void beginGroupOrArray(const QSettingsGroup &group); - void setStatus(QSettings::Status status) const; + void setStatus(QSettings::SettingsStatus status) const; void requestUpdate(); void update(); @@ -252,7 +252,7 @@ protected: int spec; bool fallbacks; bool pendingChanges; - mutable QSettings::Status status; + mutable QSettings::SettingsStatus status; }; class QConfFileSettingsPrivate : public QSettingsPrivate diff --git a/src/core/io/qtextstream.cpp b/src/core/io/qtextstream.cpp index 5c3f81aee..e0c9f9f11 100644 --- a/src/core/io/qtextstream.cpp +++ b/src/core/io/qtextstream.cpp @@ -211,7 +211,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384; \sa setNumberFlags() */ -/*! \enum QTextStream::Status +/*! \enum QTextStream::TextStatus This enum describes the current status of the text stream. @@ -419,7 +419,7 @@ public: QTextStream::NumberFlags numberFlags; // status - QTextStream::Status status; + QTextStream::TextStatus status; QLocale locale; @@ -1534,10 +1534,10 @@ int QTextStream::realNumberPrecision() const /*! Returns the status of the text stream. - \sa QTextStream::Status, setStatus(), resetStatus() + \sa QTextStream::TextStatus, setStatus(), resetStatus() */ -QTextStream::Status QTextStream::status() const +QTextStream::TextStatus QTextStream::status() const { Q_D(const QTextStream); return d->status; @@ -1548,7 +1548,7 @@ QTextStream::Status QTextStream::status() const Resets the status of the text stream. - \sa QTextStream::Status, status(), setStatus() + \sa QTextStream::TextStatus, status(), setStatus() */ void QTextStream::resetStatus() { @@ -1564,9 +1564,9 @@ void QTextStream::resetStatus() Subsequent calls to setStatus() are ignored until resetStatus() is called. - \sa Status status() resetStatus() + \sa TextStatus status() resetStatus() */ -void QTextStream::setStatus(Status status) +void QTextStream::setStatus(TextStatus status) { Q_D(QTextStream); if (d->status == Ok) diff --git a/src/core/io/qtextstream.h b/src/core/io/qtextstream.h index 34a2de1e0..80702608e 100644 --- a/src/core/io/qtextstream.h +++ b/src/core/io/qtextstream.h @@ -46,10 +46,6 @@ #include -#ifdef Status -#error qtextstream.h must be included before any header file that defines Status -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -74,7 +70,7 @@ public: AlignCenter, AlignAccountingStyle }; - enum Status { + enum TextStatus { Ok, ReadPastEnd, ReadCorruptData, @@ -116,8 +112,8 @@ public: void setString(QString *string, QIODevice::OpenMode openMode = QIODevice::ReadWrite); QString *string() const; - Status status() const; - void setStatus(Status status); + TextStatus status() const; + void setStatus(TextStatus status); void resetStatus(); bool atEnd() const; diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 97876595b..407c21091 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -674,7 +674,7 @@ void QDialog::adjustPosition(QWidget* w) { #ifdef Q_WS_X11 // if the WM advertises that it will place the windows properly for us, let it do it :) - if (X11->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT))) + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT))) return; #endif diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 477bcacbd..b32ec42d9 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4309,7 +4309,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte // Render directly, using no cache. if (cacheMode == QGraphicsItem::NoCache #ifdef Q_WS_X11 - || !X11->use_xrender + || !qt_x11Data->use_xrender #endif ) { _q_paintItem(static_cast(item), painter, option, widget, true, painterStateProtection); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 3ff4a1ed7..11ad0b527 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3338,7 +3338,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Draw background if ((d->cacheMode & CacheBackground) #ifdef Q_WS_X11 - && X11->use_xrender + && qt_x11Data->use_xrender #endif ) { // Recreate the background pixmap, and flag the whole background as @@ -3533,7 +3533,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy) if ((d->cacheMode & CacheBackground) #ifdef Q_WS_X11 - && X11->use_xrender + && qt_x11Data->use_xrender #endif ) { // Scroll the background pixmap diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index fc79ffdf8..ae3761272 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -71,10 +71,10 @@ Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) static QString fallbackTheme() { #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_GNOME) { + if (qt_x11Data->desktopEnvironment == DE_GNOME) { return QLatin1String("gnome"); - } else if (X11->desktopEnvironment == DE_KDE) { - return X11->desktopVersion >= 4 + } else if (qt_x11Data->desktopEnvironment == DE_KDE) { + return qt_x11Data->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); } else { diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 8ddc16741..89cacc065 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1750,7 +1750,7 @@ void QPixmap::detach() // reset the cache data if (d->hd2) { - XFreePixmap(X11->display, d->hd2); + XFreePixmap(qt_x11Data->display, d->hd2); d->hd2 = 0; } } diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index a76c4a423..b2e3dbbda 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -114,10 +114,10 @@ QBitmap QX11PixmapData::mask_to_bitmap(int screen) const return QBitmap(); QPixmap::x11SetDefaultScreen(screen); QBitmap bm(w, h); - GC gc = XCreateGC(X11->display, bm.handle(), 0, 0); - XCopyArea(X11->display, x11_mask, bm.handle(), gc, 0, 0, + GC gc = XCreateGC(qt_x11Data->display, bm.handle(), 0, 0); + XCopyArea(qt_x11Data->display, x11_mask, bm.handle(), gc, 0, 0, bm.data->width(), bm.data->height(), 0, 0); - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); return bm; } @@ -128,12 +128,12 @@ Qt::HANDLE QX11PixmapData::bitmap_to_mask(const QBitmap &bitmap, int screen) QBitmap bm = bitmap; bm.x11SetScreen(screen); - Pixmap mask = XCreatePixmap(X11->display, RootWindow(X11->display, screen), + Pixmap mask = XCreatePixmap(qt_x11Data->display, RootWindow(qt_x11Data->display, screen), bm.data->width(), bm.data->height(), 1); - GC gc = XCreateGC(X11->display, mask, 0, 0); - XCopyArea(X11->display, bm.handle(), mask, gc, 0, 0, + GC gc = XCreateGC(qt_x11Data->display, mask, 0, 0); + XCopyArea(qt_x11Data->display, bm.handle(), mask, gc, 0, 0, bm.data->width(), bm.data->height(), 0, 0); - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); return mask; } @@ -346,15 +346,15 @@ void QX11PixmapData::resize(int width, int height) qWarning("QPixmap: Invalid pixmap parameters"); return; } - hd = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(X11->display, xinfo.screen()), + hd = (Qt::HANDLE)XCreatePixmap(qt_x11Data->display, + RootWindow(qt_x11Data->display, xinfo.screen()), w, h, d); #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { XRenderPictFormat *format = d == 1 - ? XRenderFindStandardFormat(X11->display, PictStandardA1) - : XRenderFindVisualFormat(X11->display, (Visual *)xinfo.visual()); - picture = XRenderCreatePicture(X11->display, hd, format, 0, 0); + ? XRenderFindStandardFormat(qt_x11Data->display, PictStandardA1) + : XRenderFindVisualFormat(qt_x11Data->display, (Visual *)xinfo.visual()); + picture = XRenderCreatePicture(qt_x11Data->display, hd, format, 0, 0); } #endif // QT_NO_XRENDER } @@ -371,7 +371,7 @@ struct QX11AlphaDetector } bool hasXRenderAndAlpha() const { - if (!X11->use_xrender) + if (!qt_x11Data->use_xrender) return false; return hasAlpha(); } @@ -474,7 +474,7 @@ void QX11PixmapData::fromImage(const QImage &img, return; } - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; Visual *visual = (Visual *)xinfo.visual(); XImage *xi = 0; bool trucol = (visual->c_class >= TrueColor); @@ -505,8 +505,8 @@ void QX11PixmapData::fromImage(const QImage &img, hd = (Qt::HANDLE)XCreatePixmap(dpy, RootWindow(dpy, xinfo.screen()), w, h, d); - picture = XRenderCreatePicture(X11->display, hd, - XRenderFindStandardFormat(X11->display, PictStandardARGB32), 0, 0); + picture = XRenderCreatePicture(qt_x11Data->display, hd, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32), 0, 0); xi = XCreateImage(dpy, visual, d, ZPixmap, 0, 0, w, h, 32, 0); Q_CHECK_PTR(xi); @@ -1107,8 +1107,8 @@ void QX11PixmapData::fromImage(const QImage &img, xi->data = (char *)newbits; } - hd = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(X11->display, xinfo.screen()), + hd = (Qt::HANDLE)XCreatePixmap(qt_x11Data->display, + RootWindow(qt_x11Data->display, xinfo.screen()), w, h, dd); GC gc = XCreateGC(dpy, hd, 0, 0); @@ -1119,11 +1119,11 @@ void QX11PixmapData::fromImage(const QImage &img, d = dd; #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { XRenderPictFormat *format = d == 1 - ? XRenderFindStandardFormat(X11->display, PictStandardA1) - : XRenderFindVisualFormat(X11->display, (Visual *)xinfo.visual()); - picture = XRenderCreatePicture(X11->display, hd, format, 0, 0); + ? XRenderFindStandardFormat(qt_x11Data->display, PictStandardA1) + : XRenderFindVisualFormat(qt_x11Data->display, (Visual *)xinfo.visual()); + picture = XRenderCreatePicture(qt_x11Data->display, hd, format, 0, 0); } #endif @@ -1166,7 +1166,7 @@ Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image) bits = (char *)img.bits(); tmp_bits = 0; } - Qt::HANDLE hd = (Qt::HANDLE)XCreateBitmapFromData(X11->display, + Qt::HANDLE hd = (Qt::HANDLE)XCreateBitmapFromData(qt_x11Data->display, QX11Info::appRootWindow(), bits, w, h); if (tmp_bits) // Avoid purify complaint @@ -1182,9 +1182,9 @@ void QX11PixmapData::bitmapFromImage(const QImage &image) is_null = (w <= 0 || h <= 0); hd = createBitmapFromImage(image); #ifndef QT_NO_XRENDER - if (X11->use_xrender) - picture = XRenderCreatePicture(X11->display, hd, - XRenderFindStandardFormat(X11->display, PictStandardA1), 0, 0); + if (qt_x11Data->use_xrender) + picture = XRenderCreatePicture(qt_x11Data->display, hd, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardA1), 0, 0); #endif // QT_NO_XRENDER } @@ -1192,12 +1192,12 @@ void QX11PixmapData::fill(const QColor &fillColor) { if (fillColor.alpha() != 255) { #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { if (!picture || d != 32) convertToARGB32(/*preserveContents = */false); - ::Picture src = X11->getSolidFill(xinfo.screen(), fillColor); - XRenderComposite(X11->display, PictOpSrc, src, 0, picture, + ::Picture src = qt_x11Data->getSolidFill(xinfo.screen(), fillColor); + XRenderComposite(qt_x11Data->display, PictOpSrc, src, 0, picture, 0, 0, width(), height(), 0, 0, width(), height()); } else @@ -1211,17 +1211,17 @@ void QX11PixmapData::fill(const QColor &fillColor) return; } - GC gc = XCreateGC(X11->display, hd, 0, 0); + GC gc = XCreateGC(qt_x11Data->display, hd, 0, 0); if (depth() == 1) { - XSetForeground(X11->display, gc, qGray(fillColor.rgb()) > 127 ? 0 : 1); - } else if (X11->use_xrender && d >= 24) { - XSetForeground(X11->display, gc, fillColor.rgba()); + XSetForeground(qt_x11Data->display, gc, qGray(fillColor.rgb()) > 127 ? 0 : 1); + } else if (qt_x11Data->use_xrender && d >= 24) { + XSetForeground(qt_x11Data->display, gc, fillColor.rgba()); } else { - XSetForeground(X11->display, gc, + XSetForeground(qt_x11Data->display, gc, QColormap::instance(xinfo.screen()).pixel(fillColor)); } - XFillRectangle(X11->display, hd, gc, 0, 0, width(), height()); - XFreeGC(X11->display, gc); + XFillRectangle(qt_x11Data->display, hd, gc, 0, 0, width(), height()); + XFreeGC(qt_x11Data->display, gc); } QX11PixmapData::~QX11PixmapData() @@ -1234,7 +1234,7 @@ void QX11PixmapData::release() delete pengine; pengine = 0; - if (!X11) { + if (!qt_x11Data) { // At this point, the X server will already have freed our resources, // so there is nothing to do. return; @@ -1243,17 +1243,17 @@ void QX11PixmapData::release() if (x11_mask) { #ifndef QT_NO_XRENDER if (mask_picture) - XRenderFreePicture(X11->display, mask_picture); + XRenderFreePicture(qt_x11Data->display, mask_picture); mask_picture = 0; #endif - XFreePixmap(X11->display, x11_mask); + XFreePixmap(qt_x11Data->display, x11_mask); x11_mask = 0; } if (hd) { #ifndef QT_NO_XRENDER if (picture) { - XRenderFreePicture(X11->display, picture); + XRenderFreePicture(qt_x11Data->display, picture); picture = 0; } #endif // QT_NO_XRENDER @@ -1335,7 +1335,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask) QX11PixmapData newData(pixelType()); newData.resize(w, h); newData.fill(Qt::black); - XRenderComposite(X11->display, PictOpOver, + XRenderComposite(qt_x11Data->display, PictOpOver, picture, 0, newData.picture, 0, 0, 0, 0, 0, 0, w, h); release(); @@ -1358,14 +1358,14 @@ void QX11PixmapData::setMask(const QBitmap &newmask) if (picture) { XRenderPictureAttributes attrs; attrs.alpha_map = 0; - XRenderChangePicture(X11->display, picture, CPAlphaMap, + XRenderChangePicture(qt_x11Data->display, picture, CPAlphaMap, &attrs); } if (mask_picture) - XRenderFreePicture(X11->display, mask_picture); + XRenderFreePicture(qt_x11Data->display, mask_picture); mask_picture = 0; #endif - XFreePixmap(X11->display, x11_mask); + XFreePixmap(qt_x11Data->display, x11_mask); x11_mask = 0; } return; @@ -1373,7 +1373,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask) #ifndef QT_NO_XRENDER if (picture && d == 32) { - XRenderComposite(X11->display, PictOpSrc, + XRenderComposite(qt_x11Data->display, PictOpSrc, picture, newmask.x11PictureHandle(), picture, 0, 0, 0, 0, 0, 0, w, h); } else @@ -1381,27 +1381,27 @@ void QX11PixmapData::setMask(const QBitmap &newmask) if (depth() == 1) { XGCValues vals; vals.function = GXand; - GC gc = XCreateGC(X11->display, hd, GCFunction, &vals); - XCopyArea(X11->display, newmask.handle(), hd, gc, 0, 0, + GC gc = XCreateGC(qt_x11Data->display, hd, GCFunction, &vals); + XCopyArea(qt_x11Data->display, newmask.handle(), hd, gc, 0, 0, width(), height(), 0, 0); - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); } else { // ##### should or the masks together if (x11_mask) { - XFreePixmap(X11->display, x11_mask); + XFreePixmap(qt_x11Data->display, x11_mask); #ifndef QT_NO_XRENDER if (mask_picture) - XRenderFreePicture(X11->display, mask_picture); + XRenderFreePicture(qt_x11Data->display, mask_picture); #endif } x11_mask = QX11PixmapData::bitmap_to_mask(newmask, xinfo.screen()); #ifndef QT_NO_XRENDER if (picture) { - mask_picture = XRenderCreatePicture(X11->display, x11_mask, - XRenderFindStandardFormat(X11->display, PictStandardA1), 0, 0); + mask_picture = XRenderCreatePicture(qt_x11Data->display, x11_mask, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardA1), 0, 0); XRenderPictureAttributes attrs; attrs.alpha_map = mask_picture; - XRenderChangePicture(X11->display, picture, CPAlphaMap, &attrs); + XRenderChangePicture(qt_x11Data->display, picture, CPAlphaMap, &attrs); } #endif } @@ -1420,14 +1420,14 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const return d; case QPaintDevice::PdmWidthMM: { const int screen = xinfo.screen(); - const int mm = DisplayWidthMM(X11->display, screen) * w - / DisplayWidth(X11->display, screen); + const int mm = DisplayWidthMM(qt_x11Data->display, screen) * w + / DisplayWidth(qt_x11Data->display, screen); return mm; } case QPaintDevice::PdmHeightMM: { const int screen = xinfo.screen(); - const int mm = (DisplayHeightMM(X11->display, screen) * h) - / DisplayHeight(X11->display, screen); + const int mm = (DisplayHeightMM(qt_x11Data->display, screen) * h) + / DisplayHeight(qt_x11Data->display, screen); return mm; } case QPaintDevice::PdmDpiX: @@ -1526,7 +1526,7 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con QImage QX11PixmapData::toImage(const QRect &rect) const { QXImageWrapper xiWrapper; - xiWrapper.xi = XGetImage(X11->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), + xiWrapper.xi = XGetImage(qt_x11Data->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), AllPlanes, (depth() == 1) ? XYPixmap : ZPixmap); Q_CHECK_PTR(xiWrapper.xi); @@ -1854,7 +1854,7 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, int sbpl; // bytes per line in original int bpp; // bits per pixel bool depth1 = depth() == 1; - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; ws = width(); hs = height(); @@ -1902,7 +1902,7 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, bool use_mitshm = xshmimg && !depth1 && xshmimg->width >= w && xshmimg->height >= h; #endif - XImage *xi = XGetImage(X11->display, handle(), 0, 0, ws, hs, AllPlanes, + XImage *xi = XGetImage(qt_x11Data->display, handle(), 0, 0, ws, hs, AllPlanes, depth1 ? XYPixmap : ZPixmap); if (!xi) @@ -1931,7 +1931,7 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, if (depth1) // fill with zeros memset(dptr, 0, dbytes); else if (bpp == 8) // fill with background color - memset(dptr, WhitePixel(X11->display, xinfo.screen()), dbytes); + memset(dptr, WhitePixel(qt_x11Data->display, xinfo.screen()), dbytes); else memset(dptr, 0, dbytes); #if defined(QT_MITSHM) @@ -1981,7 +1981,7 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, if (depth1) { // mono bitmap QBitmap bm = QBitmap::fromData(QSize(w, h), dptr, - BitmapBitOrder(X11->display) == MSBFirst + BitmapBitOrder(qt_x11Data->display) == MSBFirst ? QImage::Format_Mono : QImage::Format_MonoLSB); free(dptr); @@ -1995,21 +1995,21 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, x11Data->w = w; x11Data->h = h; x11Data->is_null = (w <= 0 || h <= 0); - x11Data->hd = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(X11->display, xinfo.screen()), + x11Data->hd = (Qt::HANDLE)XCreatePixmap(qt_x11Data->display, + RootWindow(qt_x11Data->display, xinfo.screen()), w, h, d); x11Data->setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { XRenderPictFormat *format = x11Data->d == 32 - ? XRenderFindStandardFormat(X11->display, PictStandardARGB32) - : XRenderFindVisualFormat(X11->display, (Visual *) x11Data->xinfo.visual()); - x11Data->picture = XRenderCreatePicture(X11->display, x11Data->hd, format, 0, 0); + ? XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32) + : XRenderFindVisualFormat(qt_x11Data->display, (Visual *) x11Data->xinfo.visual()); + x11Data->picture = XRenderCreatePicture(qt_x11Data->display, x11Data->hd, format, 0, 0); } #endif // QT_NO_XRENDER - GC gc = XCreateGC(X11->display, x11Data->hd, 0, 0); + GC gc = XCreateGC(qt_x11Data->display, x11Data->hd, 0, 0); #if defined(QT_MITSHM) if (use_mitshm) { XCopyArea(dpy, xshmpm, x11Data->hd, gc, 0, 0, w, h, 0, 0); @@ -2022,7 +2022,7 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, XPutImage(dpy, pm.handle(), gc, xi, 0, 0, 0, 0, w, h); qSafeXDestroyImage(xi); } - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); if (x11_mask) { // xform mask, too pm.setMask(mask_to_bitmap(xinfo.screen()).transformed(transform)); @@ -2087,7 +2087,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) if (w == 0 || h == 0) return QPixmap(); - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; XWindowAttributes window_attr; if (!XGetWindowAttributes(dpy, window, &window_attr)) return QPixmap(); @@ -2166,11 +2166,11 @@ const QX11Info &QPixmap::x11Info() const static XRenderPictFormat *qt_renderformat_for_depth(const QX11Info &xinfo, int depth) { if (depth == 1) - return XRenderFindStandardFormat(X11->display, PictStandardA1); + return XRenderFindStandardFormat(qt_x11Data->display, PictStandardA1); else if (depth == 32) - return XRenderFindStandardFormat(X11->display, PictStandardARGB32); + return XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32); else - return XRenderFindVisualFormat(X11->display, (Visual *)xinfo.visual()); + return XRenderFindVisualFormat(qt_x11Data->display, (Visual *)xinfo.visual()); } #endif @@ -2181,25 +2181,25 @@ QPaintEngine* QX11PixmapData::paintEngine() const if ((flags & Readonly) && share_mode == QPixmap::ImplicitlyShared) { // if someone wants to draw onto us, copy the shared contents // and turn it into a fully fledged QPixmap - ::Pixmap hd_copy = XCreatePixmap(X11->display, RootWindow(X11->display, xinfo.screen()), + ::Pixmap hd_copy = XCreatePixmap(qt_x11Data->display, RootWindow(qt_x11Data->display, xinfo.screen()), w, h, d); #if !defined(QT_NO_XRENDER) if (picture && d == 32) { XRenderPictFormat *format = qt_renderformat_for_depth(xinfo, d); - ::Picture picture_copy = XRenderCreatePicture(X11->display, + ::Picture picture_copy = XRenderCreatePicture(qt_x11Data->display, hd_copy, format, 0, 0); - XRenderComposite(X11->display, PictOpSrc, picture, 0, picture_copy, + XRenderComposite(qt_x11Data->display, PictOpSrc, picture, 0, picture_copy, 0, 0, 0, 0, 0, 0, w, h); - XRenderFreePicture(X11->display, picture); + XRenderFreePicture(qt_x11Data->display, picture); that->picture = picture_copy; } else #endif { - GC gc = XCreateGC(X11->display, hd_copy, 0, 0); - XCopyArea(X11->display, hd, hd_copy, gc, 0, 0, w, h, 0, 0); - XFreeGC(X11->display, gc); + GC gc = XCreateGC(qt_x11Data->display, hd_copy, 0, 0); + XCopyArea(qt_x11Data->display, hd, hd_copy, gc, 0, 0, w, h, 0, 0); + XFreeGC(qt_x11Data->display, gc); } that->hd = hd_copy; that->flags &= ~QX11PixmapData::Readonly; @@ -2225,7 +2225,7 @@ Qt::HANDLE QPixmap::x11PictureHandle() const Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth() { #ifndef QT_NO_XRENDER - if (d == QX11Info::appDepth() || !X11->use_xrender) + if (d == QX11Info::appDepth() || !qt_x11Data->use_xrender) return hd; if (!hd2) { hd2 = XCreatePixmap(xinfo.display(), hd, w, h, QX11Info::appDepth()); @@ -2259,87 +2259,87 @@ void QX11PixmapData::copy(const QPixmapData *data, const QRect &rect) w = rect.width(); h = rect.height(); is_null = (w <= 0 || h <= 0); - hd = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(X11->display, x11Data->xinfo.screen()), + hd = (Qt::HANDLE)XCreatePixmap(qt_x11Data->display, + RootWindow(qt_x11Data->display, x11Data->xinfo.screen()), w, h, d); #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { XRenderPictFormat *format = d == 32 - ? XRenderFindStandardFormat(X11->display, PictStandardARGB32) - : XRenderFindVisualFormat(X11->display, (Visual *)xinfo.visual()); - picture = XRenderCreatePicture(X11->display, hd, format, 0, 0); + ? XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32) + : XRenderFindVisualFormat(qt_x11Data->display, (Visual *)xinfo.visual()); + picture = XRenderCreatePicture(qt_x11Data->display, hd, format, 0, 0); } #endif // QT_NO_XRENDER if (x11Data->x11_mask) { - x11_mask = XCreatePixmap(X11->display, hd, w, h, 1); + x11_mask = XCreatePixmap(qt_x11Data->display, hd, w, h, 1); #ifndef QT_NO_XRENDER - if (X11->use_xrender) { - mask_picture = XRenderCreatePicture(X11->display, x11_mask, - XRenderFindStandardFormat(X11->display, PictStandardA1), 0, 0); + if (qt_x11Data->use_xrender) { + mask_picture = XRenderCreatePicture(qt_x11Data->display, x11_mask, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardA1), 0, 0); XRenderPictureAttributes attrs; attrs.alpha_map = x11Data->mask_picture; - XRenderChangePicture(X11->display, x11Data->picture, CPAlphaMap, &attrs); + XRenderChangePicture(qt_x11Data->display, x11Data->picture, CPAlphaMap, &attrs); } #endif } #if !defined(QT_NO_XRENDER) if (x11Data->picture && x11Data->d == 32) { - XRenderComposite(X11->display, PictOpSrc, + XRenderComposite(qt_x11Data->display, PictOpSrc, x11Data->picture, 0, picture, rect.x(), rect.y(), 0, 0, 0, 0, w, h); } else #endif { - GC gc = XCreateGC(X11->display, hd, 0, 0); - XCopyArea(X11->display, x11Data->hd, hd, gc, + GC gc = XCreateGC(qt_x11Data->display, hd, 0, 0); + XCopyArea(qt_x11Data->display, x11Data->hd, hd, gc, rect.x(), rect.y(), w, h, 0, 0); if (x11Data->x11_mask) { - GC monogc = XCreateGC(X11->display, x11_mask, 0, 0); - XCopyArea(X11->display, x11Data->x11_mask, x11_mask, monogc, + GC monogc = XCreateGC(qt_x11Data->display, x11_mask, 0, 0); + XCopyArea(qt_x11Data->display, x11Data->x11_mask, x11_mask, monogc, rect.x(), rect.y(), w, h, 0, 0); - XFreeGC(X11->display, monogc); + XFreeGC(qt_x11Data->display, monogc); } - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); } } bool QX11PixmapData::scroll(int dx, int dy, const QRect &rect) { - GC gc = XCreateGC(X11->display, hd, 0, 0); - XCopyArea(X11->display, hd, hd, gc, + GC gc = XCreateGC(qt_x11Data->display, hd, 0, 0); + XCopyArea(qt_x11Data->display, hd, hd, gc, rect.left(), rect.top(), rect.width(), rect.height(), rect.left() + dx, rect.top() + dy); - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); return true; } #if !defined(QT_NO_XRENDER) void QX11PixmapData::convertToARGB32(bool preserveContents) { - if (!X11->use_xrender) + if (!qt_x11Data->use_xrender) return; // Q_ASSERT(count == 1); if ((flags & Readonly) && share_mode == QPixmap::ExplicitlyShared) return; - Pixmap pm = XCreatePixmap(X11->display, RootWindow(X11->display, xinfo.screen()), + Pixmap pm = XCreatePixmap(qt_x11Data->display, RootWindow(qt_x11Data->display, xinfo.screen()), w, h, 32); - Picture p = XRenderCreatePicture(X11->display, pm, - XRenderFindStandardFormat(X11->display, PictStandardARGB32), 0, 0); + Picture p = XRenderCreatePicture(qt_x11Data->display, pm, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32), 0, 0); if (picture) { if (preserveContents) - XRenderComposite(X11->display, PictOpSrc, picture, 0, p, 0, 0, 0, 0, 0, 0, w, h); + XRenderComposite(qt_x11Data->display, PictOpSrc, picture, 0, p, 0, 0, 0, 0, 0, 0, w, h); if (!(flags & Readonly)) - XRenderFreePicture(X11->display, picture); + XRenderFreePicture(qt_x11Data->display, picture); } if (hd && !(flags & Readonly)) - XFreePixmap(X11->display, hd); + XFreePixmap(qt_x11Data->display, hd); if (x11_mask) { - XFreePixmap(X11->display, x11_mask); + XFreePixmap(qt_x11Data->display, x11_mask); if (mask_picture) - XRenderFreePicture(X11->display, mask_picture); + XRenderFreePicture(qt_x11Data->display, mask_picture); x11_mask = 0; mask_picture = 0; } @@ -2359,14 +2359,14 @@ QPixmap QPixmap::fromX11Pixmap(Qt::HANDLE pixmap, QPixmap::ShareMode mode) uint border_width; uint depth; XWindowAttributes win_attribs; - int num_screens = ScreenCount(X11->display); + int num_screens = ScreenCount(qt_x11Data->display); int screen = 0; - XGetGeometry(X11->display, pixmap, &root, &x, &y, &width, &height, &border_width, &depth); - XGetWindowAttributes(X11->display, root, &win_attribs); + XGetGeometry(qt_x11Data->display, pixmap, &root, &x, &y, &width, &height, &border_width, &depth); + XGetWindowAttributes(qt_x11Data->display, root, &win_attribs); for (; screen < num_screens; ++screen) { - if (win_attribs.screen == ScreenOfDisplay(X11->display, screen)) + if (win_attribs.screen == ScreenOfDisplay(qt_x11Data->display, screen)) break; } @@ -2393,9 +2393,9 @@ QPixmap QPixmap::fromX11Pixmap(Qt::HANDLE pixmap, QPixmap::ShareMode mode) } #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { XRenderPictFormat *format = qt_renderformat_for_depth(data->xinfo, depth); - data->picture = XRenderCreatePicture(X11->display, data->hd, format, 0, 0); + data->picture = XRenderCreatePicture(qt_x11Data->display, data->hd, format, 0, 0); } #endif // QT_NO_XRENDER diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index beb4e9ab5..91e574ee5 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4604,11 +4604,11 @@ uint QApplicationPrivate::currentPlatform(){ uint platform = KB_None; #if defined Q_WS_X11 platform = KB_X11; - if (X11->desktopEnvironment == DE_KDE) + if (qt_x11Data->desktopEnvironment == DE_KDE) platform |= KB_KDE; - if (X11->desktopEnvironment == DE_GNOME) + if (qt_x11Data->desktopEnvironment == DE_GNOME) platform |= KB_Gnome; - if (X11->desktopEnvironment == DE_CDE) + if (qt_x11Data->desktopEnvironment == DE_CDE) platform |= KB_CDE; #endif return platform; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 02232a470..55b6e3bff 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -287,22 +287,21 @@ Q_GUI_EXPORT QX11Data *qt_x11Data = 0; /***************************************************************************** Internal variables and functions *****************************************************************************/ -static const char *appName = 0; // application name +static const char *appName = 0; // application name static const char *appClass = 0; // application class -static const char *appFont = 0; // application font -static const char *appBGCol = 0; // application bg color -static const char *appFGCol = 0; // application fg color -static const char *appBTNCol = 0; // application btn color -static const char *mwGeometry = 0; // main widget geometry -static const char *mwTitle = 0; // main widget title -char *qt_ximServer = 0; // XIM Server will connect to -static bool appSync = false; // X11 synchronization +static const char *appFont = 0; // application font +static const char *appBGCol = 0; // application bg color +static const char *appFGCol = 0; // application fg color +static const char *appBTNCol = 0; // application btn color +static const char *mwGeometry = 0; // main widget geometry +static const char *mwTitle = 0; // main widget title +static bool appSync = false; // X11 synchronization #if defined(QT_DEBUG) -static bool appNoGrab = false; // X11 grabbing enabled -static bool appDoGrab = false; // X11 grabbing override (gdb) +static bool appNoGrab = false; // X11 grabbing enabled +static bool appDoGrab = false; // X11 grabbing override (gdb) #endif -static bool app_do_modal = false; // modal mode -static Window curWin = 0; // current window +static bool app_do_modal = false; // modal mode +static Window curWin = 0; // current window // function to update the workarea of the screen - in qdesktopwidget_x11.cpp @@ -412,7 +411,7 @@ static Bool qt_xfixes_scanner(Display*, XEvent *event, XPointer arg) { qt_xfixes_selection_event_data *data = reinterpret_cast(arg); - if (event->type == X11->xfixes_eventbase + XFixesSelectionNotify) { + if (event->type == qt_x11Data->xfixes_eventbase + XFixesSelectionNotify) { XFixesSelectionNotifyEvent *xfixes_event = reinterpret_cast(event); if (xfixes_event->selection == data->selection) return true; @@ -456,7 +455,7 @@ public: */ QRect r = geometry(); - XMoveResizeWindow(X11->display, + XMoveResizeWindow(qt_x11Data->display, internalWinId(), r.x(), r.y(), @@ -467,20 +466,20 @@ public: XSizeHints sh; memset(&sh, 0, sizeof(sh)); long unused; - XGetWMNormalHints(X11->display, internalWinId(), &sh, &unused); + XGetWMNormalHints(qt_x11Data->display, internalWinId(), &sh, &unused); sh.flags |= USPosition | PPosition | USSize | PSize | PWinGravity; sh.x = r.x(); sh.y = r.y(); sh.width = r.width(); sh.height = r.height(); sh.win_gravity = StaticGravity; - XSetWMNormalHints(X11->display, internalWinId(), &sh); + XSetWMNormalHints(qt_x11Data->display, internalWinId(), &sh); setAttribute(Qt::WA_Mapped); if (testAttribute(Qt::WA_DontShowOnScreen)) return; d_func()->topData()->waitingForMapNotify = 1; - XMapWindow(X11->display, internalWinId()); + XMapWindow(qt_x11Data->display, internalWinId()); } }; @@ -513,7 +512,7 @@ static int (*original_xio_errhandler)(Display *dpy); static int qt_x_errhandler(Display *dpy, XErrorEvent *err) { - if (X11->display != dpy) { + if (qt_x11Data->display != dpy) { // only handle X errors for our display return 0; } @@ -542,7 +541,7 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err) } } } - X11->seen_badwindow = true; + qt_x11Data->seen_badwindow = true; if (err->request_code == 25 /* X_SendEvent */) { for (int i = 0; i < ScreenCount(dpy); ++i) { if (err->resourceid == RootWindow(dpy, i)) { @@ -550,19 +549,19 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err) return 0; } } - if (X11->xdndHandleBadwindow()) { + if (qt_x11Data->xdndHandleBadwindow()) { qDebug("xdndHandleBadwindow returned true"); return 0; } } - if (X11->ignore_badwindow) + if (qt_x11Data->ignore_badwindow) return 0; break; default: #if !defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + if (err->request_code == qt_x11Data->xinput_major + && err->error_code == (qt_x11Data->xinput_errorbase + XI_BadDevice) && err->minor_code == 3 /* X_OpenDevice */) { return 0; } @@ -588,13 +587,13 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err) } else { // X error for an extension request const char *extensionName = 0; - if (err->request_code == X11->xrender_major) + if (err->request_code == qt_x11Data->xrender_major) extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) + else if (err->request_code == qt_x11Data->xrandr_major) extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) + else if (err->request_code == qt_x11Data->xinput_major) extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) + else if (err->request_code == qt_x11Data->mitshm_major) extensionName = "MIT-SHM"; char minor_str[256]; @@ -654,15 +653,15 @@ static void qt_x11_create_intern_atoms() Q_ASSERT(i == QX11Data::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(X11->displayName); + settings_atom_name += XDisplayName(qt_x11Data->displayName); names[i++] = settings_atom_name; Q_ASSERT(i == QX11Data::NAtoms); #if defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) - XInternAtoms(X11->display, (char **)names, i, False, X11->atoms); + XInternAtoms(qt_x11Data->display, (char **)names, i, False, qt_x11Data->atoms); #else for (i = 0; i < QX11Data::NAtoms; ++i) - X11->atoms[i] = XInternAtom(X11->display, (char *)names[i], False); + qt_x11Data->atoms[i] = XInternAtom(qt_x11Data->display, (char *)names[i], False); #endif } @@ -740,7 +739,7 @@ bool QApplicationPrivate::x11_apply_settings() QFont font(QApplication::font()); QString fontDescription; // Override Qt font if KDE4 settings can be used - if (X11->desktopVersion == 4) { + if (qt_x11Data->desktopVersion == 4) { QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); fontDescription = kdeSettings.value(QLatin1String("font")).toString(); if (fontDescription.isEmpty()) { @@ -771,7 +770,7 @@ bool QApplicationPrivate::x11_apply_settings() // read new QStyle QString stylename = settings.value(QLatin1String("style")).toString(); - if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && X11->use_xrender) { + if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && qt_x11Data->use_xrender) { stylename = qt_guiPlatformPlugin()->styleName(); } @@ -833,7 +832,7 @@ bool QApplicationPrivate::x11_apply_settings() QApplication::setEffectEnabled(Qt::UI_AnimateToolBox, effects.contains(QLatin1String("animatetoolbox"))); - if (!X11->has_fontconfig) { + if (!qt_x11Data->has_fontconfig) { settings.beginGroup(QLatin1String("Font Substitutions")); QStringList fontsubs = settings.childKeys(); if (!fontsubs.isEmpty()) { @@ -872,7 +871,7 @@ static void qt_set_input_encoding() ulong nitems, after = 1; unsigned char *data = 0; - int e = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + int e = XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_QT_INPUT_ENCODING), 0, 1024, False, XA_STRING, &type, &format, &nitems, &after, &data); @@ -931,7 +930,7 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, while (after > 0) { uchar *data = 0; - if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(0), + if (XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(0), ATOM(RESOURCE_MANAGER), offset, 8192, False, AnyPropertyType, &type, &format, &nitems, &after, @@ -1030,7 +1029,7 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, if (resButton.isEmpty()) resButton = QString::fromLocal8Bit(button); if (!resFont.isEmpty() - && !X11->has_fontconfig + && !qt_x11Data->has_fontconfig && !QApplicationPrivate::sys_font) { // set application font QFont fnt; @@ -1063,7 +1062,7 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, QApplicationPrivate::setSystemFont(fnt); } // KDE sets it's own system palette - bool kdeColors = (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE); + bool kdeColors = (QApplication::desktopSettingsAware() && qt_x11Data->desktopEnvironment == DE_KDE); if (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty())) {// set app colors bool allowX11ColorNames = QColor::allowX11ColorNames(); QColor::setAllowX11ColorNames(true); @@ -1169,22 +1168,22 @@ static void qt_get_net_supported() unsigned long nitems, after; unsigned char *data = 0; - int e = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + int e = XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) XFree(data); - if (X11->net_supported_list) - delete [] X11->net_supported_list; - X11->net_supported_list = 0; + if (qt_x11Data->net_supported_list) + delete [] qt_x11Data->net_supported_list; + qt_x11Data->net_supported_list = 0; if (e == Success && type == XA_ATOM && format == 32) { QBuffer ts; ts.open(QIODevice::WriteOnly); while (after > 0) { - XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); @@ -1200,25 +1199,25 @@ static void qt_get_net_supported() // compute nitems QByteArray buffer(ts.buffer()); nitems = buffer.size() / sizeof(Atom); - X11->net_supported_list = new Atom[nitems + 1]; + qt_x11Data->net_supported_list = new Atom[nitems + 1]; Atom *a = (Atom *) buffer.data(); uint i; for (i = 0; i < nitems; i++) - X11->net_supported_list[i] = a[i]; - X11->net_supported_list[nitems] = 0; + qt_x11Data->net_supported_list[i] = a[i]; + qt_x11Data->net_supported_list[nitems] = 0; } } bool QX11Data::isSupportedByWM(Atom atom) { - if (!X11->net_supported_list) + if (!qt_x11Data->net_supported_list) return false; bool supported = false; int i = 0; - while (X11->net_supported_list[i] != 0) { - if (X11->net_supported_list[i++] == atom) { + while (qt_x11Data->net_supported_list[i] != 0) { + if (qt_x11Data->net_supported_list[i++] == atom) { supported = true; break; } @@ -1231,11 +1230,11 @@ bool QX11Data::isSupportedByWM(Atom atom) // update the virtual roots array static void qt_get_net_virtual_roots() { - if (X11->net_virtual_root_list) - delete [] X11->net_virtual_root_list; - X11->net_virtual_root_list = 0; + if (qt_x11Data->net_virtual_root_list) + delete [] qt_x11Data->net_virtual_root_list; + qt_x11Data->net_virtual_root_list = 0; - if (!X11->isSupportedByWM(ATOM(_NET_VIRTUAL_ROOTS))) + if (!qt_x11Data->isSupportedByWM(ATOM(_NET_VIRTUAL_ROOTS))) return; Atom type; @@ -1244,7 +1243,7 @@ static void qt_get_net_virtual_roots() unsigned long nitems, after; unsigned char *data; - int e = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + int e = XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_NET_VIRTUAL_ROOTS), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) @@ -1255,7 +1254,7 @@ static void qt_get_net_virtual_roots() ts.open(QIODevice::WriteOnly); while (after > 0) { - XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_NET_VIRTUAL_ROOTS), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); @@ -1271,12 +1270,12 @@ static void qt_get_net_virtual_roots() // compute nitems QByteArray buffer(ts.buffer()); nitems = buffer.size() / sizeof(Window); - X11->net_virtual_root_list = new Window[nitems + 1]; + qt_x11Data->net_virtual_root_list = new Window[nitems + 1]; Window *a = (Window *) buffer.data(); uint i; for (i = 0; i < nitems; i++) - X11->net_virtual_root_list[i] = a[i]; - X11->net_virtual_root_list[nitems] = 0; + qt_x11Data->net_virtual_root_list[i] = a[i]; + qt_x11Data->net_virtual_root_list[nitems] = 0; } } @@ -1286,8 +1285,8 @@ void qt_net_remove_user_time(QWidget *tlw) QTLWExtra *extra = tlw->d_func()->maybeTopData(); if (extra && extra->userTimeWindow) { Q_ASSERT(tlw->internalWinId()); - XDeleteProperty(X11->display, tlw->internalWinId(), ATOM(_NET_WM_USER_TIME_WINDOW)); - XDestroyWindow(X11->display, extra->userTimeWindow); + XDeleteProperty(qt_x11Data->display, tlw->internalWinId(), ATOM(_NET_WM_USER_TIME_WINDOW)); + XDestroyWindow(qt_x11Data->display, extra->userTimeWindow); extra->userTimeWindow = 0; } } @@ -1299,17 +1298,17 @@ void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp) Q_ASSERT(tlw->testAttribute(Qt::WA_WState_Created)); QTLWExtra *extra = tlw->d_func()->topData(); WId wid = tlw->internalWinId(); - const bool isSupportedByWM = X11->isSupportedByWM(ATOM(_NET_WM_USER_TIME_WINDOW)); + const bool isSupportedByWM = qt_x11Data->isSupportedByWM(ATOM(_NET_WM_USER_TIME_WINDOW)); if (extra->userTimeWindow || isSupportedByWM) { if (!extra->userTimeWindow) { - extra->userTimeWindow = XCreateSimpleWindow(X11->display, + extra->userTimeWindow = XCreateSimpleWindow(qt_x11Data->display, tlw->internalWinId(), -1, -1, 1, 1, 0, 0, 0); wid = extra->userTimeWindow; - XChangeProperty(X11->display, tlw->internalWinId(), ATOM(_NET_WM_USER_TIME_WINDOW), + XChangeProperty(qt_x11Data->display, tlw->internalWinId(), ATOM(_NET_WM_USER_TIME_WINDOW), XA_WINDOW, 32, PropModeReplace, (unsigned char *)&wid, 1); - XDeleteProperty(X11->display, tlw->internalWinId(), ATOM(_NET_WM_USER_TIME)); + XDeleteProperty(qt_x11Data->display, tlw->internalWinId(), ATOM(_NET_WM_USER_TIME)); } else if (!isSupportedByWM) { // WM no longer supports it, then we should remove the // _NET_WM_USER_TIME_WINDOW atom. @@ -1318,7 +1317,7 @@ void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp) wid = extra->userTimeWindow; } } - XChangeProperty(X11->display, wid, ATOM(_NET_WM_USER_TIME), + XChangeProperty(qt_x11Data->display, wid, ATOM(_NET_WM_USER_TIME), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) ×tamp, 1); } @@ -1326,11 +1325,11 @@ static void qt_check_focus_model() { Window fw = XNone; int unused; - XGetInputFocus(X11->display, &fw, &unused); + XGetInputFocus(qt_x11Data->display, &fw, &unused); if (fw == PointerRoot) - X11->focus_model = QX11Data::FM_PointerRoot; + qt_x11Data->focus_model = QX11Data::FM_PointerRoot; else - X11->focus_model = QX11Data::FM_Other; + qt_x11Data->focus_model = QX11Data::FM_Other; } /***************************************************************************** @@ -1340,7 +1339,7 @@ static void qt_check_focus_model() #if !defined(QT_NO_FONTCONFIG) static void getXDefault(const char *group, const char *key, int *val) { - char *str = XGetDefault(X11->display, group, key); + char *str = XGetDefault(qt_x11Data->display, group, key); if (str) { char *end = 0; int v = strtol(str, &end, 0); @@ -1354,7 +1353,7 @@ static void getXDefault(const char *group, const char *key, int *val) static void getXDefault(const char *group, const char *key, double *val) { - char *str = XGetDefault(X11->display, group, key); + char *str = XGetDefault(qt_x11Data->display, group, key); if (str) { bool ok; double v = QByteArray(str).toDouble(&ok); @@ -1365,7 +1364,7 @@ static void getXDefault(const char *group, const char *key, double *val) static void getXDefault(const char *group, const char *key, bool *val) { - char *str = XGetDefault(X11->display, group, key); + char *str = XGetDefault(qt_x11Data->display, group, key); if (str) { char c = str[0]; if (isupper((int)c)) @@ -1418,88 +1417,88 @@ bool runningUnderDebugger() void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual, Qt::HANDLE colormap) { - X11 = new QX11Data; - X11->display = display; - X11->displayName = 0; - X11->foreignDisplay = (display != 0); - X11->focus_model = -1; + qt_x11Data = new QX11Data; + qt_x11Data->display = display; + qt_x11Data->displayName = 0; + qt_x11Data->foreignDisplay = (display != 0); + qt_x11Data->focus_model = -1; // RANDR - X11->use_xrandr = false; - X11->xrandr_major = 0; - X11->xrandr_eventbase = 0; - X11->xrandr_errorbase = 0; + qt_x11Data->use_xrandr = false; + qt_x11Data->xrandr_major = 0; + qt_x11Data->xrandr_eventbase = 0; + qt_x11Data->xrandr_errorbase = 0; // RENDER - X11->use_xrender = false; - X11->xrender_major = 0; - X11->xrender_version = 0; + qt_x11Data->use_xrender = false; + qt_x11Data->xrender_major = 0; + qt_x11Data->xrender_version = 0; // XFIXES - X11->use_xfixes = false; - X11->xfixes_major = 0; - X11->xfixes_eventbase = 0; - X11->xfixes_errorbase = 0; + qt_x11Data->use_xfixes = false; + qt_x11Data->xfixes_major = 0; + qt_x11Data->xfixes_eventbase = 0; + qt_x11Data->xfixes_errorbase = 0; // XInputExtension - X11->use_xinput = false; - X11->xinput_major = 0; - X11->xinput_eventbase = 0; - X11->xinput_errorbase = 0; + qt_x11Data->use_xinput = false; + qt_x11Data->xinput_major = 0; + qt_x11Data->xinput_eventbase = 0; + qt_x11Data->xinput_errorbase = 0; // MIT-SHM - X11->use_mitshm = false; - X11->use_mitshm_pixmaps = false; - X11->mitshm_major = 0; + qt_x11Data->use_mitshm = false; + qt_x11Data->use_mitshm_pixmaps = false; + qt_x11Data->mitshm_major = 0; - X11->sip_serial = 0; - X11->net_supported_list = 0; - X11->net_virtual_root_list = 0; - X11->wm_client_leader = 0; - X11->screens = 0; - X11->argbVisuals = 0; - X11->argbColormaps = 0; - X11->screenCount = 0; - X11->time = CurrentTime; - X11->userTime = CurrentTime; - X11->ignore_badwindow = false; - X11->seen_badwindow = false; + qt_x11Data->sip_serial = 0; + qt_x11Data->net_supported_list = 0; + qt_x11Data->net_virtual_root_list = 0; + qt_x11Data->wm_client_leader = 0; + qt_x11Data->screens = 0; + qt_x11Data->argbVisuals = 0; + qt_x11Data->argbColormaps = 0; + qt_x11Data->screenCount = 0; + qt_x11Data->time = CurrentTime; + qt_x11Data->userTime = CurrentTime; + qt_x11Data->ignore_badwindow = false; + qt_x11Data->seen_badwindow = false; - X11->motifdnd_active = false; + qt_x11Data->motifdnd_active = false; // colormap control - X11->visual_class = -1; - X11->visual_id = -1; - X11->color_count = 0; - X11->custom_cmap = false; + qt_x11Data->visual_class = -1; + qt_x11Data->visual_id = -1; + qt_x11Data->color_count = 0; + qt_x11Data->custom_cmap = false; // outside visual/colormap - X11->visual = reinterpret_cast(visual); - X11->colormap = colormap; + qt_x11Data->visual = reinterpret_cast(visual); + qt_x11Data->colormap = colormap; // Fontconfig - X11->has_fontconfig = false; + qt_x11Data->has_fontconfig = false; #if !defined(QT_NO_FONTCONFIG) if (qgetenv("QT_X11_NO_FONTCONFIG").isNull()) - X11->has_fontconfig = FcInit(); - X11->fc_antialias = true; + qt_x11Data->has_fontconfig = FcInit(); + qt_x11Data->fc_antialias = true; #endif #ifndef QT_NO_XRENDER - memset(X11->solid_fills, 0, sizeof(X11->solid_fills)); - for (int i = 0; i < X11->solid_fill_count; ++i) - X11->solid_fills[i].screen = -1; - memset(X11->pattern_fills, 0, sizeof(X11->pattern_fills)); - for (int i = 0; i < X11->pattern_fill_count; ++i) - X11->pattern_fills[i].screen = -1; + memset(qt_x11Data->solid_fills, 0, sizeof(qt_x11Data->solid_fills)); + for (int i = 0; i < qt_x11Data->solid_fill_count; ++i) + qt_x11Data->solid_fills[i].screen = -1; + memset(qt_x11Data->pattern_fills, 0, sizeof(qt_x11Data->pattern_fills)); + for (int i = 0; i < qt_x11Data->pattern_fill_count; ++i) + qt_x11Data->pattern_fills[i].screen = -1; #endif - X11->startupId = 0; + qt_x11Data->startupId = 0; int argc = priv->argc; char **argv = priv->argv; - if (X11->display) { + if (qt_x11Data->display) { // Qt part of other application // Set application name and class @@ -1543,8 +1542,8 @@ void qt_init(QApplicationPrivate *priv, int, } QByteArray arg(argv[i]); if (arg == "-display") { - if (++i < argc && !X11->display) - X11->displayName = argv[i]; + if (++i < argc && !qt_x11Data->display) + qt_x11Data->displayName = argv[i]; } else if (arg == "-fn" || arg == "-font") { if (++i < argc) appFont = argv[i]; @@ -1566,33 +1565,30 @@ void qt_init(QApplicationPrivate *priv, int, } else if (arg == "-geometry") { if (++i < argc) mwGeometry = argv[i]; - } else if (arg == "-im") { - if (++i < argc) - qt_ximServer = argv[i]; } else if (arg == "-ncols") { // xv and netscape use this name if (++i < argc) - X11->color_count = qMax(0,atoi(argv[i])); + qt_x11Data->color_count = qMax(0,atoi(argv[i])); } else if (arg == "-visual") { // xv and netscape use this name - if (++i < argc && !X11->visual) { + if (++i < argc && !qt_x11Data->visual) { QString s = QString::fromLocal8Bit(argv[i]).toLower(); if (s == QLatin1String("staticgray")) - X11->visual_class = StaticGray; + qt_x11Data->visual_class = StaticGray; else if (s == QLatin1String("grayscale")) - X11->visual_class = XGrayScale; + qt_x11Data->visual_class = XGrayScale; else if (s == QLatin1String("staticcolor")) - X11->visual_class = StaticColor; + qt_x11Data->visual_class = StaticColor; else if (s == QLatin1String("pseudocolor")) - X11->visual_class = PseudoColor; + qt_x11Data->visual_class = PseudoColor; else if (s == QLatin1String("truecolor")) - X11->visual_class = TrueColor; + qt_x11Data->visual_class = TrueColor; else if (s == QLatin1String("directcolor")) - X11->visual_class = DirectColor; + qt_x11Data->visual_class = DirectColor; else - X11->visual_id = static_cast(strtol(argv[i], 0, 0)); + qt_x11Data->visual_id = static_cast(strtol(argv[i], 0, 0)); } } else if (arg == "-cmap") { // xv uses this name - if (!X11->colormap) - X11->custom_cmap = true; + if (!qt_x11Data->colormap) + qt_x11Data->custom_cmap = true; } else if (arg == "-sync") appSync = !appSync; @@ -1617,16 +1613,16 @@ void qt_init(QApplicationPrivate *priv, int, #endif // Connect to X server - if (qt_is_gui_used && !X11->display) { - if ((X11->display = XOpenDisplay(X11->displayName)) == 0) { + if (qt_is_gui_used && !qt_x11Data->display) { + if ((qt_x11Data->display = XOpenDisplay(qt_x11Data->displayName)) == 0) { qWarning("%s: cannot connect to X server %s", appName, - XDisplayName(X11->displayName)); + XDisplayName(qt_x11Data->displayName)); QApplicationPrivate::reset_instance_pointer(); exit(1); } if (appSync) // if "-sync" argument - XSynchronize(X11->display, true); + XSynchronize(qt_x11Data->display, true); } // Common code, regardless of whether display is foreign. @@ -1634,63 +1630,63 @@ void qt_init(QApplicationPrivate *priv, int, // Get X parameters if (qt_is_gui_used) { - X11->defaultScreen = DefaultScreen(X11->display); - X11->screenCount = ScreenCount(X11->display); + qt_x11Data->defaultScreen = DefaultScreen(qt_x11Data->display); + qt_x11Data->screenCount = ScreenCount(qt_x11Data->display); int formatCount = 0; - XPixmapFormatValues *values = XListPixmapFormats(X11->display, &formatCount); + XPixmapFormatValues *values = XListPixmapFormats(qt_x11Data->display, &formatCount); for (int i = 0; i < formatCount; ++i) - X11->bppForDepth[values[i].depth] = values[i].bits_per_pixel; + qt_x11Data->bppForDepth[values[i].depth] = values[i].bits_per_pixel; XFree(values); - X11->screens = new QX11InfoData[X11->screenCount]; - X11->argbVisuals = new Visual *[X11->screenCount]; - X11->argbColormaps = new Colormap[X11->screenCount]; + qt_x11Data->screens = new QX11InfoData[qt_x11Data->screenCount]; + qt_x11Data->argbVisuals = new Visual *[qt_x11Data->screenCount]; + qt_x11Data->argbColormaps = new Colormap[qt_x11Data->screenCount]; - for (int s = 0; s < X11->screenCount; s++) { - QX11InfoData *screen = X11->screens + s; + for (int s = 0; s < qt_x11Data->screenCount; s++) { + QX11InfoData *screen = qt_x11Data->screens + s; screen->ref = 1; // ensures it doesn't get deleted screen->screen = s; - int widthMM = DisplayWidthMM(X11->display, s); + int widthMM = DisplayWidthMM(qt_x11Data->display, s); if (widthMM != 0) { - screen->dpiX = (DisplayWidth(X11->display, s) * 254 + widthMM * 5) / (widthMM * 10); + screen->dpiX = (DisplayWidth(qt_x11Data->display, s) * 254 + widthMM * 5) / (widthMM * 10); } else { screen->dpiX = 72; } - int heightMM = DisplayHeightMM(X11->display, s); + int heightMM = DisplayHeightMM(qt_x11Data->display, s); if (heightMM != 0) { - screen->dpiY = (DisplayHeight(X11->display, s) * 254 + heightMM * 5) / (heightMM * 10); + screen->dpiY = (DisplayHeight(qt_x11Data->display, s) * 254 + heightMM * 5) / (heightMM * 10); } else { screen->dpiY = 72; } - X11->argbVisuals[s] = 0; - X11->argbColormaps[s] = 0; + qt_x11Data->argbVisuals[s] = 0; + qt_x11Data->argbColormaps[s] = 0; } #ifndef QT_NO_XRENDER int xrender_eventbase, xrender_errorbase; // See if XRender is supported on the connected display - if (XQueryExtension(X11->display, "RENDER", &X11->xrender_major, + if (XQueryExtension(qt_x11Data->display, "RENDER", &qt_x11Data->xrender_major, &xrender_eventbase, &xrender_errorbase) - && XRenderQueryExtension(X11->display, &xrender_eventbase, + && XRenderQueryExtension(qt_x11Data->display, &xrender_eventbase, &xrender_errorbase)) { // Check the version as well - we need v0.4 or higher int major = 0; int minor = 0; - XRenderQueryVersion(X11->display, &major, &minor); + XRenderQueryVersion(qt_x11Data->display, &major, &minor); if (qgetenv("QT_X11_NO_XRENDER").isNull()) { - X11->use_xrender = (major >= 0 && minor >= 5); - X11->xrender_version = major*100+minor; + qt_x11Data->use_xrender = (major >= 0 && minor >= 5); + qt_x11Data->xrender_version = major*100+minor; // workaround for broken XServer on Ubuntu Breezy (6.8 compiled with 7.0 // protocol headers) - if (X11->xrender_version == 10 - && VendorRelease(X11->display) < 60900000 - && QByteArray(ServerVendor(X11->display)).contains("X.Org")) - X11->xrender_version = 9; + if (qt_x11Data->xrender_version == 10 + && VendorRelease(qt_x11Data->display) < 60900000 + && QByteArray(ServerVendor(qt_x11Data->display)).contains("X.Org")) + qt_x11Data->xrender_version = 9; } } #endif // QT_NO_XRENDER @@ -1701,9 +1697,9 @@ void qt_init(QApplicationPrivate *priv, int, int mitshm_eventbase; int mitshm_errorbase; int mitshm_pixmaps; - if (XQueryExtension(X11->display, "MIT-SHM", &X11->mitshm_major, + if (XQueryExtension(qt_x11Data->display, "MIT-SHM", &qt_x11Data->mitshm_major, &mitshm_eventbase, &mitshm_errorbase) - && XShmQueryVersion(X11->display, &mitshm_major, &mitshm_minor, + && XShmQueryVersion(qt_x11Data->display, &mitshm_major, &mitshm_minor, &mitshm_pixmaps)) { QString displayName = QLatin1String(XDisplayName(NULL)); @@ -1714,14 +1710,14 @@ void qt_init(QApplicationPrivate *priv, int, // engine to work on a QImage with BGR layout. bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0; if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) { - Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display)); - X11->use_mitshm = ((defaultVisual->red_mask == 0xff0000 + Visual *defaultVisual = DefaultVisual(qt_x11Data->display, DefaultScreen(qt_x11Data->display)); + qt_x11Data->use_mitshm = ((defaultVisual->red_mask == 0xff0000 || defaultVisual->red_mask == 0xf800) && (defaultVisual->green_mask == 0xff00 || defaultVisual->green_mask == 0x7e0) && (defaultVisual->blue_mask == 0xff || defaultVisual->blue_mask == 0x1f)); - X11->use_mitshm_pixmaps = X11->use_mitshm && mitshm_pixmaps; + qt_x11Data->use_mitshm_pixmaps = qt_x11Data->use_mitshm && mitshm_pixmaps; } } #endif // QT_NO_XSHM @@ -1732,7 +1728,7 @@ void qt_init(QApplicationPrivate *priv, int, QColormap::initialize(); // Support protocols - X11->xdndSetup(); + qt_x11Data->xdndSetup(); // Finally create all atoms qt_x11_create_intern_atoms(); @@ -1743,36 +1739,36 @@ void qt_init(QApplicationPrivate *priv, int, #ifndef QT_NO_XRANDR // See if XRandR is supported on the connected display - if (XQueryExtension(X11->display, "RANDR", &X11->xrandr_major, - &X11->xrandr_eventbase, &X11->xrandr_errorbase)) { + if (XQueryExtension(qt_x11Data->display, "RANDR", &qt_x11Data->xrandr_major, + &qt_x11Data->xrandr_eventbase, &qt_x11Data->xrandr_errorbase)) { - if (XRRQueryExtension(X11->display, &X11->xrandr_eventbase, &X11->xrandr_errorbase)) { + if (XRRQueryExtension(qt_x11Data->display, &qt_x11Data->xrandr_eventbase, &qt_x11Data->xrandr_errorbase)) { // XRandR is supported - X11->use_xrandr = true; + qt_x11Data->use_xrandr = true; } } #endif // QT_NO_XRANDR #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { // XRender is supported, let's see if we have a PictFormat for the // default visual XRenderPictFormat *format = - XRenderFindVisualFormat(X11->display, - (Visual *) QX11Info::appVisual(X11->defaultScreen)); + XRenderFindVisualFormat(qt_x11Data->display, + (Visual *) QX11Info::appVisual(qt_x11Data->defaultScreen)); if (!format) { - X11->use_xrender = false; + qt_x11Data->use_xrender = false; } } #endif // QT_NO_XRENDER #ifndef QT_NO_XFIXES // See if Xfixes is supported on the connected display - if (XQueryExtension(X11->display, "XFIXES", &X11->xfixes_major, - &X11->xfixes_eventbase, &X11->xfixes_errorbase)) { - if(XFixesQueryExtension(X11->display, &X11->xfixes_eventbase, - &X11->xfixes_errorbase)) { + if (XQueryExtension(qt_x11Data->display, "XFIXES", &qt_x11Data->xfixes_major, + &qt_x11Data->xfixes_eventbase, &qt_x11Data->xfixes_errorbase)) { + if(XFixesQueryExtension(qt_x11Data->display, &qt_x11Data->xfixes_eventbase, + &qt_x11Data->xfixes_errorbase)) { // Xfixes is supported. // Note: the XFixes protocol version is negotiated using QueryVersion. // We supply the highest version we support, the X server replies with @@ -1782,9 +1778,9 @@ void qt_init(QApplicationPrivate *priv, int, // X server when it receives an XFixes request is undefined. int major = 3; int minor = 0; - XFixesQueryVersion(X11->display, &major, &minor); - X11->use_xfixes = (major >= 1); - X11->xfixes_major = major; + XFixesQueryVersion(qt_x11Data->display, &major, &minor); + qt_x11Data->use_xfixes = (major >= 1); + qt_x11Data->xfixes_major = major; } } #endif // QT_NO_XFIXES @@ -1792,33 +1788,33 @@ void qt_init(QApplicationPrivate *priv, int, #ifndef QT_NO_XSYNC int xsync_evbase, xsync_errbase; int major, minor; - if (XSyncQueryExtension(X11->display, &xsync_evbase, &xsync_errbase)) - XSyncInitialize(X11->display, &major, &minor); + if (XSyncQueryExtension(qt_x11Data->display, &xsync_evbase, &xsync_errbase)) + XSyncInitialize(qt_x11Data->display, &major, &minor); #endif // QT_NO_XSYNC #ifndef QT_NO_XINPUT // See if Xinput is supported on the connected display - X11->use_xinput = XQueryExtension(X11->display, "XInputExtension", &X11->xinput_major, - &X11->xinput_eventbase, &X11->xinput_errorbase); + qt_x11Data->use_xinput = XQueryExtension(qt_x11Data->display, "XInputExtension", &qt_x11Data->xinput_major, + &qt_x11Data->xinput_eventbase, &qt_x11Data->xinput_errorbase); #endif // QT_NO_XINPUT #if !defined(QT_NO_FONTCONFIG) int dpi = 0; getXDefault("Xft", FC_DPI, &dpi); if (dpi) { - for (int s = 0; s < ScreenCount(X11->display); ++s) { + for (int s = 0; s < ScreenCount(qt_x11Data->display); ++s) { QX11Info::setAppDpiX(s, dpi); QX11Info::setAppDpiY(s, dpi); } } double fc_scale = 1.; getXDefault("Xft", FC_SCALE, &fc_scale); - X11->fc_scale = fc_scale; - for (int s = 0; s < ScreenCount(X11->display); ++s) { + qt_x11Data->fc_scale = fc_scale; + for (int s = 0; s < ScreenCount(qt_x11Data->display); ++s) { int subpixel = FC_RGBA_UNKNOWN; #if !defined(QT_NO_XRENDER) && (RENDER_MAJOR > 0 || RENDER_MINOR >= 6) - if (X11->use_xrender) { - int rsp = XRenderQuerySubpixelOrder(X11->display, s); + if (qt_x11Data->use_xrender) { + int rsp = XRenderQuerySubpixelOrder(qt_x11Data->display, s); switch (rsp) { default: case SubPixelUnknown: @@ -1843,7 +1839,7 @@ void qt_init(QApplicationPrivate *priv, int, } #endif - char *rgba = XGetDefault(X11->display, "Xft", FC_RGBA); + char *rgba = XGetDefault(qt_x11Data->display, "Xft", FC_RGBA); if (rgba) { char *end = 0; int v = strtol(rgba, &end, 0); @@ -1863,18 +1859,18 @@ void qt_init(QApplicationPrivate *priv, int, subpixel = FC_RGBA_NONE; } } - X11->screens[s].subpixel = subpixel; + qt_x11Data->screens[s].subpixel = subpixel; } - getXDefault("Xft", FC_ANTIALIAS, &X11->fc_antialias); + getXDefault("Xft", FC_ANTIALIAS, &qt_x11Data->fc_antialias); #ifdef FC_HINT_STYLE - X11->fc_hint_style = -1; - getXDefault("Xft", FC_HINT_STYLE, &X11->fc_hint_style); + qt_x11Data->fc_hint_style = -1; + getXDefault("Xft", FC_HINT_STYLE, &qt_x11Data->fc_hint_style); #endif #if 0 // ###### these are implemented by Xft, not sure we need them - getXDefault("Xft", FC_AUTOHINT, &X11->fc_autohint); - getXDefault("Xft", FC_HINTING, &X11->fc_autohint); - getXDefault("Xft", FC_MINSPACE, &X11->fc_autohint); + getXDefault("Xft", FC_AUTOHINT, &qt_x11Data->fc_autohint); + getXDefault("Xft", FC_HINTING, &qt_x11Data->fc_autohint); + getXDefault("Xft", FC_MINSPACE, &qt_x11Data->fc_autohint); #endif #endif // QT_NO_XRENDER @@ -1889,13 +1885,13 @@ void qt_init(QApplicationPrivate *priv, int, if(qt_is_gui_used) { qApp->setObjectName(QString::fromLocal8Bit(appName)); - for (int screen = 0; screen < X11->screenCount; ++screen) { - XSelectInput(X11->display, QX11Info::appRootWindow(screen), + for (int screen = 0; screen < qt_x11Data->screenCount; ++screen) { + XSelectInput(qt_x11Data->display, QX11Info::appRootWindow(screen), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); #ifndef QT_NO_XRANDR - if (X11->use_xrandr) - XRRSelectInput(X11->display, QX11Info::appRootWindow(screen), True); + if (qt_x11Data->use_xrandr) + XRRSelectInput(qt_x11Data->display, QX11Info::appRootWindow(screen), True); #endif // QT_NO_XRANDR } } @@ -1905,15 +1901,15 @@ void qt_init(QApplicationPrivate *priv, int, // Use dbus if/when we can, but fall back to using windowManagerName() for now #ifndef QT_NO_XFIXES - XFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0), + XFixesSelectSelectionInput(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0), XFixesSetSelectionOwnerNotifyMask | XFixesSelectionWindowDestroyNotifyMask | XFixesSelectionClientCloseNotifyMask); #endif // QT_NO_XFIXES - X11->compositingManagerRunning = XGetSelectionOwner(X11->display, + qt_x11Data->compositingManagerRunning = XGetSelectionOwner(qt_x11Data->display, ATOM(_NET_WM_CM_S0)); - X11->desktopEnvironment = DE_UNKNOWN; - X11->desktopVersion = 0; + qt_x11Data->desktopEnvironment = DE_UNKNOWN; + qt_x11Data->desktopVersion = 0; Atom type; int format; @@ -1923,30 +1919,30 @@ void qt_init(QApplicationPrivate *priv, int, do { if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { - X11->desktopEnvironment = DE_KDE; - X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt(); + qt_x11Data->desktopEnvironment = DE_KDE; + qt_x11Data->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt(); break; } if (qgetenv("DESKTOP_SESSION") == "gnome") { - X11->desktopEnvironment = DE_GNOME; + qt_x11Data->desktopEnvironment = DE_GNOME; break; } // GNOME_DESKTOP_SESSION_ID is deprecated for some reason, but still check it if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty()) { - X11->desktopEnvironment = DE_GNOME; + qt_x11Data->desktopEnvironment = DE_GNOME; break; } - rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE), + rc = XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE), 0, 2, False, XA_STRING, &type, &format, &length, &after, &data); if (rc == Success && length) { if (!strcmp(reinterpret_cast(data), "xfce4")) { // Pretend that xfce4 is gnome, as it uses the same libraries. // The detection above is stolen from xdg-open. - X11->desktopEnvironment = DE_GNOME; + qt_x11Data->desktopEnvironment = DE_GNOME; break; } @@ -1955,12 +1951,12 @@ void qt_init(QApplicationPrivate *priv, int, data = 0; } - rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), + rc = XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), 0, 1, False, AnyPropertyType, &type, &format, &length, &after, &data); if (rc == Success && length) { // DTWM is running, meaning most likely CDE is running... - X11->desktopEnvironment = DE_CDE; + qt_x11Data->desktopEnvironment = DE_CDE; break; } } while(0); @@ -1977,20 +1973,20 @@ void qt_init(QApplicationPrivate *priv, int, // 75dpi (12 pixels) and 100dpi (17 pixels). // At 95 DPI, a 12 point font should be 16 pixels tall - in which case a 17 // pixel font is a closer match than a 12 pixel font - int ptsz = (X11->use_xrender + int ptsz = (qt_x11Data->use_xrender ? 9 : (int) (((QX11Info::appDpiY() >= 95 ? 17. : 12.) * 72. / (float) QX11Info::appDpiY()) + 0.5)); if (!QApplicationPrivate::sys_font) { // no font from settings or RESOURCE_MANAGER, provide a fallback - QFont f(X11->has_fontconfig ? QLatin1String("Sans Serif") : QLatin1String("Helvetica"), + QFont f(qt_x11Data->has_fontconfig ? QLatin1String("Sans Serif") : QLatin1String("Helvetica"), ptsz); QApplicationPrivate::setSystemFont(f); } - X11->startupId = getenv("DESKTOP_STARTUP_ID"); - if (X11->startupId) { + qt_x11Data->startupId = getenv("DESKTOP_STARTUP_ID"); + if (qt_x11Data->startupId) { #ifndef QT_NO_UNSETENV unsetenv("DESKTOP_STARTUP_ID"); #else @@ -2045,38 +2041,38 @@ void qt_cleanup() } #ifndef QT_NO_XRENDER - for (int i = 0; i < X11->solid_fill_count; ++i) { - if (X11->solid_fills[i].picture) - XRenderFreePicture(X11->display, X11->solid_fills[i].picture); + for (int i = 0; i < qt_x11Data->solid_fill_count; ++i) { + if (qt_x11Data->solid_fills[i].picture) + XRenderFreePicture(qt_x11Data->display, qt_x11Data->solid_fills[i].picture); } - for (int i = 0; i < X11->pattern_fill_count; ++i) { - if (X11->pattern_fills[i].picture) - XRenderFreePicture(X11->display, X11->pattern_fills[i].picture); + for (int i = 0; i < qt_x11Data->pattern_fill_count; ++i) { + if (qt_x11Data->pattern_fills[i].picture) + XRenderFreePicture(qt_x11Data->display, qt_x11Data->pattern_fills[i].picture); } #endif // Reset the error handlers if (qt_is_gui_used) - XSync(X11->display, False); // sync first to process all possible errors + XSync(qt_x11Data->display, False); // sync first to process all possible errors XSetErrorHandler(original_x_errhandler); XSetIOErrorHandler(original_xio_errhandler); - if (X11->argbColormaps) { - for (int s = 0; s < X11->screenCount; s++) { - if (X11->argbColormaps[s]) - XFreeColormap(X11->display, X11->argbColormaps[s]); + if (qt_x11Data->argbColormaps) { + for (int s = 0; s < qt_x11Data->screenCount; s++) { + if (qt_x11Data->argbColormaps[s]) + XFreeColormap(qt_x11Data->display, qt_x11Data->argbColormaps[s]); } } - if (qt_is_gui_used && !X11->foreignDisplay) - XCloseDisplay(X11->display); // close X display - X11->display = 0; + if (qt_is_gui_used && !qt_x11Data->foreignDisplay) + XCloseDisplay(qt_x11Data->display); // close X display + qt_x11Data->display = 0; - delete [] X11->screens; - delete [] X11->argbVisuals; - delete [] X11->argbColormaps; + delete [] qt_x11Data->screens; + delete [] qt_x11Data->argbVisuals; + delete [] qt_x11Data->argbColormaps; - if (X11->foreignDisplay) { + if (qt_x11Data->foreignDisplay) { delete [] (char *)appName; appName = 0; } @@ -2084,16 +2080,16 @@ void qt_cleanup() delete [] (char *)appClass; appClass = 0; - if (X11->net_supported_list) - delete [] X11->net_supported_list; - X11->net_supported_list = 0; + if (qt_x11Data->net_supported_list) + delete [] qt_x11Data->net_supported_list; + qt_x11Data->net_supported_list = 0; - if (X11->net_virtual_root_list) - delete [] X11->net_virtual_root_list; - X11->net_virtual_root_list = 0; + if (qt_x11Data->net_virtual_root_list) + delete [] qt_x11Data->net_virtual_root_list; + qt_x11Data->net_virtual_root_list = 0; - delete X11; - X11 = 0; + delete qt_x11Data; + qt_x11Data = 0; } @@ -2134,9 +2130,9 @@ void QApplicationPrivate::applyX11SpecificCommandLineArguments(QWidget *main_wid beenHereDoneThat = true; Q_ASSERT(main_widget->testAttribute(Qt::WA_WState_Created)); if (mwTitle) { - XStoreName(X11->display, main_widget->effectiveWinId(), (char*)mwTitle); + XStoreName(qt_x11Data->display, main_widget->effectiveWinId(), (char*)mwTitle); QByteArray net_wm_name = QString::fromLocal8Bit(mwTitle).toUtf8(); - XChangeProperty(X11->display, main_widget->effectiveWinId(), ATOM(_NET_WM_NAME), ATOM(UTF8_STRING), 8, + XChangeProperty(qt_x11Data->display, main_widget->effectiveWinId(), ATOM(_NET_WM_NAME), ATOM(UTF8_STRING), 8, PropModeReplace, (unsigned char *)net_wm_name.data(), net_wm_name.size()); } if (mwGeometry) { // parse geometry @@ -2182,7 +2178,7 @@ void QApplication::setOverrideCursor(const QCursor &cursor) if ((it->testAttribute(Qt::WA_SetCursor) || it->isWindow()) && (it->windowType() != Qt::Desktop)) qt_x11_enforce_cursor(it, false); } - XFlush(X11->display); // make X execute it NOW + XFlush(qt_x11Data->display); // make X execute it NOW } void QApplication::restoreOverrideCursor() @@ -2196,7 +2192,7 @@ void QApplication::restoreOverrideCursor() if ((it->testAttribute(Qt::WA_SetCursor) || it->isWindow()) && (it->windowType() != Qt::Desktop)) qt_x11_enforce_cursor(it, false); } - XFlush(X11->display); + XFlush(qt_x11Data->display); } } @@ -2215,20 +2211,20 @@ Window QX11Data::findClientWindow(Window win, Atom property, bool leaf) uchar *data = 0; Window root, parent, target=0, *children=0; uint nchildren; - if (XGetWindowProperty(X11->display, win, property, 0, 0, false, AnyPropertyType, + if (XGetWindowProperty(qt_x11Data->display, win, property, 0, 0, false, AnyPropertyType, &type, &format, &nitems, &after, &data) == Success) { if (data) XFree((char *)data); if (type) return win; } - if (!XQueryTree(X11->display,win,&root,&parent,&children,&nchildren)) { + if (!XQueryTree(qt_x11Data->display,win,&root,&parent,&children,&nchildren)) { if (children) XFree((char *)children); return 0; } for (i=nchildren-1; !target && i >= 0; i--) - target = X11->findClientWindow(children[i], property, leaf); + target = qt_x11Data->findClientWindow(children[i], property, leaf); if (children) XFree((char *)children); return target; @@ -2246,7 +2242,7 @@ QWidget *QApplication::topLevelAt(const QPoint &p) int x = p.x(); int y = p.y(); Window target; - if (!XTranslateCoordinates(X11->display, + if (!XTranslateCoordinates(qt_x11Data->display, QX11Info::appRootWindow(screen), QX11Info::appRootWindow(screen), x, y, &unused, &unused, &target)) { @@ -2258,9 +2254,9 @@ QWidget *QApplication::topLevelAt(const QPoint &p) w = QWidget::find((WId)target); if (!w) { - X11->ignoreBadwindow(); - target = X11->findClientWindow(target, ATOM(WM_STATE), true); - if (X11->badwindow()) + qt_x11Data->ignoreBadwindow(); + target = qt_x11Data->findClientWindow(target, ATOM(WM_STATE), true); + if (qt_x11Data->badwindow()) return 0; w = QWidget::find((WId)target); if (!w) { @@ -2274,11 +2270,11 @@ QWidget *QApplication::topLevelAt(const QPoint &p) Q_ASSERT(widget->testAttribute(Qt::WA_WState_Created)); Window wid = widget->internalWinId(); while (ctarget && !w) { - X11->ignoreBadwindow(); - if (!XTranslateCoordinates(X11->display, + qt_x11Data->ignoreBadwindow(); + if (!XTranslateCoordinates(qt_x11Data->display, QX11Info::appRootWindow(screen), ctarget, x, y, &unused, &unused, &ctarget) - || X11->badwindow()) + || qt_x11Data->badwindow()) break; if (ctarget == wid) { // Found! @@ -2298,15 +2294,15 @@ QWidget *QApplication::topLevelAt(const QPoint &p) void QApplication::syncX() { - if (X11->display) - XSync(X11->display, False); // don't discard events + if (qt_x11Data->display) + XSync(qt_x11Data->display, False); // don't discard events } void QApplication::beep() { - if (X11->display) - XBell(X11->display, 0); + if (qt_x11Data->display) + XBell(qt_x11Data->display, 0); else printf("\7"); } @@ -2365,10 +2361,10 @@ Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() Window child; int root_x, root_y, win_x, win_y; uint keybstate; - for (int i = 0; i < ScreenCount(X11->display); ++i) { - if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child, + for (int i = 0; i < ScreenCount(qt_x11Data->display); ++i) { + if (XQueryPointer(qt_x11Data->display, QX11Info::appRootWindow(i), &root, &child, &root_x, &root_y, &win_x, &win_y, &keybstate)) - return X11->translateModifiers(keybstate & 0x00ff); + return qt_x11Data->translateModifiers(keybstate & 0x00ff); } return 0; @@ -2429,8 +2425,8 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) widget->translateCloseEvent(event); } else if (a == ATOM(WM_TAKE_FOCUS)) { - if ((ulong) event->xclient.data.l[1] > X11->time) - X11->time = event->xclient.data.l[1]; + if ((ulong) event->xclient.data.l[1] > qt_x11Data->time) + qt_x11Data->time = event->xclient.data.l[1]; QWidget *amw = activeModalWidget(); if (amw && amw->testAttribute(Qt::WA_X11DoNotAcceptFocus)) amw = 0; @@ -2438,7 +2434,7 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) QWidget *p = amw->parentWidget(); while (p && p != widget) p = p->parentWidget(); - if (!p || !X11->net_supported_list) + if (!p || !qt_x11Data->net_supported_list) amw->raise(); // help broken window managers amw->activateWindow(); } @@ -2448,7 +2444,7 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) #endif // QT_NO_WHATSTHIS } else if (a == ATOM(_NET_WM_PING)) { // avoid send/reply loops - Window root = RootWindow(X11->display, w->x11Info().screen()); + Window root = RootWindow(qt_x11Data->display, w->x11Info().screen()); if (event->xclient.window != root) { event->xclient.window = root; XSendEvent(event->xclient.display, event->xclient.window, @@ -2457,8 +2453,8 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) #ifndef QT_NO_XSYNC } else if (a == ATOM(_NET_WM_SYNC_REQUEST)) { const ulong timestamp = (const ulong) event->xclient.data.l[1]; - if (timestamp > X11->time) - X11->time = timestamp; + if (timestamp > qt_x11Data->time) + qt_x11Data->time = timestamp; if (QTLWExtra *tlw = w->d_func()->maybeTopData()) { if (timestamp == CurrentTime || timestamp > tlw->syncRequestTimestamp) { tlw->syncRequestTimestamp = timestamp; @@ -2471,23 +2467,23 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) } else if (event->xclient.message_type == ATOM(_QT_SCROLL_DONE)) { widget->translateScrollDoneEvent(event); } else if (event->xclient.message_type == ATOM(XdndPosition)) { - X11->xdndHandlePosition(widget, event, passive_only); + qt_x11Data->xdndHandlePosition(widget, event, passive_only); } else if (event->xclient.message_type == ATOM(XdndEnter)) { - X11->xdndHandleEnter(widget, event, passive_only); + qt_x11Data->xdndHandleEnter(widget, event, passive_only); } else if (event->xclient.message_type == ATOM(XdndStatus)) { - X11->xdndHandleStatus(widget, event, passive_only); + qt_x11Data->xdndHandleStatus(widget, event, passive_only); } else if (event->xclient.message_type == ATOM(XdndLeave)) { - X11->xdndHandleLeave(widget, event, passive_only); + qt_x11Data->xdndHandleLeave(widget, event, passive_only); } else if (event->xclient.message_type == ATOM(XdndDrop)) { - X11->xdndHandleDrop(widget, event, passive_only); + qt_x11Data->xdndHandleDrop(widget, event, passive_only); } else if (event->xclient.message_type == ATOM(XdndFinished)) { - X11->xdndHandleFinished(widget, event, passive_only); + qt_x11Data->xdndHandleFinished(widget, event, passive_only); } else { if (passive_only) return 0; // All other are interactions } } else { - X11->motifdndHandle(widget, event, passive_only); + qt_x11Data->motifdndHandle(widget, event, passive_only); } return 0; @@ -2504,40 +2500,40 @@ int QApplication::x11ProcessEvent(XEvent* event) switch (event->type) { case ButtonPress: pressed_window = event->xbutton.window; - X11->userTime = event->xbutton.time; + qt_x11Data->userTime = event->xbutton.time; // fallthrough intended case ButtonRelease: - X11->time = event->xbutton.time; + qt_x11Data->time = event->xbutton.time; break; case MotionNotify: - X11->time = event->xmotion.time; + qt_x11Data->time = event->xmotion.time; break; case XKeyPress: - X11->userTime = event->xkey.time; + qt_x11Data->userTime = event->xkey.time; // fallthrough intended case XKeyRelease: - X11->time = event->xkey.time; + qt_x11Data->time = event->xkey.time; break; case PropertyNotify: - X11->time = event->xproperty.time; + qt_x11Data->time = event->xproperty.time; break; case EnterNotify: case LeaveNotify: - X11->time = event->xcrossing.time; + qt_x11Data->time = event->xcrossing.time; break; case SelectionClear: - X11->time = event->xselectionclear.time; + qt_x11Data->time = event->xselectionclear.time; break; default: break; } #ifndef QT_NO_XFIXES - if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) { + if (qt_x11Data->use_xfixes && event->type == (qt_x11Data->xfixes_eventbase + XFixesSelectionNotify)) { XFixesSelectionNotifyEvent *req = reinterpret_cast(event); - X11->time = req->selection_timestamp; + qt_x11Data->time = req->selection_timestamp; if (req->selection == ATOM(_NET_WM_CM_S0)) - X11->compositingManagerRunning = req->owner; + qt_x11Data->compositingManagerRunning = req->owner; } #endif @@ -2629,17 +2625,17 @@ int QApplication::x11ProcessEvent(XEvent* event) return 1; #ifndef QT_NO_XRANDR - if (X11->use_xrandr && event->type == (X11->xrandr_eventbase + RRScreenChangeNotify)) { + if (qt_x11Data->use_xrandr && event->type == (qt_x11Data->xrandr_eventbase + RRScreenChangeNotify)) { // update Xlib internals with the latest screen configuration XRRUpdateConfiguration(event); // update the size for desktop widget - int scr = XRRRootToScreen(X11->display, event->xany.window); + int scr = XRRRootToScreen(qt_x11Data->display, event->xany.window); QDesktopWidget *desktop = QApplication::desktop(); QWidget *w = desktop->screen(scr); QSize oldSize(w->size()); - w->data->crect.setWidth(DisplayWidth(X11->display, scr)); - w->data->crect.setHeight(DisplayHeight(X11->display, scr)); + w->data->crect.setWidth(DisplayWidth(qt_x11Data->display, scr)); + w->data->crect.setHeight(DisplayHeight(qt_x11Data->display, scr)); QResizeEvent e(w->size(), oldSize); QApplication::sendEvent(w, &e); if (w != desktop) @@ -2648,7 +2644,7 @@ int QApplication::x11ProcessEvent(XEvent* event) #endif // QT_NO_XRANDR #ifndef QT_NO_XFIXES - if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) { + if (qt_x11Data->use_xfixes && event->type == (qt_x11Data->xfixes_eventbase + XFixesSelectionNotify)) { XFixesSelectionNotifyEvent *req = reinterpret_cast(event); // compress all XFixes events related to this selection @@ -2656,7 +2652,7 @@ int QApplication::x11ProcessEvent(XEvent* event) qt_xfixes_selection_event_data xfixes_event; xfixes_event.selection = req->selection; for (XEvent ev;;) { - if (!XCheckIfEvent(X11->display, &ev, &qt_xfixes_scanner, (XPointer)&xfixes_event)) + if (!XCheckIfEvent(qt_x11Data->display, &ev, &qt_xfixes_scanner, (XPointer)&xfixes_event)) break; } @@ -2682,14 +2678,14 @@ int QApplication::x11ProcessEvent(XEvent* event) break; // fall through intended case ButtonPress: - if (event->xbutton.root != RootWindow(X11->display, widget->x11Info().screen()) + if (event->xbutton.root != RootWindow(qt_x11Data->display, widget->x11Info().screen()) && ! qt_xdnd_dragging) { while (activePopupWidget()) activePopupWidget()->close(); return 1; } if (event->type == ButtonPress) - qt_net_update_user_time(widget->window(), X11->userTime); + qt_net_update_user_time(widget->window(), qt_x11Data->userTime); // fall through intended case MotionNotify: if (widget->testAttribute(Qt::WA_TransparentForMouseEvents)) { @@ -2708,7 +2704,7 @@ int QApplication::x11ProcessEvent(XEvent* event) break; case XKeyPress: // keyboard event - qt_net_update_user_time(widget->window(), X11->userTime); + qt_net_update_user_time(widget->window(), qt_x11Data->userTime); // fallthrough intended case XKeyRelease: { @@ -2741,7 +2737,7 @@ int QApplication::x11ProcessEvent(XEvent* event) event->xfocus.detail != NotifyNonlinear) break; setActiveWindow(widget); - if (X11->focus_model == QX11Data::FM_PointerRoot) { + if (qt_x11Data->focus_model == QX11Data::FM_PointerRoot) { // We got real input focus from somewhere, but we were in PointerRoot // mode, so we don't trust this event. Check the focus model to make // sure we know what focus mode we are using... @@ -2766,7 +2762,7 @@ int QApplication::x11ProcessEvent(XEvent* event) if (!d->inPopupMode() && widget == QApplicationPrivate::active_window) { XEvent ev; bool focus_will_change = false; - if (XCheckTypedEvent(X11->display, XFocusIn, &ev)) { + if (XCheckTypedEvent(qt_x11Data->display, XFocusIn, &ev)) { // we're about to get an XFocusIn, if we know we will // get a new active window, we don't want to set the // active window to 0 now @@ -2780,7 +2776,7 @@ int QApplication::x11ProcessEvent(XEvent* event) || ev.xfocus.detail == NotifyNonlinear)) focus_will_change = true; - XPutBackEvent(X11->display, &ev); + XPutBackEvent(qt_x11Data->display, &ev); } if (!focus_will_change) setActiveWindow(0); @@ -2797,9 +2793,9 @@ int QApplication::x11ProcessEvent(XEvent* event) break; if (event->xcrossing.focus && !(widget->windowType() == Qt::Desktop) && !widget->isActiveWindow()) { - if (X11->focus_model == QX11Data::FM_Unknown) // check focus model + if (qt_x11Data->focus_model == QX11Data::FM_Unknown) // check focus model qt_check_focus_model(); - if (X11->focus_model == QX11Data::FM_PointerRoot) // PointerRoot mode + if (qt_x11Data->focus_model == QX11Data::FM_PointerRoot) // PointerRoot mode setActiveWindow(widget); } @@ -2840,7 +2836,7 @@ int QApplication::x11ProcessEvent(XEvent* event) QWidget* enter = 0; QPoint enterPoint; XEvent ev; - while (XCheckMaskEvent(X11->display, EnterWindowMask | LeaveWindowMask , &ev) + while (XCheckMaskEvent(qt_x11Data->display, EnterWindowMask | LeaveWindowMask , &ev) && !qt_x11EventFilter(&ev)) { QWidget* event_widget = QWidget::find(ev.xcrossing.window); if(event_widget && event_widget->x11Event(&ev)) @@ -2856,9 +2852,9 @@ int QApplication::x11ProcessEvent(XEvent* event) enterPoint = enter->d_func()->mapFromWS(QPoint(ev.xcrossing.x, ev.xcrossing.y)); if (ev.xcrossing.focus && enter && !(enter->windowType() == Qt::Desktop) && !enter->isActiveWindow()) { - if (X11->focus_model == QX11Data::FM_Unknown) // check focus model + if (qt_x11Data->focus_model == QX11Data::FM_Unknown) // check focus model qt_check_focus_model(); - if (X11->focus_model == QX11Data::FM_PointerRoot) // PointerRoot mode + if (qt_x11Data->focus_model == QX11Data::FM_PointerRoot) // PointerRoot mode setActiveWindow(enter); } break; @@ -2866,7 +2862,7 @@ int QApplication::x11ProcessEvent(XEvent* event) if ((! enter || (enter->windowType() == Qt::Desktop)) && event->xcrossing.focus && widget == QApplicationPrivate::active_window && - X11->focus_model == QX11Data::FM_PointerRoot // PointerRoot mode + qt_x11Data->focus_model == QX11Data::FM_PointerRoot // PointerRoot mode ) { setActiveWindow(0); } @@ -2923,7 +2919,7 @@ int QApplication::x11ProcessEvent(XEvent* event) } } - if (!widget->d_func()->topData()->validWMState && X11->deferred_map.removeAll(widget)) + if (!widget->d_func()->topData()->validWMState && qt_x11Data->deferred_map.removeAll(widget)) widget->doDeferredMap(); } break; @@ -2955,7 +2951,7 @@ int QApplication::x11ProcessEvent(XEvent* event) } } if (pendingHide) // hide the window - XWithdrawWindow(X11->display, widget->internalWinId(), widget->x11Info().screen()); + XWithdrawWindow(qt_x11Data->display, widget->internalWinId(), widget->x11Info().screen()); } break; @@ -2965,12 +2961,12 @@ int QApplication::x11ProcessEvent(XEvent* event) case ReparentNotify: { // window manager reparents // compress old reparent events to self XEvent ev; - while (XCheckTypedWindowEvent(X11->display, + while (XCheckTypedWindowEvent(qt_x11Data->display, widget->effectiveWinId(), ReparentNotify, &ev)) { if (ev.xreparent.window != ev.xreparent.event) { - XPutBackEvent(X11->display, &ev); + XPutBackEvent(qt_x11Data->display, &ev); break; } } @@ -2999,14 +2995,14 @@ int QApplication::x11ProcessEvent(XEvent* event) topData->validWMState = 1; } - if (X11->focus_model != QX11Data::FM_Unknown) { + if (qt_x11Data->focus_model != QX11Data::FM_Unknown) { // toplevel reparented... QWidget *newparent = QWidget::find(event->xreparent.parent); if (! newparent || (newparent->windowType() == Qt::Desktop)) { // we don't know about the new parent (or we've been // reparented to root), perhaps a window manager // has been (re)started? reset the focus model to unknown - X11->focus_model = QX11Data::FM_Unknown; + qt_x11Data->focus_model = QX11Data::FM_Unknown; } } } @@ -3018,7 +3014,7 @@ int QApplication::x11ProcessEvent(XEvent* event) break; if (ATOM(XdndSelection) && req->selection == ATOM(XdndSelection)) { - X11->xdndHandleSelectionRequest(req); + qt_x11Data->xdndHandleSelectionRequest(req); } else if (qt_clipboard) { QClipboardEvent e(reinterpret_cast(event)); @@ -3032,7 +3028,7 @@ int QApplication::x11ProcessEvent(XEvent* event) if (! req || (ATOM(XdndSelection) && req->selection == ATOM(XdndSelection))) break; - if (qt_clipboard && !X11->use_xfixes) { + if (qt_clipboard && !qt_x11Data->use_xfixes) { QClipboardEvent e(reinterpret_cast(event)); QApplication::sendSpontaneousEvent(qt_clipboard, &e); } @@ -3055,12 +3051,12 @@ int QApplication::x11ProcessEvent(XEvent* event) // some properties changed if (event->xproperty.window == QX11Info::appRootWindow(0)) { // root properties for the first screen - if (!X11->use_xfixes && event->xproperty.atom == ATOM(_QT_CLIPBOARD_SENTINEL)) { + if (!qt_x11Data->use_xfixes && event->xproperty.atom == ATOM(_QT_CLIPBOARD_SENTINEL)) { if (qt_check_clipboard_sentinel()) { emit clipboard()->changed(QClipboard::Clipboard); emit clipboard()->dataChanged(); } - } else if (!X11->use_xfixes && event->xproperty.atom == ATOM(_QT_SELECTION_SENTINEL)) { + } else if (!qt_x11Data->use_xfixes && event->xproperty.atom == ATOM(_QT_SELECTION_SENTINEL)) { if (qt_check_selection_sentinel()) { emit clipboard()->changed(QClipboard::Selection); emit clipboard()->selectionChanged(); @@ -3239,22 +3235,22 @@ void QApplicationPrivate::openPopup(QWidget *popup) QApplicationPrivate::popupWidgets = new QWidgetList; } QApplicationPrivate::popupWidgets->append(popup); // add to end of list - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; if (QApplicationPrivate::popupWidgets->count() == 1 && !qt_nograb()){ // grab mouse/keyboard Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); int r = XGrabKeyboard(dpy, popup->effectiveWinId(), false, - GrabModeAsync, GrabModeAsync, X11->time); + GrabModeAsync, GrabModeAsync, qt_x11Data->time); if ((popupGrabOk = (r == GrabSuccess))) { r = XGrabPointer(dpy, popup->effectiveWinId(), true, (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask), - GrabModeAsync, GrabModeAsync, XNone, XNone, X11->time); + GrabModeAsync, GrabModeAsync, XNone, XNone, qt_x11Data->time); if (!(popupGrabOk = (r == GrabSuccess))) { // transfer grab back to the keyboard grabber if any if (QWidgetPrivate::keyboardGrabber != 0) QWidgetPrivate::keyboardGrabber->grabKeyboard(); else - XUngrabKeyboard(dpy, X11->time); + XUngrabKeyboard(dpy, qt_x11Data->time); } } } @@ -3286,7 +3282,7 @@ void QApplicationPrivate::closePopup(QWidget *popup) delete QApplicationPrivate::popupWidgets; QApplicationPrivate::popupWidgets = Q_NULLPTR; if (!qt_nograb() && popupGrabOk) { // grabbing not disabled - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; if (popup->geometry().contains(QPoint(mouseGlobalXPos, mouseGlobalYPos)) || popup->testAttribute(Qt::WA_NoMouseReplay)) { // mouse release event or inside @@ -3299,13 +3295,13 @@ void QApplicationPrivate::closePopup(QWidget *popup) if (QWidgetPrivate::mouseGrabber != 0) QWidgetPrivate::mouseGrabber->grabMouse(); else - XUngrabPointer(dpy, X11->time); + XUngrabPointer(dpy, qt_x11Data->time); // transfer grab back to keyboard grabber if any, otherwise release the grab if (QWidgetPrivate::keyboardGrabber != 0) QWidgetPrivate::keyboardGrabber->grabKeyboard(); else - XUngrabKeyboard(dpy, X11->time); + XUngrabKeyboard(dpy, qt_x11Data->time); XFlush(dpy); } @@ -3330,21 +3326,21 @@ void QApplicationPrivate::closePopup(QWidget *popup) // regrab the keyboard and mouse in case 'popup' lost the grab if (QApplicationPrivate::popupWidgets->count() == 1 && !qt_nograb()){ // grab mouse/keyboard - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; Q_ASSERT(aw->testAttribute(Qt::WA_WState_Created)); int r = XGrabKeyboard(dpy, aw->effectiveWinId(), false, - GrabModeAsync, GrabModeAsync, X11->time); + GrabModeAsync, GrabModeAsync, qt_x11Data->time); if ((popupGrabOk = (r == GrabSuccess))) { r = XGrabPointer(dpy, aw->effectiveWinId(), true, (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask), - GrabModeAsync, GrabModeAsync, XNone, XNone, X11->time); + GrabModeAsync, GrabModeAsync, XNone, XNone, qt_x11Data->time); if (!(popupGrabOk = (r == GrabSuccess))) { // transfer grab back to keyboard grabber if (QWidgetPrivate::keyboardGrabber != 0) QWidgetPrivate::keyboardGrabber->grabKeyboard(); else - XUngrabKeyboard(dpy, X11->time); + XUngrabKeyboard(dpy, qt_x11Data->time); } } } @@ -3414,13 +3410,13 @@ bool QETWidget::translateMouseEvent(const XEvent *event) return true; if (event->type == MotionNotify) { // mouse move - if (event->xmotion.root != RootWindow(X11->display, x11Info().screen()) && + if (event->xmotion.root != RootWindow(qt_x11Data->display, x11Info().screen()) && ! qt_xdnd_dragging) return false; XMotionEvent lastMotion = event->xmotion; - while(XPending(X11->display)) { // compress mouse moves - XNextEvent(X11->display, &nextEvent); + while(XPending(qt_x11Data->display)) { // compress mouse moves + XNextEvent(qt_x11Data->display, &nextEvent); if (nextEvent.type == ConfigureNotify || nextEvent.type == PropertyNotify || nextEvent.type == Expose @@ -3441,7 +3437,7 @@ bool QETWidget::translateMouseEvent(const XEvent *event) } else if (nextEvent.type != MotionNotify || nextEvent.xmotion.window != event->xmotion.window || nextEvent.xmotion.state != event->xmotion.state) { - XPutBackEvent(X11->display, &nextEvent); + XPutBackEvent(qt_x11Data->display, &nextEvent); break; } if (!qt_x11EventFilter(&nextEvent) @@ -3457,7 +3453,7 @@ bool QETWidget::translateMouseEvent(const XEvent *event) globalPos.rx() = lastMotion.x_root; globalPos.ry() = lastMotion.y_root; buttons = translateMouseButtons(lastMotion.state); - modifiers = X11->translateModifiers(lastMotion.state); + modifiers = qt_x11Data->translateModifiers(lastMotion.state); if (qt_button_down && !buttons) qt_button_down = 0; } else if (event->type == EnterNotify || event->type == LeaveNotify) { @@ -3470,7 +3466,7 @@ bool QETWidget::translateMouseEvent(const XEvent *event) globalPos.rx() = xevent->xcrossing.x_root; globalPos.ry() = xevent->xcrossing.y_root; buttons = translateMouseButtons(xevent->xcrossing.state); - modifiers = X11->translateModifiers(xevent->xcrossing.state); + modifiers = qt_x11Data->translateModifiers(xevent->xcrossing.state); if (qt_button_down && !buttons) qt_button_down = 0; if (qt_button_down) @@ -3482,7 +3478,7 @@ bool QETWidget::translateMouseEvent(const XEvent *event) globalPos.rx() = event->xbutton.x_root; globalPos.ry() = event->xbutton.y_root; buttons = translateMouseButtons(event->xbutton.state); - modifiers = X11->translateModifiers(event->xbutton.state); + modifiers = qt_x11Data->translateModifiers(event->xbutton.state); switch (event->xbutton.button) { case Button1: button = Qt::LeftButton; break; case Button2: button = Qt::MidButton; break; @@ -3501,9 +3497,9 @@ bool QETWidget::translateMouseEvent(const XEvent *event) // or not) int delta = 1; XEvent xevent; - while (XCheckTypedWindowEvent(X11->display, effectiveWinId(), ButtonPress, &xevent)){ + while (XCheckTypedWindowEvent(qt_x11Data->display, effectiveWinId(), ButtonPress, &xevent)){ if (xevent.xbutton.button != event->xbutton.button){ - XPutBackEvent(X11->display, &xevent); + XPutBackEvent(qt_x11Data->display, &xevent); break; } delta++; @@ -3749,7 +3745,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) this->data->fstrut_dirty = 1; if (event->xproperty.state == PropertyNewValue) { - e = XGetWindowProperty(X11->display, event->xproperty.window, ATOM(_KDE_NET_WM_FRAME_STRUT), + e = XGetWindowProperty(qt_x11Data->display, event->xproperty.window, ATOM(_KDE_NET_WM_FRAME_STRUT), 0, 4, // struts are 4 longs False, XA_CARDINAL, &ret, &format, &nitems, &after, &data); @@ -3768,7 +3764,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) if (event->xproperty.state == PropertyNewValue) { // using length of 1024 should be safe for all current and // possible NET states... - e = XGetWindowProperty(X11->display, event->xproperty.window, ATOM(_NET_WM_STATE), 0, 1024, + e = XGetWindowProperty(qt_x11Data->display, event->xproperty.window, ATOM(_NET_WM_STATE), 0, 1024, False, XA_ATOM, &ret, &format, &nitems, &after, &data); if (e == Success && ret == XA_ATOM && format == 32 && nitems > 0) { @@ -3793,8 +3789,8 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) bool send_event = false; - if (X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) - && X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) { + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) + && qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) { if (max && !isMaximized()) { this->data->window_state = this->data->window_state | Qt::WindowMaximized; send_event = true; @@ -3804,7 +3800,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) } } - if (X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) { + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) { if (full && !isFullScreen()) { this->data->window_state = this->data->window_state | Qt::WindowFullScreen; send_event = true; @@ -3830,7 +3826,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) d->topData()->validWMState = 0; // map the window if we were waiting for a transition to // withdrawn - if (X11->deferred_map.removeAll(this)) { + if (qt_x11Data->deferred_map.removeAll(this)) { doDeferredMap(); } else if (isVisible() && !testAttribute(Qt::WA_Mapped) @@ -3847,7 +3843,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) // the window manager has changed the WM State property... // we are wanting to see if we are withdrawn so that we // can reuse this window... - e = XGetWindowProperty(X11->display, internalWinId(), ATOM(WM_STATE), 0, 2, False, + e = XGetWindowProperty(qt_x11Data->display, internalWinId(), ATOM(WM_STATE), 0, 2, False, ATOM(WM_STATE), &ret, &format, &nitems, &after, &data); if (e == Success && ret == ATOM(WM_STATE) && format == 32 && nitems > 0) { @@ -3857,7 +3853,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) // if we are in the withdrawn state, we are free // to reuse this window provided we remove the // WM_STATE property (ICCCM 4.1.3.1) - XDeleteProperty(X11->display, internalWinId(), ATOM(WM_STATE)); + XDeleteProperty(qt_x11Data->display, internalWinId(), ATOM(WM_STATE)); // set the parent id to zero, so that show() will // work again @@ -3865,7 +3861,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event) d->topData()->validWMState = 0; // map the window if we were waiting for a // transition to withdrawn - if (X11->deferred_map.removeAll(this)) { + if (qt_x11Data->deferred_map.removeAll(this)) { doDeferredMap(); } else if (isVisible() && !testAttribute(Qt::WA_Mapped) @@ -3965,8 +3961,8 @@ bool translateBySips(QWidget* that, QRect& paintRect) { int dx=0, dy=0; int sips=0; - for (int i = 0; i < X11->sip_list.size(); ++i) { - const QX11Data::ScrollInProgress &sip = X11->sip_list.at(i); + for (int i = 0; i < qt_x11Data->sip_list.size(); ++i) { + const QX11Data::ScrollInProgress &sip = qt_x11Data->sip_list.at(i); if (sip.scrolled_widget == that) { if (sips) { dx += sip.dx; @@ -3999,7 +3995,7 @@ void QETWidget::translatePaintEvent(const XEvent *event) QRegion paintRegion = paintRect; // WARNING: this is O(number_of_events * number_of_matching_events) - while (XCheckIfEvent(X11->display,&xevent,isPaintOrScrollDoneEvent, + while (XCheckIfEvent(qt_x11Data->display,&xevent,isPaintOrScrollDoneEvent, (XPointer)&info) && !qt_x11EventFilter(&xevent) && !x11Event(&xevent)) // send event through filter @@ -4030,10 +4026,10 @@ bool QETWidget::translateScrollDoneEvent(const XEvent *event) long id = event->xclient.data.l[0]; // Remove any scroll-in-progress record for the given id. - for (int i = 0; i < X11->sip_list.size(); ++i) { - const QX11Data::ScrollInProgress &sip = X11->sip_list.at(i); + for (int i = 0; i < qt_x11Data->sip_list.size(); ++i) { + const QX11Data::ScrollInProgress &sip = qt_x11Data->sip_list.at(i); if (sip.id == id) { - X11->sip_list.removeAt(i); + qt_x11Data->sip_list.removeAt(i); return true; } } @@ -4055,7 +4051,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event) if (testAttribute(Qt::WA_OutsideWSRange)) { // discard events for windows that have a geometry X can't handle XEvent xevent; - while (XCheckTypedWindowEvent(X11->display,internalWinId(), ConfigureNotify,&xevent) && + while (XCheckTypedWindowEvent(qt_x11Data->display,internalWinId(), ConfigureNotify,&xevent) && !qt_x11EventFilter(&xevent) && !x11Event(&xevent)) // send event through filter ; @@ -4089,7 +4085,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event) // anyway, let's query the position to be certain. int x, y; Window child; - XTranslateCoordinates(X11->display, internalWinId(), + XTranslateCoordinates(qt_x11Data->display, internalWinId(), QApplication::desktop()->screen(d->xinfo.screen())->internalWinId(), 0, 0, &x, &y, &child); newCPos.rx() = x; @@ -4113,10 +4109,10 @@ bool QETWidget::translateConfigEvent(const XEvent *event) data->crect = cr; Qt::WindowStates old_state = data->window_state; - if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) - && !X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) + if (!qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) + && !qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) data->window_state &= ~Qt::WindowMaximized; - if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) + if (!qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) data->window_state &= ~Qt::WindowFullScreen; if (old_state != data->window_state) { @@ -4131,7 +4127,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event) } else { XEvent xevent; - while (XCheckTypedWindowEvent(X11->display,internalWinId(), ConfigureNotify,&xevent) && + while (XCheckTypedWindowEvent(qt_x11Data->display,internalWinId(), ConfigureNotify,&xevent) && !qt_x11EventFilter(&xevent) && !x11Event(&xevent)) // send event through filter ; @@ -4175,7 +4171,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event) tlwExtra->newCounterValueLo, tlwExtra->newCounterValueHi); - XSyncSetCounter(X11->display, tlwExtra->syncUpdateCounter, value); + XSyncSetCounter(qt_x11Data->display, tlwExtra->syncUpdateCounter, value); tlwExtra->newCounterValueHi = 0; tlwExtra->newCounterValueLo = 0; } diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 2552933f3..0fbd7db92 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -306,7 +306,7 @@ QClipboardINCRTransaction::QClipboardINCRTransaction(Window w, Atom p, Atom t, i { DEBUG("QClipboard: sending %d bytes (INCR transaction %p)", d.size(), this); - XSelectInput(X11->display, window, PropertyChangeMask); + XSelectInput(qt_x11Data->display, window, PropertyChangeMask); if (! transactions) { VDEBUG("QClipboard: created INCR transaction map"); @@ -321,7 +321,7 @@ QClipboardINCRTransaction::~QClipboardINCRTransaction(void) { VDEBUG("QClipboard: destroyed INCR transacton %p", this); - XSelectInput(X11->display, window, NoEventMask); + XSelectInput(qt_x11Data->display, window, NoEventMask); transactions->remove(window); if (transactions->isEmpty()) { @@ -355,12 +355,12 @@ int QClipboardINCRTransaction::x11Event(XEvent *event) VDEBUG("QClipboard: sending %d bytes, %d remaining (INCR transaction %p)", xfer, bytes_left - xfer, this); - XChangeProperty(X11->display, window, property, target, format, + XChangeProperty(qt_x11Data->display, window, property, target, format, PropModeReplace, (uchar *) data.data() + offset, xfer); offset += xfer; } else { // INCR transaction finished... - XChangeProperty(X11->display, window, property, target, format, + XChangeProperty(qt_x11Data->display, window, property, target, format, PropModeReplace, (uchar *) data.data(), 0); delete this; } @@ -413,7 +413,7 @@ static Bool qt_init_timestamp_scanner(Display*, XEvent *event, XPointer arg) break; } #ifndef QT_NO_XFIXES - if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) { + if (qt_x11Data->use_xfixes && event->type == (qt_x11Data->xfixes_eventbase + XFixesSelectionNotify)) { XFixesSelectionNotifyEvent *req = reinterpret_cast(event); data->timestamp = req->selection_timestamp; @@ -435,37 +435,37 @@ QClipboard::QClipboard(QObject *parent) (void)QApplication::desktop(); #ifndef QT_NO_XFIXES - if (X11->use_xfixes) { + if (qt_x11Data->use_xfixes) { const unsigned long eventMask = XFixesSetSelectionOwnerNotifyMask | XFixesSelectionWindowDestroyNotifyMask | XFixesSelectionClientCloseNotifyMask; - for (int i = 0; i < X11->screenCount; ++i) { - XFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(i), + for (int i = 0; i < qt_x11Data->screenCount; ++i) { + XFixesSelectSelectionInput(qt_x11Data->display, QX11Info::appRootWindow(i), XA_PRIMARY, eventMask); - XFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(i), + XFixesSelectSelectionInput(qt_x11Data->display, QX11Info::appRootWindow(i), ATOM(CLIPBOARD), eventMask); } } #endif // QT_NO_XFIXES - if (X11->time == CurrentTime) { + if (qt_x11Data->time == CurrentTime) { // send a dummy event to myself to get the timestamp from X11. qt_init_timestamp_data data; data.timestamp = CurrentTime; XEvent ev; - XCheckIfEvent(X11->display, &ev, &qt_init_timestamp_scanner, (XPointer)&data); + XCheckIfEvent(qt_x11Data->display, &ev, &qt_init_timestamp_scanner, (XPointer)&data); if (data.timestamp == CurrentTime) { setupOwner(); // We need this value just for completeness, we don't use it. long dummy = 0; Window ownerId = owner->internalWinId(); - XChangeProperty(X11->display, ownerId, + XChangeProperty(qt_x11Data->display, ownerId, ATOM(CLIP_TEMPORARY), XA_INTEGER, 32, PropModeReplace, (uchar*)&dummy, 1); - XWindowEvent(X11->display, ownerId, PropertyChangeMask, &ev); + XWindowEvent(qt_x11Data->display, ownerId, PropertyChangeMask, &ev); data.timestamp = ev.xproperty.time; - XDeleteProperty(X11->display, ownerId, ATOM(CLIP_TEMPORARY)); + XDeleteProperty(qt_x11Data->display, ownerId, ATOM(CLIP_TEMPORARY)); } - X11->time = data.timestamp; + qt_x11Data->time = data.timestamp; } } @@ -543,10 +543,10 @@ bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int ti return true; } - if (checkManager && XGetSelectionOwner(X11->display, ATOM(CLIPBOARD_MANAGER)) == XNone) + if (checkManager && XGetSelectionOwner(qt_x11Data->display, ATOM(CLIPBOARD_MANAGER)) == XNone) return false; - XSync(X11->display, false); + XSync(qt_x11Data->display, false); usleep(50000); now.start(); @@ -570,23 +570,23 @@ bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int ti qApp->setEventFilter(old_event_filter); } else { do { - if (XCheckTypedWindowEvent(X11->display,win,type,event)) + if (XCheckTypedWindowEvent(qt_x11Data->display,win,type,event)) return true; - if (checkManager && XGetSelectionOwner(X11->display, ATOM(CLIPBOARD_MANAGER)) == XNone) + if (checkManager && XGetSelectionOwner(qt_x11Data->display, ATOM(CLIPBOARD_MANAGER)) == XNone) return false; // process other clipboard events, since someone is probably requesting data from us XEvent e; // Pass the event through the event dispatcher filter so that applications // which install an event filter on the dispatcher get to handle it first. - if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0) && + if (XCheckIfEvent(qt_x11Data->display, &e, checkForClipboardEvents, 0) && !QAbstractEventDispatcher::instance()->filterEvent(&e)) qApp->x11ProcessEvent(&e); now.start(); - XFlush(X11->display); + XFlush(qt_x11Data->display); // sleep 50 ms, so we don't use up CPU cycles all the time. struct timeval usleep_tv; @@ -746,7 +746,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, if (event.xproperty.atom != property || event.xproperty.state != PropertyNewValue) continue; - if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (qt_x11Data->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { if (length == 0) { // no more data, we're done if (nullterm) { buf.resize(offset+1); @@ -789,7 +789,7 @@ static Atom send_targets_selection(QClipboardData *d, Window window, Atom proper QVector types; QStringList formats = QInternalMimeData::formatsHelper(d->source()); for (int i = 0; i < formats.size(); ++i) { - QList atoms = X11->xdndMimeAtomsForFormat(formats.at(i)); + QList atoms = qt_x11Data->xdndMimeAtomsForFormat(formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); @@ -800,7 +800,7 @@ static Atom send_targets_selection(QClipboardData *d, Window window, Atom proper types.append(ATOM(TIMESTAMP)); types.append(ATOM(SAVE_TARGETS)); - XChangeProperty(X11->display, window, property, XA_ATOM, 32, + XChangeProperty(qt_x11Data->display, window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); return property; } @@ -811,21 +811,21 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p int dataFormat = 0; QByteArray data; - QByteArray fmt = X11->xdndAtomToString(target); + QByteArray fmt = qt_x11Data->xdndAtomToString(target); if (fmt.isEmpty()) { // Not a MIME type we have DEBUG("QClipboard: send_selection(): converting to type '%s' is not supported", fmt.data()); return XNone; } DEBUG("QClipboard: send_selection(): converting to type '%s'", fmt.data()); - if (X11->xdndMimeDataForAtom(target, d->source(), &data, &atomFormat, &dataFormat)) { + if (qt_x11Data->xdndMimeDataForAtom(target, d->source(), &data, &atomFormat, &dataFormat)) { VDEBUG("QClipboard: send_selection():\n" " property type %lx\n" " property name '%s'\n" " format %d\n" " %d bytes\n", - target, X11->xdndMimeAtomToString(atomFormat).toLatin1().data(), dataFormat, data.size()); + target, qt_x11Data->xdndMimeAtomToString(atomFormat).toLatin1().data(), dataFormat, data.size()); // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) @@ -833,10 +833,10 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(X11->display) * 4) - 24; + const int increment = (XMaxRequestSize(qt_x11Data->display) * 4) - 24; if (data.size() > increment && allow_incr) { long bytes = data.size(); - XChangeProperty(X11->display, window, property, + XChangeProperty(qt_x11Data->display, window, property, ATOM(INCR), 32, PropModeReplace, (uchar *) &bytes, 1); (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); @@ -848,7 +848,7 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? int dataSize = data.size() / (dataFormat / 8); // use a single request to transfer data - XChangeProperty(X11->display, window, property, atomFormat, + XChangeProperty(qt_x11Data->display, window, property, atomFormat, dataFormat, PropModeReplace, (uchar *) data.data(), dataSize); } @@ -914,27 +914,27 @@ bool QClipboard::event(QEvent *e) } XEvent *xevent = (XEvent *)(((QClipboardEvent *)e)->data()); - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; if (!xevent) { // That means application exits and we need to give clipboard // content to the clipboard manager. // First we check if there is a clipboard manager. - if (XGetSelectionOwner(X11->display, ATOM(CLIPBOARD_MANAGER)) == XNone + if (XGetSelectionOwner(qt_x11Data->display, ATOM(CLIPBOARD_MANAGER)) == XNone || !owner) return true; Window ownerId = owner->internalWinId(); Q_ASSERT(ownerId); // we delete the property so the manager saves all TARGETS. - XDeleteProperty(X11->display, ownerId, ATOM(_QT_SELECTION)); - XConvertSelection(X11->display, ATOM(CLIPBOARD_MANAGER), ATOM(SAVE_TARGETS), - ATOM(_QT_SELECTION), ownerId, X11->time); + XDeleteProperty(qt_x11Data->display, ownerId, ATOM(_QT_SELECTION)); + XConvertSelection(qt_x11Data->display, ATOM(CLIPBOARD_MANAGER), ATOM(SAVE_TARGETS), + ATOM(_QT_SELECTION), ownerId, qt_x11Data->time); XSync(dpy, false); XEvent event; // waiting until the clipboard manager fetches the content. - if (!X11->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 10000, true)) { + if (!qt_x11Data->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 10000, true)) { qWarning("QClipboard: Unable to receive an event from the " "clipboard manager in a reasonable time"); } @@ -1021,9 +1021,9 @@ bool QClipboard::event(QEvent *e) " selection 0x%lx (%s) target 0x%lx (%s)", req->requestor, req->selection, - X11->xdndAtomToString(req->selection).data(), + qt_x11Data->xdndAtomToString(req->selection).data(), req->target, - X11->xdndAtomToString(req->target).data()); + qt_x11Data->xdndAtomToString(req->target).data()); QClipboardData *d; if (req->selection == XA_PRIMARY) { @@ -1066,7 +1066,7 @@ bool QClipboard::event(QEvent *e) if (req->target == xa_multiple) { QByteArray multi_data; if (req->property == XNone - || !X11->clipboardReadProperty(req->requestor, req->property, false, &multi_data, + || !qt_x11Data->clipboardReadProperty(req->requestor, req->property, false, &multi_data, 0, &multi_type, &multi_format) || multi_format != 32) { // MULTIPLE property not formatted correctly @@ -1139,7 +1139,7 @@ bool QClipboard::event(QEvent *e) DEBUG("QClipboard: SelectionNotify to 0x%lx\n" " property 0x%lx (%s)", req->requestor, event.xselection.property, - X11->xdndAtomToString(event.xselection.property).data()); + qt_x11Data->xdndAtomToString(event.xselection.property).data()); } break; } @@ -1182,7 +1182,7 @@ QClipboardWatcher::~QClipboardWatcher() bool QClipboardWatcher::empty() const { - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; Window win = XGetSelectionOwner(dpy, atom); if(win == requestor->internalWinId()) { @@ -1213,12 +1213,12 @@ QStringList QClipboardWatcher::formats_sys() const if (targets[i] == 0) continue; - QStringList formatsForAtom = X11->xdndMimeFormatsForAtom(targets[i]); + QStringList formatsForAtom = qt_x11Data->xdndMimeFormatsForAtom(targets[i]); for (int j = 0; j < formatsForAtom.size(); ++j) { if (!formatList.contains(formatsForAtom.at(j))) formatList.append(formatsForAtom.at(j)); } - VDEBUG(" format: %s", X11->xdndAtomToString(targets[i]).data()); + VDEBUG(" format: %s", qt_x11Data->xdndAtomToString(targets[i]).data()); VDEBUG(" data:\n%s\n", getDataInFormat(targets[i]).data()); } DEBUG("QClipboardWatcher::format: %d formats available", formatList.count()); @@ -1249,36 +1249,36 @@ QVariant QClipboardWatcher::retrieveData_sys(const QString &fmt, QVariant::Type atoms.append(targets[i]); QByteArray encoding; - Atom fmtatom = X11->xdndMimeAtomForFormat(fmt, requestedType, atoms, &encoding); + Atom fmtatom = qt_x11Data->xdndMimeAtomForFormat(fmt, requestedType, atoms, &encoding); if (fmtatom == 0) return QVariant(); - return X11->xdndMimeConvertToFormat(fmtatom, getDataInFormat(fmtatom), fmt, requestedType, encoding); + return qt_x11Data->xdndMimeConvertToFormat(fmtatom, getDataInFormat(fmtatom), fmt, requestedType, encoding); } QByteArray QClipboardWatcher::getDataInFormat(Atom fmtatom) const { QByteArray buf; - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; requestor->createWinId(); Window win = requestor->internalWinId(); Q_ASSERT(requestor->testAttribute(Qt::WA_WState_Created)); DEBUG("QClipboardWatcher::getDataInFormat: selection '%s' format '%s'", - X11->xdndAtomToString(atom).data(), X11->xdndAtomToString(fmtatom).data()); + qt_x11Data->xdndAtomToString(atom).data(), qt_x11Data->xdndAtomToString(fmtatom).data()); XSelectInput(dpy, win, NoEventMask); // don't listen for any events XDeleteProperty(dpy, win, ATOM(_QT_SELECTION)); - XConvertSelection(dpy, atom, fmtatom, ATOM(_QT_SELECTION), win, X11->time); + XConvertSelection(dpy, atom, fmtatom, ATOM(_QT_SELECTION), win, qt_x11Data->time); XSync(dpy, false); VDEBUG("QClipboardWatcher::getDataInFormat: waiting for SelectionNotify event"); XEvent xevent; - if (!X11->clipboardWaitForEvent(win,SelectionNotify,&xevent,clipboard_timeout) || + if (!qt_x11Data->clipboardWaitForEvent(win,SelectionNotify,&xevent,clipboard_timeout) || xevent.xselection.property == XNone) { DEBUG("QClipboardWatcher::getDataInFormat: format not available"); return buf; @@ -1289,10 +1289,10 @@ QByteArray QClipboardWatcher::getDataInFormat(Atom fmtatom) const Atom type; XSelectInput(dpy, win, PropertyChangeMask); - if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (qt_x11Data->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = X11->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes, false); + buf = qt_x11Data->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes, false); } } @@ -1367,7 +1367,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) return; } - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; Window newOwner; if (! src) { // no data, clear clipboard contents @@ -1379,12 +1379,12 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) newOwner = owner->internalWinId(); d->setSource(src); - d->timestamp = X11->time; + d->timestamp = qt_x11Data->time; } Window prevOwner = XGetSelectionOwner(dpy, atom); - // use X11->time, since d->timestamp == CurrentTime when clearing - XSetSelectionOwner(dpy, atom, newOwner, X11->time); + // use qt_x11Data->time, since d->timestamp == CurrentTime when clearing + XSetSelectionOwner(dpy, atom, newOwner, qt_x11Data->time); if (mode == Selection) emitChanged(QClipboard::Selection); @@ -1393,7 +1393,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) if (XGetSelectionOwner(dpy, atom) != newOwner) { qWarning("QClipboard::setData: Cannot set X11 selection owner for %s", - X11->xdndAtomToString(atom).data()); + qt_x11Data->xdndAtomToString(atom).data()); d->clear(); return; } @@ -1419,7 +1419,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) bool qt_check_selection_sentinel() { bool doIt = true; - if (owner && !X11->use_xfixes) { + if (owner && !qt_x11Data->use_xfixes) { /* Since the X selection mechanism cannot give any signal when the selection has changed, we emulate it (for Qt processes) here. @@ -1437,7 +1437,7 @@ bool qt_check_selection_sentinel() ulong nitems; ulong bytesLeft; - if (XGetWindowProperty(X11->display, + if (XGetWindowProperty(qt_x11Data->display, QApplication::desktop()->screen(0)->internalWinId(), ATOM(_QT_SELECTION_SENTINEL), 0, 2, False, XA_WINDOW, &actualType, &actualFormat, &nitems, @@ -1471,13 +1471,13 @@ bool qt_check_selection_sentinel() bool qt_check_clipboard_sentinel() { bool doIt = true; - if (owner && !X11->use_xfixes) { + if (owner && !qt_x11Data->use_xfixes) { unsigned char *retval; Atom actualType; int actualFormat; unsigned long nitems, bytesLeft; - if (XGetWindowProperty(X11->display, + if (XGetWindowProperty(qt_x11Data->display, QApplication::desktop()->screen(0)->internalWinId(), ATOM(_QT_CLIPBOARD_SENTINEL), 0, 2, False, XA_WINDOW, &actualType, &actualFormat, &nitems, &bytesLeft, diff --git a/src/gui/kernel/qcursor_x11.cpp b/src/gui/kernel/qcursor_x11.cpp index d01440972..708752531 100644 --- a/src/gui/kernel/qcursor_x11.cpp +++ b/src/gui/kernel/qcursor_x11.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp + // Define QT_USE_APPROXIMATE_CURSORS when compiling if you REALLY want to // use the ugly X11 cursors. @@ -68,7 +70,7 @@ QCursorData::QCursorData(Qt::CursorShape s) QCursorData::~QCursorData() { - Display *dpy = X11 ? X11->display : (Display*)0; + Display *dpy = qt_x11Data ? qt_x11Data->display : (Display*)0; // Add in checking for the display too as on HP-UX // we seem to get a core dump as the cursor data is @@ -107,7 +109,6 @@ QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, QCursorData *d = new QCursorData; d->ref = 1; - extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp d->bm = new QBitmap(qt_toX11Pixmap(bitmap)); d->bmm = new QBitmap(qt_toX11Pixmap(mask)); @@ -143,7 +144,7 @@ QPoint QCursor::pos() Window child; int root_x, root_y, win_x, win_y; uint buttons; - Display* dpy = X11->display; + Display* dpy = qt_x11Data->display; for (int i = 0; i < ScreenCount(dpy); ++i) { if (XQueryPointer(dpy, QX11Info::appRootWindow(i), &root, &child, &root_x, &root_y, &win_x, &win_y, &buttons)) @@ -162,7 +163,7 @@ int QCursor::x11Screen() Window child; int root_x, root_y, win_x, win_y; uint buttons; - Display* dpy = X11->display; + Display* dpy = qt_x11Data->display; for (int i = 0; i < ScreenCount(dpy); ++i) { if (XQueryPointer(dpy, QX11Info::appRootWindow(i), &root, &child, &root_x, &root_y, &win_x, &win_y, &buttons)) @@ -182,7 +183,7 @@ void QCursor::setPos(int x, int y) Window child; int root_x, root_y, win_x, win_y; uint buttons; - Display* dpy = X11->display; + Display* dpy = qt_x11Data->display; int screen; for (screen = 0; screen < ScreenCount(dpy); ++screen) { if (XQueryPointer(dpy, QX11Info::appRootWindow(screen), &root, &child, &root_x, &root_y, @@ -202,7 +203,7 @@ void QCursor::setPos(int x, int y) if (current == target) return; - XWarpPointer(X11->display, XNone, QX11Info::appRootWindow(screen), 0, 0, 0, 0, x, y); + XWarpPointer(qt_x11Data->display, XNone, QX11Info::appRootWindow(screen), 0, 0, 0, 0, x, y); } @@ -219,15 +220,14 @@ void QCursorData::update() if (hcurs) return; - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; Window rootwin = QX11Info::appRootWindow(); if (cshape == Qt::BitmapCursor) { - extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp #ifndef QT_NO_XRENDER - if (!pixmap.isNull() && X11->use_xrender) { + if (!pixmap.isNull() && qt_x11Data->use_xrender) { pixmap = qt_toX11Pixmap(pixmap); - hcurs = XRenderCreateCursor (X11->display, pixmap.x11PictureHandle(), hx, hy); + hcurs = XRenderCreateCursor (qt_x11Data->display, pixmap.x11PictureHandle(), hx, hy); } else #endif { @@ -532,7 +532,7 @@ void QCursorData::update() if (hcurs) { #ifndef QT_NO_XFIXES - if (X11->use_xfixes) + if (qt_x11Data->use_xfixes) XFixesSetCursorName(dpy, hcurs, cursorNames[cshape]); #endif /* ! QT_NO_XFIXES */ return; @@ -617,7 +617,7 @@ void QCursorData::update() hcurs = XCreateFontCursor(dpy, sh); #ifndef QT_NO_XFIXES - if (X11->use_xfixes) + if (qt_x11Data->use_xfixes) XFixesSetCursorName(dpy, hcurs, cursorNames[cshape]); #endif /* ! QT_NO_XFIXES */ } diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp index e3ee36046..f6f51ade1 100644 --- a/src/gui/kernel/qdesktopwidget_x11.cpp +++ b/src/gui/kernel/qdesktopwidget_x11.cpp @@ -125,7 +125,7 @@ QDesktopWidgetPrivate::~QDesktopWidgetPrivate() void QDesktopWidgetPrivate::init() { // get the screen count - int newScreenCount = ScreenCount(X11->display); + int newScreenCount = ScreenCount(qt_x11Data->display); #ifndef QT_NO_XINERAMA XineramaScreenInfo *xinerama_screeninfo = 0; @@ -134,12 +134,12 @@ void QDesktopWidgetPrivate::init() // using traditional multi-screen (with multiple root windows) if (newScreenCount == 1) { int unused; - use_xinerama = (XineramaQueryExtension(X11->display, &unused, &unused) - && XineramaIsActive(X11->display)); + use_xinerama = (XineramaQueryExtension(qt_x11Data->display, &unused, &unused) + && XineramaIsActive(qt_x11Data->display)); } if (use_xinerama) { - xinerama_screeninfo = XineramaQueryScreens(X11->display, &newScreenCount); + xinerama_screeninfo = XineramaQueryScreens(qt_x11Data->display, &newScreenCount); } if (xinerama_screeninfo) { @@ -147,8 +147,8 @@ void QDesktopWidgetPrivate::init() } else #endif // QT_NO_XINERAMA { - defaultScreen = DefaultScreen(X11->display); - newScreenCount = ScreenCount(X11->display); + defaultScreen = DefaultScreen(qt_x11Data->display); + newScreenCount = ScreenCount(qt_x11Data->display); use_xinerama = false; } @@ -172,8 +172,8 @@ void QDesktopWidgetPrivate::init() { x = 0; y = 0; - w = WidthOfScreen(ScreenOfDisplay(X11->display, i)); - h = HeightOfScreen(ScreenOfDisplay(X11->display, i)); + w = WidthOfScreen(ScreenOfDisplay(qt_x11Data->display, i)); + h = HeightOfScreen(ScreenOfDisplay(qt_x11Data->display, i)); } rects[j].setRect(x, y, w, h); @@ -280,15 +280,15 @@ const QRect QDesktopWidget::availableGeometry(int screen) const if (d->workareas[screen].isValid()) return d->workareas[screen]; - if (X11->isSupportedByWM(ATOM(_NET_WORKAREA))) { - int x11Screen = isVirtualDesktop() ? DefaultScreen(X11->display) : screen; + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WORKAREA))) { + int x11Screen = isVirtualDesktop() ? DefaultScreen(qt_x11Data->display) : screen; Atom ret; int format, e; unsigned char *data = 0; unsigned long nitems, after; - e = XGetWindowProperty(X11->display, + e = XGetWindowProperty(qt_x11Data->display, QX11Info::appRootWindow(x11Screen), ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL, &ret, &format, &nitems, &after, &data); diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 791634e73..e78e593e4 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -94,8 +94,8 @@ QT_BEGIN_NAMESPACE static int findXdndDropTransactionByWindow(Window window) { int at = -1; - for (int i = 0; i < X11->dndDropTransactions.count(); ++i) { - const QXdndDropTransaction &t = X11->dndDropTransactions.at(i); + for (int i = 0; i < qt_x11Data->dndDropTransactions.count(); ++i) { + const QXdndDropTransaction &t = qt_x11Data->dndDropTransactions.at(i); if (t.target == window || t.proxy_target == window) { at = i; break; @@ -107,8 +107,8 @@ static int findXdndDropTransactionByWindow(Window window) static int findXdndDropTransactionByTime(Time timestamp) { int at = -1; - for (int i = 0; i < X11->dndDropTransactions.count(); ++i) { - const QXdndDropTransaction &t = X11->dndDropTransactions.at(i); + for (int i = 0; i < qt_x11Data->dndDropTransactions.count(); ++i) { + const QXdndDropTransaction &t = qt_x11Data->dndDropTransactions.at(i); if (t.timestamp == timestamp) { at = i; break; @@ -139,7 +139,7 @@ static Window findXdndAwareParent(Window window) int f; unsigned long n, a; unsigned char *data = 0; - if (XGetWindowProperty(X11->display, window, ATOM(XdndAware), 0, 0, False, + if (XGetWindowProperty(qt_x11Data->display, window, ATOM(XdndAware), 0, 0, False, AnyPropertyType, &type, &f,&n,&a,&data) == Success) { if (data) XFree(data); @@ -154,7 +154,7 @@ static Window findXdndAwareParent(Window window) Window parent; Window *children; uint unused; - if (!XQueryTree(X11->display, window, &root, &parent, &children, &unused)) + if (!XQueryTree(qt_x11Data->display, window, &root, &parent, &children, &unused)) break; if (children) XFree(children); @@ -338,7 +338,7 @@ static WId xdndProxy(WId w) int f; unsigned long n, a; unsigned char *retval = 0; - XGetWindowProperty(X11->display, w, ATOM(XdndProxy), 0, 1, False, + XGetWindowProperty(qt_x11Data->display, w, ATOM(XdndProxy), 0, 1, False, XA_WINDOW, &type, &f,&n,&a,&retval); WId *proxy_id_ptr = (WId *)retval; WId proxy_id = 0; @@ -347,11 +347,11 @@ static WId xdndProxy(WId w) XFree(proxy_id_ptr); proxy_id_ptr = 0; // Already exists. Real? - X11->ignoreBadwindow(); - XGetWindowProperty(X11->display, proxy_id, ATOM(XdndProxy), 0, 1, False, + qt_x11Data->ignoreBadwindow(); + XGetWindowProperty(qt_x11Data->display, proxy_id, ATOM(XdndProxy), 0, 1, False, XA_WINDOW, &type, &f,&n,&a,&retval); proxy_id_ptr = (WId *)retval; - if (X11->badwindow() || type != XA_WINDOW || !proxy_id_ptr || *proxy_id_ptr != proxy_id) + if (qt_x11Data->badwindow() || type != XA_WINDOW || !proxy_id_ptr || *proxy_id_ptr != proxy_id) // Bogus - we will overwrite. proxy_id = 0; } @@ -370,20 +370,20 @@ static bool xdndEnable(QWidget* w, bool on) return false; // As per Xdnd4, use XdndProxy - XGrabServer(X11->display); + XGrabServer(qt_x11Data->display); Q_ASSERT(w->testAttribute(Qt::WA_WState_Created)); WId proxy_id = xdndProxy(w->effectiveWinId()); if (!proxy_id) { xdnd_widget = xdnd_data.desktop_proxy = new QWidget; proxy_id = xdnd_data.desktop_proxy->effectiveWinId(); - XChangeProperty (X11->display, w->effectiveWinId(), ATOM(XdndProxy), + XChangeProperty (qt_x11Data->display, w->effectiveWinId(), ATOM(XdndProxy), XA_WINDOW, 32, PropModeReplace, (unsigned char *)&proxy_id, 1); - XChangeProperty (X11->display, proxy_id, ATOM(XdndProxy), + XChangeProperty (qt_x11Data->display, proxy_id, ATOM(XdndProxy), XA_WINDOW, 32, PropModeReplace, (unsigned char *)&proxy_id, 1); } - XUngrabServer(X11->display); + XUngrabServer(qt_x11Data->display); } else { xdnd_widget = w->window(); } @@ -391,7 +391,7 @@ static bool xdndEnable(QWidget* w, bool on) DNDDEBUG << "setting XdndAware for" << xdnd_widget << xdnd_widget->effectiveWinId(); Atom atm = (Atom)xdnd_version; Q_ASSERT(xdnd_widget->testAttribute(Qt::WA_WState_Created)); - XChangeProperty(X11->display, xdnd_widget->effectiveWinId(), ATOM(XdndAware), + XChangeProperty(qt_x11Data->display, xdnd_widget->effectiveWinId(), ATOM(XdndAware), XA_ATOM, 32, PropModeReplace, (unsigned char *)&atm, 1); return true; } else { @@ -399,7 +399,7 @@ static bool xdndEnable(QWidget* w, bool on) } } else { if ((w->windowType() == Qt::Desktop)) { - XDeleteProperty(X11->display, w->internalWinId(), ATOM(XdndProxy)); + XDeleteProperty(qt_x11Data->display, w->internalWinId(), ATOM(XdndProxy)); delete xdnd_data.desktop_proxy; xdnd_data.desktop_proxy = 0; } else { @@ -507,7 +507,7 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data ? XCompoundTextStyle : XStdICCTextStyle; XTextProperty textprop; if (list[0] != NULL - && XmbTextListToTextProperty(X11->display, list, 1, style, + && XmbTextListToTextProperty(qt_x11Data->display, list, 1, style, &textprop) == Success) { *atomFormat = textprop.encoding; *dataFormat = textprop.format; @@ -520,7 +520,7 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data " %ld items\n" " %d bytes\n", textprop.encoding, - X11->xdndMimeAtomToString(textprop.encoding).toLatin1().data(), + qt_x11Data->xdndMimeAtomToString(textprop.encoding).toLatin1().data(), textprop.format, textprop.nitems, data->size()); XFree(textprop.value); @@ -784,12 +784,12 @@ static bool checkEmbedded(QWidget* w, const XEvent* xe) if (current_embedding_widget != w) { last_enter_event.xany.window = extra->xDndProxy; - XSendEvent(X11->display, extra->xDndProxy, False, NoEventMask, &last_enter_event); + XSendEvent(qt_x11Data->display, extra->xDndProxy, False, NoEventMask, &last_enter_event); current_embedding_widget = w; } ((XEvent*)xe)->xany.window = extra->xDndProxy; - XSendEvent(X11->display, extra->xDndProxy, False, NoEventMask, (XEvent*)xe); + XSendEvent(qt_x11Data->display, extra->xDndProxy, False, NoEventMask, (XEvent*)xe); if (qt_xdnd_current_widget != w) { qt_xdnd_current_widget = w; } @@ -820,7 +820,7 @@ void QX11Data::xdndHandleEnter(QWidget *, const XEvent * xe, bool /*passive*/) int f; unsigned long n, a; unsigned char *retval = 0; - XGetWindowProperty(X11->display, qt_xdnd_dragsource_xid, ATOM(XdndTypelist), 0, + XGetWindowProperty(qt_x11Data->display, qt_xdnd_dragsource_xid, ATOM(XdndTypelist), 0, qt_xdnd_max_type, False, XA_ATOM, &type, &f,&n,&a,&retval); if (retval) { Atom *data = (Atom *)retval; @@ -861,7 +861,7 @@ static void handle_xdnd_position(QWidget *w, const XEvent * xe, bool passive) if (l[3] != 0) { // Some X server/client combination swallow the first 32 bit and // interpret a set bit 31 as negative sign. - qt_xdnd_target_current_time = X11->userTime = + qt_xdnd_target_current_time = qt_x11Data->userTime = ((sizeof(Time) == 8 && xe->xclient.data.l[3] < 0) ? uint(l[3]) : l[3]); @@ -920,7 +920,7 @@ static void handle_xdnd_position(QWidget *w, const XEvent * xe, bool passive) } } - DEBUG() << "qt_handle_xdnd_position action=" << X11->xdndAtomToString(l[4]); + DEBUG() << "qt_handle_xdnd_position action=" << qt_x11Data->xdndAtomToString(l[4]); if (!target_widget) { answerRect = QRect(p, QSize(1, 1)); } else { @@ -973,7 +973,7 @@ static void handle_xdnd_position(QWidget *w, const XEvent * xe, bool passive) if (source) handle_xdnd_status(source, (const XEvent *)&response, passive); else - XSendEvent(X11->display, qt_xdnd_dragsource_xid, False, NoEventMask, (XEvent*)&response); + XSendEvent(qt_x11Data->display, qt_xdnd_dragsource_xid, False, NoEventMask, (XEvent*)&response); } static Bool xdnd_position_scanner(Display *, XEvent *event, XPointer) @@ -991,7 +991,7 @@ static Bool xdnd_position_scanner(Display *, XEvent *event, XPointer) void QX11Data::xdndHandlePosition(QWidget * w, const XEvent * xe, bool passive) { DEBUG("xdndHandlePosition"); - while (XCheckIfEvent(X11->display, (XEvent *)xe, xdnd_position_scanner, 0)) + while (XCheckIfEvent(qt_x11Data->display, (XEvent *)xe, xdnd_position_scanner, 0)) ; handle_xdnd_position(w, xe, passive); @@ -1037,7 +1037,7 @@ static Bool xdnd_status_scanner(Display *, XEvent *event, XPointer) void QX11Data::xdndHandleStatus(QWidget * w, const XEvent * xe, bool passive) { DEBUG("xdndHandleStatus"); - while (XCheckIfEvent(X11->display, (XEvent *)xe, xdnd_status_scanner, 0)) + while (XCheckIfEvent(qt_x11Data->display, (XEvent *)xe, xdnd_status_scanner, 0)) ; handle_xdnd_status(w, xe, passive); @@ -1100,9 +1100,9 @@ void qt_xdnd_send_leave() w = 0; if (w) - X11->xdndHandleLeave(w, (const XEvent *)&leave, false); + qt_x11Data->xdndHandleLeave(w, (const XEvent *)&leave, false); else - XSendEvent(X11->display, qt_xdnd_current_proxy_target, False, + XSendEvent(qt_x11Data->display, qt_xdnd_current_proxy_target, False, NoEventMask, (XEvent*)&leave); // reset the drag manager state @@ -1145,7 +1145,7 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) if (l[2] != 0) { // Some X server/client combination swallow the first 32 bit and // interpret a set bit 31 as negative sign. - qt_xdnd_target_current_time = X11->userTime = + qt_xdnd_target_current_time = qt_x11Data->userTime = ((sizeof(Time) == 8 && xe->xclient.data.l[2] < 0) ? uint(l[2]) : l[2]); @@ -1158,7 +1158,7 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) QMimeData *dropData = 0; const int at = findXdndDropTransactionByTime(qt_xdnd_target_current_time); if (at != -1) { - dropData = QDragManager::dragPrivate(X11->dndDropTransactions.at(at).object)->data; + dropData = QDragManager::dragPrivate(qt_x11Data->dndDropTransactions.at(at).object)->data; // Can't use the source QMimeData if we need the image conversion code from xdndObtainData if (dropData && dropData->hasImage()) dropData = 0; @@ -1199,7 +1199,7 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) finished.data.l[0] = qt_xdnd_current_widget?qt_xdnd_current_widget->window()->internalWinId():0; finished.data.l[1] = de.isAccepted() ? 1 : 0; // flags finished.data.l[2] = qtaction_to_xdndaction(global_accepted_action); - XSendEvent(X11->display, qt_xdnd_dragsource_xid, False, + XSendEvent(qt_x11Data->display, qt_xdnd_dragsource_xid, False, NoEventMask, (XEvent*)&finished); } else { QDragLeaveEvent e; @@ -1228,7 +1228,7 @@ void QX11Data::xdndHandleFinished(QWidget *, const XEvent * xe, bool passive) if (at != -1) { restartXdndDropExpiryTimer(); - QXdndDropTransaction t = X11->dndDropTransactions.takeAt(at); + QXdndDropTransaction t = qt_x11Data->dndDropTransactions.takeAt(at); QDragManager *manager = QDragManager::self(); Window target = qt_xdnd_current_target; @@ -1266,14 +1266,14 @@ void QDragManager::timerEvent(QTimerEvent* e) if (e->timerId() == heartbeat && qt_xdnd_source_sameanswer.isNull()) { move(QCursor::pos()); } else if (e->timerId() == transaction_expiry_timer) { - for (int i = 0; i < X11->dndDropTransactions.count(); ++i) { - const QXdndDropTransaction &t = X11->dndDropTransactions.at(i); + for (int i = 0; i < qt_x11Data->dndDropTransactions.count(); ++i) { + const QXdndDropTransaction &t = qt_x11Data->dndDropTransactions.at(i); if (t.targetWidget) { // dnd within the same process, don't delete these continue; } t.object->deleteLater(); - X11->dndDropTransactions.removeAt(i--); + qt_x11Data->dndDropTransactions.removeAt(i--); } killTimer(transaction_expiry_timer); @@ -1441,10 +1441,10 @@ Window findRealWindow(const QPoint & pos, Window w, int md, bool ignoreNonXdndAw return 0; if (md) { - X11->ignoreBadwindow(); + qt_x11Data->ignoreBadwindow(); XWindowAttributes attr; - XGetWindowAttributes(X11->display, w, &attr); - if (X11->badwindow()) + XGetWindowAttributes(qt_x11Data->display, w, &attr); + if (qt_x11Data->badwindow()) return 0; if (attr.map_state == IsViewable @@ -1456,7 +1456,7 @@ Window findRealWindow(const QPoint & pos, Window w, int md, bool ignoreNonXdndAw unsigned long n, a; unsigned char *data; - XGetWindowProperty(X11->display, w, ATOM(XdndAware), 0, 0, False, + XGetWindowProperty(qt_x11Data->display, w, ATOM(XdndAware), 0, 0, False, AnyPropertyType, &type, &f,&n,&a,&data); if (data) XFree(data); if (type) { @@ -1482,7 +1482,7 @@ Window findRealWindow(const QPoint & pos, Window w, int md, bool ignoreNonXdndAw Window r, p; Window* c; uint nc; - if (XQueryTree(X11->display, w, &r, &p, &c, &nc)) { + if (XQueryTree(qt_x11Data->display, w, &r, &p, &c, &nc)) { r=0; for (uint i=nc; !r && i--;) { r = findRealWindow(pos-QPoint(attr.x,attr.y), @@ -1519,7 +1519,7 @@ void QDragManager::move(const QPoint & globalPos) } int screen = QCursor::x11Screen(); - if ((qt_xdnd_current_screen == -1 && screen != X11->defaultScreen) || (screen != qt_xdnd_current_screen)) { + if ((qt_xdnd_current_screen == -1 && screen != qt_x11Data->defaultScreen) || (screen != qt_xdnd_current_screen)) { // recreate the pixmap on the new screen... delete xdnd_data.deco; QWidget* parent = object->source()->window()->x11Info().screen() == screen @@ -1539,7 +1539,7 @@ void QDragManager::move(const QPoint & globalPos) Window rootwin = QX11Info::appRootWindow(qt_xdnd_current_screen); Window target = 0; int lx = 0, ly = 0; - if (!XTranslateCoordinates(X11->display, rootwin, rootwin, globalPos.x(), globalPos.y(), &lx, &ly, &target)) + if (!XTranslateCoordinates(qt_x11Data->display, rootwin, rootwin, globalPos.x(), globalPos.y(), &lx, &ly, &target)) // some weird error... return; @@ -1553,7 +1553,7 @@ void QDragManager::move(const QPoint & globalPos) int lx2, ly2; Window t; // translate coordinates - if (!XTranslateCoordinates(X11->display, src, target, lx, ly, &lx2, &ly2, &t)) { + if (!XTranslateCoordinates(qt_x11Data->display, src, target, lx, ly, &lx2, &ly2, &t)) { target = 0; break; } @@ -1566,7 +1566,7 @@ void QDragManager::move(const QPoint & globalPos) int f; unsigned long n, a; unsigned char *data = 0; - XGetWindowProperty(X11->display, target, ATOM(XdndAware), 0, 0, False, + XGetWindowProperty(qt_x11Data->display, target, ATOM(XdndAware), 0, 0, False, AnyPropertyType, &type, &f,&n,&a,&data); if (data) XFree(data); @@ -1576,7 +1576,7 @@ void QDragManager::move(const QPoint & globalPos) } // find child at the coordinates - if (!XTranslateCoordinates(X11->display, src, src, lx, ly, &lx2, &ly2, &target)) { + if (!XTranslateCoordinates(qt_x11Data->display, src, src, lx, ly, &lx2, &ly2, &target)) { target = 0; break; } @@ -1613,17 +1613,17 @@ void QDragManager::move(const QPoint & globalPos) int r, f; unsigned long n, a; unsigned char *retval; - X11->ignoreBadwindow(); - r = XGetWindowProperty(X11->display, proxy_target, ATOM(XdndAware), 0, + qt_x11Data->ignoreBadwindow(); + r = XGetWindowProperty(qt_x11Data->display, proxy_target, ATOM(XdndAware), 0, 1, False, AnyPropertyType, &type, &f,&n,&a,&retval); int *tv = (int *)retval; - if (r != Success || X11->badwindow()) { + if (r != Success || qt_x11Data->badwindow()) { target = 0; } else { target_version = qMin(xdnd_version,tv ? *tv : 1); if (tv) XFree(tv); -// if (!(!X11->badwindow() && type)) +// if (!(!qt_x11Data->badwindow() && type)) // target = 0; } } @@ -1639,14 +1639,14 @@ void QDragManager::move(const QPoint & globalPos) int flags = target_version << 24; QStringList fmts = QInternalMimeData::formatsHelper(dragPrivate()->data); for (int i = 0; i < fmts.size(); ++i) { - QList atoms = X11->xdndMimeAtomsForFormat(fmts.at(i)); + QList atoms = qt_x11Data->xdndMimeAtomsForFormat(fmts.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); } } if (types.size() > 3) { - XChangeProperty(X11->display, + XChangeProperty(qt_x11Data->display, dragPrivate()->source->effectiveWinId(), ATOM(XdndTypelist), XA_ATOM, 32, PropModeReplace, (unsigned char *)types.data(), @@ -1669,9 +1669,9 @@ void QDragManager::move(const QPoint & globalPos) DEBUG("sending Xdnd enter"); if (w) - X11->xdndHandleEnter(w, (const XEvent *)&enter, false); + qt_x11Data->xdndHandleEnter(w, (const XEvent *)&enter, false); else if (target) - XSendEvent(X11->display, proxy_target, False, NoEventMask, (XEvent*)&enter); + XSendEvent(qt_x11Data->display, proxy_target, False, NoEventMask, (XEvent*)&enter); waiting_for_status = false; } } @@ -1690,16 +1690,16 @@ void QDragManager::move(const QPoint & globalPos) move.data.l[0] = dragPrivate()->source->effectiveWinId(); move.data.l[1] = 0; // flags move.data.l[2] = (globalPos.x() << 16) + globalPos.y(); - move.data.l[3] = X11->time; + move.data.l[3] = qt_x11Data->time; move.data.l[4] = qtaction_to_xdndaction(defaultAction(dragPrivate()->possible_actions, QApplication::keyboardModifiers())); DEBUG("sending Xdnd position"); - qt_xdnd_source_current_time = X11->time; + qt_xdnd_source_current_time = qt_x11Data->time; if (w) handle_xdnd_position(w, (const XEvent *)&move, false); else - XSendEvent(X11->display, proxy_target, False, NoEventMask, + XSendEvent(qt_x11Data->display, proxy_target, False, NoEventMask, (XEvent*)&move); } else { if (willDrop) { @@ -1732,7 +1732,7 @@ void QDragManager::drop() drop.message_type = ATOM(XdndDrop); drop.data.l[0] = dragPrivate()->source->effectiveWinId(); drop.data.l[1] = 0; // flags - drop.data.l[2] = X11->time; + drop.data.l[2] = qt_x11Data->time; drop.data.l[3] = 0; drop.data.l[4] = 0; @@ -1743,20 +1743,20 @@ void QDragManager::drop() w = 0; QXdndDropTransaction t = { - X11->time, + qt_x11Data->time, qt_xdnd_current_target, qt_xdnd_current_proxy_target, w, current_embedding_widget, object }; - X11->dndDropTransactions.append(t); + qt_x11Data->dndDropTransactions.append(t); restartXdndDropExpiryTimer(); if (w) - X11->xdndHandleDrop(w, (const XEvent *)&drop, false); + qt_x11Data->xdndHandleDrop(w, (const XEvent *)&drop, false); else - XSendEvent(X11->display, qt_xdnd_current_proxy_target, False, + XSendEvent(qt_x11Data->display, qt_xdnd_current_proxy_target, False, NoEventMask, (XEvent*)&drop); qt_xdnd_current_target = 0; @@ -1848,7 +1848,7 @@ void QX11Data::xdndHandleSelectionRequest(const XSelectionRequestEvent * req) restartXdndDropExpiryTimer(); // use the drag object from an XdndDrop tansaction - manager->object = X11->dndDropTransactions.at(at).object; + manager->object = qt_x11Data->dndDropTransactions.at(at).object; } else if (at != -2) { // no transaction found, we'll have to reject the request manager->object = 0; @@ -1857,10 +1857,10 @@ void QX11Data::xdndHandleSelectionRequest(const XSelectionRequestEvent * req) Atom atomFormat = req->target; int dataFormat = 0; QByteArray data; - if (X11->xdndMimeDataForAtom(req->target, manager->dragPrivate()->data, + if (qt_x11Data->xdndMimeDataForAtom(req->target, manager->dragPrivate()->data, &data, &atomFormat, &dataFormat)) { int dataSize = data.size() / (dataFormat / 8); - XChangeProperty (X11->display, req->requestor, req->property, + XChangeProperty (qt_x11Data->display, req->requestor, req->property, atomFormat, dataFormat, PropModeReplace, (unsigned char *)data.data(), dataSize); evt.xselection.property = req->property; @@ -1873,7 +1873,7 @@ void QX11Data::xdndHandleSelectionRequest(const XSelectionRequestEvent * req) // ### this can die if req->requestor crashes at the wrong // ### moment - XSendEvent(X11->display, req->requestor, False, 0, &evt); + XSendEvent(qt_x11Data->display, req->requestor, False, 0, &evt); } static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) @@ -1907,30 +1907,30 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) ++i; } QByteArray encoding; - Atom a = X11->xdndMimeAtomForFormat(QLatin1String(format), requestedType, atoms, &encoding); + Atom a = qt_x11Data->xdndMimeAtomForFormat(QLatin1String(format), requestedType, atoms, &encoding); if (!a) return result; - if (XGetSelectionOwner(X11->display, ATOM(XdndSelection)) == XNone) + if (XGetSelectionOwner(qt_x11Data->display, ATOM(XdndSelection)) == XNone) return result; // should never happen? QWidget* tw = qt_xdnd_current_widget; if (!qt_xdnd_current_widget || (qt_xdnd_current_widget->windowType() == Qt::Desktop)) tw = new QWidget; - XConvertSelection(X11->display, ATOM(XdndSelection), a, ATOM(XdndSelection), tw->effectiveWinId(), + XConvertSelection(qt_x11Data->display, ATOM(XdndSelection), a, ATOM(XdndSelection), tw->effectiveWinId(), qt_xdnd_target_current_time); - XFlush(X11->display); + XFlush(qt_x11Data->display); XEvent xevent; - bool got=X11->clipboardWaitForEvent(tw->effectiveWinId(), SelectionNotify, &xevent, 5000); + bool got=qt_x11Data->clipboardWaitForEvent(tw->effectiveWinId(), SelectionNotify, &xevent, 5000); if (got) { Atom type; - if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) { + if (qt_x11Data->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0; - result = X11->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false); + result = qt_x11Data->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false); } else if (type != a && type != XNone) { DEBUG("Qt clipboard: unknown atom %ld", type); } @@ -1939,7 +1939,7 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) if (!qt_xdnd_current_widget || (qt_xdnd_current_widget->windowType() == Qt::Desktop)) delete tw; - return X11->xdndMimeConvertToFormat(a, result, QLatin1String(format), requestedType, encoding); + return qt_x11Data->xdndMimeConvertToFormat(a, result, QLatin1String(format), requestedType, encoding); } @@ -1982,7 +1982,7 @@ Qt::DropAction QDragManager::drag(QDrag * o) XEvent event; // Pass the event through the event dispatcher filter so that applications // which install an event filter on the dispatcher get to handle it first. - if (XCheckTypedEvent(X11->display, ClientMessage, &event) && + if (XCheckTypedEvent(qt_x11Data->display, ClientMessage, &event) && !QAbstractEventDispatcher::instance()->filterEvent(&event)) qApp->x11ProcessEvent(&event); @@ -2003,7 +2003,7 @@ Qt::DropAction QDragManager::drag(QDrag * o) updatePixmap(); qApp->installEventFilter(this); - XSetSelectionOwner(X11->display, ATOM(XdndSelection), dragPrivate()->source->window()->internalWinId(), X11->time); + XSetSelectionOwner(qt_x11Data->display, ATOM(XdndSelection), dragPrivate()->source->window()->internalWinId(), qt_x11Data->time); global_accepted_action = Qt::CopyAction; qt_xdnd_source_sameanswer = QRect(); #ifndef QT_NO_CURSOR @@ -2079,8 +2079,8 @@ void QDragManager::updatePixmap() QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const { QByteArray mime = mimetype.toLatin1(); - QVariant data = X11->motifdnd_active - ? X11->motifdndObtainData(mime) + QVariant data = qt_x11Data->motifdnd_active + ? qt_x11Data->motifdndObtainData(mime) : xdndObtainData(mime, requestedType); return data; } @@ -2093,17 +2093,17 @@ bool QDropData::hasFormat_sys(const QString &format) const QStringList QDropData::formats_sys() const { QStringList formats; - if (X11->motifdnd_active) { + if (qt_x11Data->motifdnd_active) { int i = 0; QByteArray fmt; - while (!(fmt = X11->motifdndFormat(i)).isEmpty()) { + while (!(fmt = qt_x11Data->motifdndFormat(i)).isEmpty()) { formats.append(QLatin1String(fmt)); ++i; } } else { int i = 0; while ((qt_xdnd_types[i])) { - QStringList formatsForAtom = X11->xdndMimeFormatsForAtom(qt_xdnd_types[i]); + QStringList formatsForAtom = qt_x11Data->xdndMimeFormatsForAtom(qt_xdnd_types[i]); for (int j = 0; j < formatsForAtom.size(); ++j) { if (!formats.contains(formatsForAtom.at(j))) formats.append(formatsForAtom.at(j)); diff --git a/src/gui/kernel/qeventdispatcher_x11.cpp b/src/gui/kernel/qeventdispatcher_x11.cpp index 1b939e57d..112afa48e 100644 --- a/src/gui/kernel/qeventdispatcher_x11.cpp +++ b/src/gui/kernel/qeventdispatcher_x11.cpp @@ -74,7 +74,7 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags) d->interrupt = false; QApplication::sendPostedEvents(); - ulong marker = XNextRequest(X11->display); + ulong marker = XNextRequest(qt_x11Data->display); int nevents = 0; do { while (!d->interrupt) { @@ -83,9 +83,9 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags) && !d->queuedUserInputEvents.isEmpty()) { // process a pending user input event event = d->queuedUserInputEvents.takeFirst(); - } else if (XEventsQueued(X11->display, QueuedAlready)) { + } else if (XEventsQueued(qt_x11Data->display, QueuedAlready)) { // process events from the X server - XNextEvent(X11->display, &event); + XNextEvent(qt_x11Data->display, &event); if (flags & QEventLoop::ExcludeUserInputEvents) { // queue user input events @@ -133,12 +133,12 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags) return true; if (event.xany.serial >= marker) { - if (XEventsQueued(X11->display, QueuedAfterFlush)) + if (XEventsQueued(qt_x11Data->display, QueuedAfterFlush)) flags &= ~QEventLoop::WaitForMoreEvents; goto out; } } - } while (!d->interrupt && XEventsQueued(X11->display, QueuedAfterFlush)); + } while (!d->interrupt && XEventsQueued(qt_x11Data->display, QueuedAfterFlush)); out: if (!d->interrupt) { @@ -157,18 +157,18 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherX11::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return (qGlobalPostedEventsCount() || XPending(X11->display)); + return (qGlobalPostedEventsCount() || XPending(qt_x11Data->display)); } void QEventDispatcherX11::flush() { - XFlush(X11->display); + XFlush(qt_x11Data->display); } void QEventDispatcherX11::startingUp() { Q_D(QEventDispatcherX11); - d->xfd = XConnectionNumber(X11->display); + d->xfd = XConnectionNumber(qt_x11Data->display); } void QEventDispatcherX11::closingDown() diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp index c7f0cb52c..5b964620c 100644 --- a/src/gui/kernel/qguieventdispatcher_glib.cpp +++ b/src/gui/kernel/qguieventdispatcher_glib.cpp @@ -74,7 +74,7 @@ static gboolean x11EventSourcePrepare(GSource *s, gint *timeout) if (timeout) *timeout = -1; GX11EventSource *source = reinterpret_cast(s); - return (XEventsQueued(X11->display, QueuedAfterFlush) + return (XEventsQueued(qt_x11Data->display, QueuedAfterFlush) || (!(source->flags & QEventLoop::ExcludeUserInputEvents) && !source->d->queuedUserInputEvents.isEmpty())); } @@ -82,7 +82,7 @@ static gboolean x11EventSourcePrepare(GSource *s, gint *timeout) static gboolean x11EventSourceCheck(GSource *s) { GX11EventSource *source = reinterpret_cast(s); - return (XEventsQueued(X11->display, QueuedAfterFlush) + return (XEventsQueued(qt_x11Data->display, QueuedAfterFlush) || (!(source->flags & QEventLoop::ExcludeUserInputEvents) && !source->d->queuedUserInputEvents.isEmpty())); } @@ -91,16 +91,16 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe { GX11EventSource *source = reinterpret_cast(s); - ulong marker = XNextRequest(X11->display); + ulong marker = XNextRequest(qt_x11Data->display); do { XEvent event; if (!(source->flags & QEventLoop::ExcludeUserInputEvents) && !source->d->queuedUserInputEvents.isEmpty()) { // process a pending user input event event = source->d->queuedUserInputEvents.takeFirst(); - } else if (XEventsQueued(X11->display, QueuedAlready)) { + } else if (XEventsQueued(qt_x11Data->display, QueuedAlready)) { // process events from the X server - XNextEvent(X11->display, &event); + XNextEvent(qt_x11Data->display, &event); if (source->flags & QEventLoop::ExcludeUserInputEvents) { // queue user input events @@ -148,7 +148,7 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe if (event.xany.serial >= marker) goto out; - } while (XEventsQueued(X11->display, QueuedAfterFlush)); + } while (XEventsQueued(qt_x11Data->display, QueuedAfterFlush)); out: @@ -209,7 +209,7 @@ bool QGuiEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags void QGuiEventDispatcherGlib::startingUp() { Q_D(QGuiEventDispatcherGlib); - d->x11EventSource->pollfd.fd = XConnectionNumber(X11->display); + d->x11EventSource->pollfd.fd = XConnectionNumber(qt_x11Data->display); d->x11EventSource->pollfd.events = G_IO_IN | G_IO_HUP | G_IO_ERR; d->x11EventSource->q = this; d->x11EventSource->d = d; @@ -218,7 +218,7 @@ void QGuiEventDispatcherGlib::startingUp() void QGuiEventDispatcherGlib::flush() { - XFlush(X11->display); + XFlush(qt_x11Data->display); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index bf0e8ef02..f6f2bbf04 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -77,7 +77,7 @@ QGuiPlatformPlugin *qt_guiPlatformPlugin() QString key = QString::fromLocal8Bit(qgetenv("QT_PLATFORM_PLUGIN")); #ifdef Q_WS_X11 if (key.isEmpty()) { - switch(X11->desktopEnvironment) { + switch(qt_x11Data->desktopEnvironment) { case DE_KDE: key = QString::fromLatin1("kde"); break; @@ -125,12 +125,12 @@ QString QGuiPlatformPlugin::styleName() return QLatin1String("CDE"); // default style for X11 on Solaris #elif defined(Q_WS_X11) QString stylename; - switch(X11->desktopEnvironment) { + switch(qt_x11Data->desktopEnvironment) { case DE_KDE: stylename = QKde::kdeStyle(); break; case DE_GNOME: { - if (X11->use_xrender) + if (qt_x11Data->use_xrender) stylename = QLatin1String("cleanlooks"); else stylename = QLatin1String("windows"); @@ -151,7 +151,7 @@ QString QGuiPlatformPlugin::styleName() QPalette QGuiPlatformPlugin::palette() { #ifdef Q_WS_X11 - if (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE) + if (QApplication::desktopSettingsAware() && qt_x11Data->desktopEnvironment == DE_KDE) return QKde::kdePalette(); #endif @@ -163,12 +163,12 @@ QString QGuiPlatformPlugin::systemIconThemeName() { QString result; #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_GNOME) { + if (qt_x11Data->desktopEnvironment == DE_GNOME) { if (result.isEmpty()) { result = QString::fromLatin1("gnome"); } - } else if (X11->desktopEnvironment == DE_KDE) { - result = X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); + } else if (qt_x11Data->desktopEnvironment == DE_KDE) { + result = qt_x11Data->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); settings.beginGroup(QLatin1String("Icons")); result = settings.value(QLatin1String("Theme"), result).toString(); @@ -193,7 +193,7 @@ QStringList QGuiPlatformPlugin::iconThemeSearchPaths() if (dir.exists()) paths.append(dir.path() + QLatin1String("/icons")); } - if (X11->desktopEnvironment == DE_KDE) { + if (qt_x11Data->desktopEnvironment == DE_KDE) { paths << QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share/icons"); QStringList kdeDirs = QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':')); for (int i = 0 ; i< kdeDirs.count() ; ++i) { @@ -227,7 +227,7 @@ int QGuiPlatformPlugin::platformHint(PlatformHint hint) case PH_ToolButtonStyle: ret = Qt::ToolButtonIconOnly; #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4 + if (qt_x11Data->desktopEnvironment == DE_KDE && qt_x11Data->desktopVersion >= 4 && QApplication::desktopSettingsAware()) { ret = QKde::kdeToolButtonStyle(); } @@ -235,7 +235,7 @@ int QGuiPlatformPlugin::platformHint(PlatformHint hint) break; case PH_ToolBarIconSize: #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4 + if (qt_x11Data->desktopEnvironment == DE_KDE && qt_x11Data->desktopVersion >= 4 && QApplication::desktopSettingsAware()) { ret = QKde::kdeToolBarIconSize(); } diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp index f67af561d..817fe8564 100644 --- a/src/gui/kernel/qkde.cpp +++ b/src/gui/kernel/qkde.cpp @@ -63,7 +63,7 @@ QString QKde::kdeHome() if (kdeHomePath.isEmpty()) { QDir homeDir(QDir::homePath()); QString kdeConfDir(QLatin1String("/.kde")); - if (4 == X11->desktopVersion && homeDir.exists(QLatin1String(".kde4"))) + if (4 == qt_x11Data->desktopVersion && homeDir.exists(QLatin1String(".kde4"))) kdeConfDir = QLatin1String("/.kde4"); kdeHomePath = QDir::homePath() + kdeConfDir; } @@ -125,7 +125,7 @@ QPalette QKde::kdePalette() */ QString QKde::kdeStyle() { - if (X11->desktopVersion >= 4) { + if (qt_x11Data->desktopVersion >= 4) { QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); QString style = kdeSettings.value(QLatin1String("widgetStyle"), QLatin1String("Oxygen")).toString(); @@ -134,7 +134,7 @@ QString QKde::kdeStyle() return style; } - if (X11->use_xrender) + if (qt_x11Data->use_xrender) return QLatin1String("plastique"); else return QLatin1String("windows"); diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index e71e15c70..44997e49e 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -332,10 +332,10 @@ void QKeyMapperPrivate::clearMappings() coreDesc.min_keycode = 8; coreDesc.max_keycode = 255; - XDisplayKeycodes(X11->display, &coreDesc.min_keycode, &coreDesc.max_keycode); + XDisplayKeycodes(qt_x11Data->display, &coreDesc.min_keycode, &coreDesc.max_keycode); coreDesc.keysyms_per_keycode = 0; - coreDesc.keysyms = XGetKeyboardMapping(X11->display, + coreDesc.keysyms = XGetKeyboardMapping(qt_x11Data->display, coreDesc.min_keycode, coreDesc.max_keycode - coreDesc.min_keycode + 1, &coreDesc.keysyms_per_keycode); @@ -360,7 +360,7 @@ void QKeyMapperPrivate::clearMappings() coreDesc.lock_meaning = NoSymbol; - XModifierKeymap *map = XGetModifierMapping(X11->display); + XModifierKeymap *map = XGetModifierMapping(qt_x11Data->display); if (map) { int i, maskIndex = 0, mapIndex = 0; @@ -370,7 +370,7 @@ void QKeyMapperPrivate::clearMappings() KeySym sym; int x = 0; do { - sym = XKeycodeToKeysym(X11->display, map->modifiermap[mapIndex], x++); + sym = XKeycodeToKeysym(qt_x11Data->display, map->modifiermap[mapIndex], x++); } while (sym == NoSymbol && x < coreDesc.keysyms_per_keycode); const uchar mask = 1 << maskIndex; SETMASK(sym, mask); @@ -382,7 +382,7 @@ void QKeyMapperPrivate::clearMappings() // determine the meaning of the Lock modifier for (i = 0; i < map->max_keypermod; ++i) { for (int x = 0; x < coreDesc.keysyms_per_keycode; ++x) { - KeySym sym = XKeycodeToKeysym(X11->display, map->modifiermap[LockMapIndex], x); + KeySym sym = XKeycodeToKeysym(qt_x11Data->display, map->modifiermap[LockMapIndex], x); if (sym == XK_Caps_Lock || sym == XK_ISO_Lock) { coreDesc.lock_meaning = XK_Caps_Lock; break; @@ -1035,7 +1035,7 @@ static QString translateKeySym(KeySym keysym, uint xmodifiers, } } - modifiers = X11->translateModifiers(xmodifiers); + modifiers = qt_x11Data->translateModifiers(xmodifiers); // Commentary in X11/keysymdef says that X codes match ASCII, so it // is safe to use the locale functions to process X codes in ISO8859-1. @@ -1236,7 +1236,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *keyWidget, const XEvent *even if (qt_sm_blockUserInput) // block user interaction during session management return true; - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; if (!keyWidget->isEnabled()) return true; diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp index e2ff22b59..19d2bba3d 100644 --- a/src/gui/kernel/qmotifdnd_x11.cpp +++ b/src/gui/kernel/qmotifdnd_x11.cpp @@ -712,7 +712,7 @@ QByteArray QX11Data::motifdndFormat(int n) if (target == ATOM(TEXT)) return "text/plain"; - return ("x-motif-dnd/" + X11->xdndAtomToString(target)); + return ("x-motif-dnd/" + qt_x11Data->xdndAtomToString(target)); } @@ -746,10 +746,10 @@ QVariant QX11Data::motifdndObtainData(const char *mimeType) conversion_type = ATOM(TEXT); } else if (f.startsWith("x-motif-dnd/")) { // strip off the "x-motif-dnd/" prefix - conversion_type = X11->xdndStringToAtom(f.remove(0, 12)); + conversion_type = qt_x11Data->xdndStringToAtom(f.remove(0, 12)); } - if (XGetSelectionOwner(X11->display, Dnd_selection) == XNone) { + if (XGetSelectionOwner(qt_x11Data->display, Dnd_selection) == XNone) { return result; // should never happen? } @@ -759,26 +759,26 @@ QVariant QX11Data::motifdndObtainData(const char *mimeType) } // convert selection to the appropriate type - XConvertSelection (X11->display, Dnd_selection, conversion_type, + XConvertSelection (qt_x11Data->display, Dnd_selection, conversion_type, Dnd_selection, tw->internalWinId(), Dnd_selection_time); - XFlush(X11->display); + XFlush(qt_x11Data->display); XEvent xevent; - bool got=X11->clipboardWaitForEvent(tw->internalWinId(), SelectionNotify, &xevent, 5000); + bool got=qt_x11Data->clipboardWaitForEvent(tw->internalWinId(), SelectionNotify, &xevent, 5000); if (got) { Atom type; - if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0)) { + if (qt_x11Data->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0)) { } } // we have to convert selection in order to indicate success to the initiator - XConvertSelection (X11->display, Dnd_selection, ATOM(XmTRANSFER_SUCCESS), + XConvertSelection (qt_x11Data->display, Dnd_selection, ATOM(XmTRANSFER_SUCCESS), Dnd_selection, tw->internalWinId(), Dnd_selection_time); // wait again for SelectionNotify event - X11->clipboardWaitForEvent(tw->internalWinId(), SelectionNotify, &xevent, 5000); + qt_x11Data->clipboardWaitForEvent(tw->internalWinId(), SelectionNotify, &xevent, 5000); if ((dropWidget->windowType() == Qt::Desktop)) { delete tw; @@ -823,13 +823,13 @@ void QX11Data::motifdndHandle(QWidget *widget, const XEvent * xe, bool /* passiv lastAcceptedAction = Qt::IgnoreAction; dnd_data.reason = DND_DROP_SITE_LEAVE; - dnd_data.time = X11->time; + dnd_data.time = qt_x11Data->time; DndFillClientMessage (event.xclient.display, sourceWindow, &cm, &dnd_data, receiver); XSendEvent(event.xbutton.display, sourceWindow, False, 0, (XEvent *)&cm) ; } else { dnd_data.reason = DND_DRAG_MOTION; dnd_data.status = DND_NO_DROP_SITE; - dnd_data.time = X11->time; + dnd_data.time = qt_x11Data->time; dnd_data.operation = DND_NOOP; dnd_data.operations = DND_NOOP; DndFillClientMessage (event.xclient.display, sourceWindow, &cm, &dnd_data, receiver); @@ -855,7 +855,7 @@ void QX11Data::motifdndHandle(QWidget *widget, const XEvent * xe, bool /* passiv QApplication::sendEvent(dropWidget, &de); dnd_data.reason = DND_DROP_SITE_ENTER; - dnd_data.time = X11->time; + dnd_data.time = qt_x11Data->time; if (de.isAccepted()) { lastAcceptedAction = de.dropAction(); @@ -880,7 +880,7 @@ void QX11Data::motifdndHandle(QWidget *widget, const XEvent * xe, bool /* passiv QApplication::sendEvent(dropWidget, &me); dnd_data.reason = DND_DRAG_MOTION; - dnd_data.time = X11->time; + dnd_data.time = qt_x11Data->time; if (me.isAccepted()) { lastAcceptedAction = me.dropAction(); @@ -920,9 +920,9 @@ void QX11Data::motifdndHandle(QWidget *widget, const XEvent * xe, bool /* passiv case DND_TOP_LEVEL_LEAVE: { XEvent nextEvent; - if (XCheckTypedWindowEvent(X11->display, widget->winId(), ClientMessage, &nextEvent)) { + if (XCheckTypedWindowEvent(qt_x11Data->display, widget->winId(), ClientMessage, &nextEvent)) { // we just want to check, not eat (should use XPeekIfEvent) - XPutBackEvent(X11->display, &nextEvent); + XPutBackEvent(qt_x11Data->display, &nextEvent); if (DndParseClientMessage (&nextEvent.xclient, &dnd_data, &receiver) && dnd_data.reason == DND_DROP_START) { @@ -965,7 +965,7 @@ void QX11Data::motifdndHandle(QWidget *widget, const XEvent * xe, bool /* passiv XSendEvent(event.xbutton.display, sourceWindow, False, 0, (XEvent *)&cm); // we have to convert selection in order to indicate failure to the initiator - XConvertSelection (X11->display, dnd_data.property, ATOM(XmTRANSFER_FAILURE), + XConvertSelection (qt_x11Data->display, dnd_data.property, ATOM(XmTRANSFER_FAILURE), dnd_data.property, dnd_data.src_window, dnd_data.time); if (dropWidget) { diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 48222037e..669a7fce7 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -487,7 +487,6 @@ struct QX11Data extern Q_GUI_EXPORT QX11Data *qt_x11Data; #define ATOM(x) qt_x11Data->atoms[QX11Data::x] -#define X11 qt_x11Data // rename a couple of X defines to get rid of name clashes // resolve the conflict between X11's FocusIn and QEvent::FocusIn diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index fbe8a221d..5899f7b65 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -222,8 +222,8 @@ static void qt_insert_sip(QWidget* scrolled_widget, int dx, int dy) { if (!scrolled_widget->isWindow() && !scrolled_widget->internalWinId()) return; - QX11Data::ScrollInProgress sip = { X11->sip_serial++, scrolled_widget, dx, dy }; - X11->sip_list.append(sip); + QX11Data::ScrollInProgress sip = { qt_x11Data->sip_serial++, scrolled_widget, dx, dy }; + qt_x11Data->sip_list.append(sip); XClientMessageEvent client_message; client_message.type = ClientMessage; @@ -232,7 +232,7 @@ static void qt_insert_sip(QWidget* scrolled_widget, int dx, int dy) client_message.message_type = ATOM(_QT_SCROLL_DONE); client_message.data.l[0] = sip.id; - XSendEvent(X11->display, scrolled_widget->internalWinId(), False, NoEventMask, + XSendEvent(qt_x11Data->display, scrolled_widget->internalWinId(), False, NoEventMask, (XEvent*)&client_message); } @@ -240,8 +240,8 @@ static int qt_sip_count(QWidget* scrolled_widget) { int sips=0; - for (int i = 0; i < X11->sip_list.size(); ++i) { - const QX11Data::ScrollInProgress &sip = X11->sip_list.at(i); + for (int i = 0; i < qt_x11Data->sip_list.size(); ++i) { + const QX11Data::ScrollInProgress &sip = qt_x11Data->sip_list.at(i); if (sip.scrolled_widget == scrolled_widget) sips++; } @@ -251,25 +251,25 @@ static int qt_sip_count(QWidget* scrolled_widget) static void create_wm_client_leader() { - if (X11->wm_client_leader) return; + if (qt_x11Data->wm_client_leader) return; - X11->wm_client_leader = - XCreateSimpleWindow(X11->display, + qt_x11Data->wm_client_leader = + XCreateSimpleWindow(qt_x11Data->display, QX11Info::appRootWindow(), 0, 0, 1, 1, 0, 0, 0); // set client leader property to itself - XChangeProperty(X11->display, - X11->wm_client_leader, ATOM(WM_CLIENT_LEADER), + XChangeProperty(qt_x11Data->display, + qt_x11Data->wm_client_leader, ATOM(WM_CLIENT_LEADER), XA_WINDOW, 32, PropModeReplace, - (unsigned char *)&X11->wm_client_leader, 1); + (unsigned char *)&qt_x11Data->wm_client_leader, 1); #ifndef QT_NO_SESSIONMANAGER // If we are session managed, inform the window manager about it QByteArray session = qApp->sessionId().toLatin1(); if (!session.isEmpty()) { - XChangeProperty(X11->display, - X11->wm_client_leader, ATOM(SM_CLIENT_ID), + XChangeProperty(qt_x11Data->display, + qt_x11Data->wm_client_leader, ATOM(SM_CLIENT_ID), XA_STRING, 8, PropModeReplace, (unsigned char *)session.data(), session.size()); } @@ -314,17 +314,17 @@ void qt_x11_enforce_cursor(QWidget * w, bool force) #ifndef QT_NO_CURSOR QCursor *oc = QApplication::overrideCursor(); if (oc) { - XDefineCursor(X11->display, winid, oc->handle()); + XDefineCursor(qt_x11Data->display, winid, oc->handle()); } else if (w->isEnabled()) { - XDefineCursor(X11->display, winid, w->cursor().handle()); + XDefineCursor(qt_x11Data->display, winid, w->cursor().handle()); } else { // enforce the windows behavior of clearing the cursor on // disabled widgets - XDefineCursor(X11->display, winid, XNone); + XDefineCursor(qt_x11Data->display, winid, XNone); } #endif } else { - XDefineCursor(X11->display, winid, XNone); + XDefineCursor(qt_x11Data->display, winid, XNone); } } @@ -356,8 +356,8 @@ void qt_x11_wait_for_window_manager(QWidget *w, bool sendPostedEvents) } state = Initial; do { - if (XEventsQueued(X11->display, QueuedAlready)) { - XNextEvent(X11->display, &ev); + if (XEventsQueued(qt_x11Data->display, QueuedAlready)) { + XNextEvent(qt_x11Data->display, &ev); // Pass the event through the event dispatcher filter so that applications // which install an event filter on the dispatcher get to handle it first. if (!QAbstractEventDispatcher::instance()->filterEvent(&ev)) { @@ -375,7 +375,7 @@ void qt_x11_wait_for_window_manager(QWidget *w, bool sendPostedEvents) } } } else { - if (!XEventsQueued(X11->display, QueuedAfterFlush)) + if (!XEventsQueued(qt_x11Data->display, QueuedAfterFlush)) qApp->syncX(); // non-busy wait } if (t.elapsed() > maximumWaitTime) @@ -396,7 +396,7 @@ void qt_change_net_wm_state(const QWidget* w, bool set, Atom one, Atom two = 0) XEvent e; e.xclient.type = ClientMessage; e.xclient.message_type = ATOM(_NET_WM_STATE); - e.xclient.display = X11->display; + e.xclient.display = qt_x11Data->display; e.xclient.window = w->internalWinId(); e.xclient.format = 32; e.xclient.data.l[0] = set ? 1 : 0; @@ -404,7 +404,7 @@ void qt_change_net_wm_state(const QWidget* w, bool set, Atom one, Atom two = 0) e.xclient.data.l[2] = two; e.xclient.data.l[3] = 0; e.xclient.data.l[4] = 0; - XSendEvent(X11->display, RootWindow(X11->display, w->x11Info().screen()), + XSendEvent(qt_x11Data->display, RootWindow(qt_x11Data->display, w->x11Info().screen()), false, (SubstructureNotifyMask | SubstructureRedirectMask), &e); } @@ -418,7 +418,7 @@ static QVector getNetWmState(QWidget *w) ulong propertyLength; ulong bytesLeft; uchar *propertyData = 0; - if (XGetWindowProperty(X11->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0, 0, + if (XGetWindowProperty(qt_x11Data->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0, 0, False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) == Success && actualType == XA_ATOM && actualFormat == 32) { @@ -427,7 +427,7 @@ static QVector getNetWmState(QWidget *w) propertyData = 0; // fetch all data - if (XGetWindowProperty(X11->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0, + if (XGetWindowProperty(qt_x11Data->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0, returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) != Success) { returnValue.clear(); @@ -476,7 +476,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } if (type == Qt::SplashScreen) { - if (X11->isSupportedByWM(ATOM(_NET_WM_WINDOW_TYPE_SPLASH))) { + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WM_WINDOW_TYPE_SPLASH))) { flags &= ~Qt::X11BypassWindowManagerHint; } else { flags |= Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint; @@ -503,7 +503,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO qt_x11_create_desktop_on_screen >= 0 && qt_x11_create_desktop_on_screen != xinfo.screen()) { // desktop on a certain screen other than the default requested - QX11InfoData *xd = &X11->screens[qt_x11_create_desktop_on_screen]; + QX11InfoData *xd = &qt_x11Data->screens[qt_x11_create_desktop_on_screen]; xinfo.setX11Data(xd); } else if (parentXinfo && (parentXinfo->screen() != xinfo.screen() || parentXinfo->visual() != xinfo.visual())) @@ -513,7 +513,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO //get display, screen number, root window and desktop geometry for //the current screen - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; int scr = xinfo.screen(); Window root_win = RootWindow(dpy, scr); int sw = DisplayWidth(dpy,scr); @@ -546,7 +546,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (window) { // override the old window if (destroyOldWindow) { if (topLevel) - X11->dndEnable(q, false); + qt_x11Data->dndEnable(q, false); destroyw = data.winid; } id = window; @@ -597,15 +597,15 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } #ifndef QT_NO_XRENDER int screen = xinfo.screen(); - if (topLevel && X11->use_xrender - && xinfo.depth() != 32 && X11->argbVisuals[screen] + if (topLevel && qt_x11Data->use_xrender + && xinfo.depth() != 32 && qt_x11Data->argbVisuals[screen] && q->testAttribute(Qt::WA_TranslucentBackground)) { QX11InfoData *xd = xinfo.getX11Data(true); xd->screen = screen; - xd->visual = X11->argbVisuals[screen]; - xd->colormap = X11->argbColormaps[screen]; + xd->visual = qt_x11Data->argbVisuals[screen]; + xd->colormap = qt_x11Data->argbColormaps[screen]; xd->depth = 32; xd->defaultVisual = false; xd->defaultColormap = false; @@ -638,11 +638,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO #ifndef QT_NO_XRENDER if (picture) { - XRenderFreePicture(X11->display, picture); + XRenderFreePicture(qt_x11Data->display, picture); picture = 0; } - if (X11->use_xrender && !desktop && q->internalWinId()) { + if (qt_x11Data->use_xrender && !desktop && q->internalWinId()) { XRenderPictFormat *format = XRenderFindVisualFormat(dpy, (Visual *) xinfo.visual()); if (format) picture = XRenderCreatePicture(dpy, id, format, 0, 0); @@ -738,7 +738,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO XChangeWindowAttributes(dpy, id, CWOverrideRedirect | CWSaveUnder, &wsa); } else if (topLevel && !desktop) { // top-level widget - if (!X11->wm_client_leader) + if (!qt_x11Data->wm_client_leader) create_wm_client_leader(); // note: WM_TRANSIENT_FOR is set in QWidgetPrivate::show_sys() @@ -758,7 +758,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO wm_hints.flags = InputHint | StateHint | WindowGroupHint; wm_hints.input = q->testAttribute(Qt::WA_X11DoNotAcceptFocus) ? False : True; wm_hints.initial_state = NormalState; - wm_hints.window_group = X11->wm_client_leader; + wm_hints.window_group = qt_x11Data->wm_client_leader; XClassHint class_hint; QByteArray appName = QApplication::applicationName().toLatin1(); @@ -812,7 +812,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO // set client leader property XChangeProperty(dpy, id, ATOM(WM_CLIENT_LEADER), XA_WINDOW, 32, PropModeReplace, - (unsigned char *)&X11->wm_client_leader, 1); + (unsigned char *)&qt_x11Data->wm_client_leader, 1); } else { // non-toplevel widgets don't have a frame, so no need to // update the strut @@ -849,7 +849,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO //always enable dnd: it's not worth the effort to maintain the state // NOTE: this always creates topData() - X11->dndEnable(q, true); + qt_x11Data->dndEnable(q, true); if (maybeTopData() && maybeTopData()->opacity != 255) q->setWindowOpacity(maybeTopData()->opacity/255.); @@ -862,7 +862,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } if (extra && !extra->mask.isEmpty() && q->internalWinId()) - XShapeCombineRegion(X11->display, q->internalWinId(), ShapeBounding, 0, 0, + XShapeCombineRegion(qt_x11Data->display, q->internalWinId(), ShapeBounding, 0, 0, extra->mask.handle(), ShapeSet); if (destroyw) { qt_XDestroyWindow(q, dpy, destroyw); @@ -889,7 +889,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (!topLevel && q->testAttribute(Qt::WA_NativeWindow) && q->testAttribute(Qt::WA_Mapped)) { Q_ASSERT(q->internalWinId()); - XMapWindow(X11->display, q->internalWinId()); + XMapWindow(qt_x11Data->display, q->internalWinId()); // Ensure that mapped alien widgets are flushed immediately when re-created as native widgets. if (QWindowSurface *surface = q->windowSurface()) surface->flush(q, q->rect(), q->mapTo(surface->window(), QPoint())); @@ -932,8 +932,8 @@ void QWidgetPrivate::x11UpdateIsOpaque() bool topLevel = (data.window_flags & Qt::Window); int screen = xinfo.screen(); - if (topLevel && X11->use_xrender - && X11->argbVisuals[screen] && xinfo.depth() != 32) + if (topLevel && qt_x11Data->use_xrender + && qt_x11Data->argbVisuals[screen] && xinfo.depth() != 32) { qt_x11_recreateNativeWidgetsRecursive(q); } @@ -999,7 +999,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (QWidgetPrivate::keyboardGrabber == this) releaseKeyboard(); if (isWindow()) - X11->deferred_map.removeAll(this); + qt_x11Data->deferred_map.removeAll(this); if (isModal()) { // just be sure we leave modal QApplicationPrivate::leaveModal(this); @@ -1010,7 +1010,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) #ifndef QT_NO_XRENDER if (d->picture) { if (destroyWindow) - XRenderFreePicture(X11->display, d->picture); + XRenderFreePicture(qt_x11Data->display, d->picture); d->picture = 0; } #endif // QT_NO_XRENDER @@ -1020,12 +1020,12 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if ((windowType() == Qt::Desktop)) { if (acceptDrops()) - X11->dndEnable(this, false); + qt_x11Data->dndEnable(this, false); } else { if (isWindow()) - X11->dndEnable(this, false); + qt_x11Data->dndEnable(this, false); if (destroyWindow) - qt_XDestroyWindow(this, X11->display, data->winid); + qt_XDestroyWindow(this, qt_x11Data->display, data->winid); } QT_TRY { d->setWinId(0); @@ -1069,7 +1069,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // if we are a top then remove our dnd prop for now // it will get rest later if (q->isWindow() && wasCreated) - X11->dndEnable(q, false); + qt_x11Data->dndEnable(q, false); if (topData) qt_net_remove_user_time(q); @@ -1082,7 +1082,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) #ifndef QT_NO_XRENDER if (picture) { - XRenderFreePicture(X11->display, picture); + XRenderFreePicture(qt_x11Data->display, picture); picture = 0; } #endif @@ -1090,9 +1090,9 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // hide and reparent our own window away. Otherwise we might get // destroyed when emitting the child remove event below. See QWorkspace. if (wasCreated && old_winid) { - XUnmapWindow(X11->display, old_winid); + XUnmapWindow(qt_x11Data->display, old_winid); if (old_xinfo.screen() != xinfo.screen()) - XReparentWindow(X11->display, old_winid, RootWindow(X11->display, xinfo.screen()), 0, 0); + XReparentWindow(qt_x11Data->display, old_winid, RootWindow(qt_x11Data->display, xinfo.screen()), 0, 0); } if (topData) { topData->parentWinId = 0; @@ -1146,7 +1146,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // Qt::WA_NativeWindow ensures that we always have a nativeParentWidget Q_ASSERT(nativeParentWidget != 0); QPoint p = w->mapTo(nativeParentWidget, QPoint()); - XReparentWindow(X11->display, + XReparentWindow(qt_x11Data->display, w->internalWinId(), nativeParentWidget->internalWinId(), p.x(), p.y()); @@ -1167,7 +1167,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) QWidgetPrivate::show_sys() */ if (w->internalWinId()) - XUnmapWindow(X11->display, w->internalWinId()); + XUnmapWindow(qt_x11Data->display, w->internalWinId()); QApplication::postEvent(w, new QEvent(QEvent::ShowWindowRequest)); } } @@ -1178,7 +1178,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) if (old_winid) { Window *cmwret; int count; - if (XGetWMColormapWindows(X11->display, old_winid, &cmwret, &count)) { + if (XGetWMColormapWindows(qt_x11Data->display, old_winid, &cmwret, &count)) { Window *cmw; int cmw_size = sizeof(Window)*count; cmw = new Window[count]; @@ -1192,7 +1192,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) } } int top_count; - if (XGetWMColormapWindows(X11->display, q->window()->internalWinId(), + if (XGetWMColormapWindows(qt_x11Data->display, q->window()->internalWinId(), &cmwret, &top_count)) { Window *merged_cmw = new Window[count + top_count]; @@ -1204,11 +1204,11 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) count += top_count; } - XSetWMColormapWindows(X11->display, q->window()->internalWinId(), cmw, count); + XSetWMColormapWindows(qt_x11Data->display, q->window()->internalWinId(), cmw, count); delete [] cmw; } - qt_XDestroyWindow(q, X11->display, old_winid); + qt_XDestroyWindow(q, qt_x11Data->display, old_winid); } } @@ -1234,7 +1234,7 @@ QPoint QWidgetPrivate::mapToGlobal(const QPoint &pos) const int x, y; Window child; QPoint p = mapToWS(pos); - XTranslateCoordinates(X11->display, q->internalWinId(), + XTranslateCoordinates(qt_x11Data->display, q->internalWinId(), QApplication::desktop()->screen(xinfo.screen())->internalWinId(), p.x(), p.y(), &x, &y, &child); return QPoint(x, y); @@ -1250,7 +1250,7 @@ QPoint QWidgetPrivate::mapFromGlobal(const QPoint &pos) const } int x, y; Window child; - XTranslateCoordinates(X11->display, + XTranslateCoordinates(qt_x11Data->display, QApplication::desktop()->screen(xinfo.screen())->internalWinId(), q->internalWinId(), pos.x(), pos.y(), &x, &y, &child); return mapFromWS(QPoint(x, y)); @@ -1282,22 +1282,22 @@ void QWidgetPrivate::updateSystemBackground() if (QX11Info::isCompositingManagerRunning() && q->testAttribute(Qt::WA_TranslucentBackground) && !(q->parent())) - XSetWindowBackground(X11->display, q->internalWinId(), + XSetWindowBackground(qt_x11Data->display, q->internalWinId(), QColormap::instance(xinfo.screen()).pixel(Qt::transparent)); else - XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), XNone); + XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), XNone); } else if (brush.style() == Qt::SolidPattern && brush.isOpaque()) - XSetWindowBackground(X11->display, q->internalWinId(), + XSetWindowBackground(qt_x11Data->display, q->internalWinId(), QColormap::instance(xinfo.screen()).pixel(brush.color())); else if (isBackgroundInherited()) - XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), ParentRelative); + XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), ParentRelative); else if (brush.style() == Qt::TexturePattern) { extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp - XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), + XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), static_cast(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth()); } else - XSetWindowBackground(X11->display, q->internalWinId(), + XSetWindowBackground(qt_x11Data->display, q->internalWinId(), QColormap::instance(xinfo.screen()).pixel(brush.color())); } @@ -1306,14 +1306,14 @@ void QWidgetPrivate::setCursor_sys(const QCursor &) { Q_Q(QWidget); qt_x11_enforce_cursor(q, false); - XFlush(X11->display); + XFlush(qt_x11Data->display); } void QWidgetPrivate::unsetCursor_sys() { Q_Q(QWidget); qt_x11_enforce_cursor(q, false); - XFlush(X11->display); + XFlush(qt_x11Data->display); } #endif @@ -1337,7 +1337,7 @@ qstring_to_xtp(const QString& s) char* tl[2]; tl[0] = mapped.data(); tl[1] = 0; - errCode = XmbTextListToTextProperty(X11->display, tl, 1, XStdICCTextStyle, &tp); + errCode = XmbTextListToTextProperty(qt_x11Data->display, tl, 1, XStdICCTextStyle, &tp); #if defined(QT_DEBUG) if (errCode < 0) qDebug("qstring_to_xtp result code %d", errCode); @@ -1371,10 +1371,10 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); if (!q->internalWinId()) return; - XSetWMName(X11->display, q->internalWinId(), qstring_to_xtp(caption)); + XSetWMName(qt_x11Data->display, q->internalWinId(), qstring_to_xtp(caption)); QByteArray net_wm_name = caption.toUtf8(); - XChangeProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_NAME), ATOM(UTF8_STRING), 8, + XChangeProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_NAME), ATOM(UTF8_STRING), 8, PropModeReplace, (unsigned char *)net_wm_name.data(), net_wm_name.size()); } @@ -1429,7 +1429,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) in the ICCCM section 4.1.2.4; otherwise, create the icon pixmap in the default depth (even though this violates the ICCCM) */ - if (X11->desktopEnvironment == DE_UNKNOWN + if (qt_x11Data->desktopEnvironment == DE_UNKNOWN || !QX11Info::appDefaultVisual(xinfo.screen()) || !QX11Info::appDefaultColormap(xinfo.screen())) { // unknown DE or non-default visual/colormap, use 1bpp bitmap @@ -1450,14 +1450,14 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) return; if (!icon_data.isEmpty()) { - XChangeProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_ICON), XA_CARDINAL, 32, + XChangeProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_ICON), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) icon_data.data(), icon_data.size()); } else { - XDeleteProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_ICON)); + XDeleteProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_ICON)); } - XWMHints *h = XGetWMHints(X11->display, q->internalWinId()); + XWMHints *h = XGetWMHints(qt_x11Data->display, q->internalWinId()); XWMHints wm_hints; if (!h) { memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy @@ -1472,7 +1472,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) h->flags &= ~(IconPixmapHint | IconMaskHint); } - XSetWMHints(X11->display, q->internalWinId(), h); + XSetWMHints(qt_x11Data->display, q->internalWinId(), h); if (h != &wm_hints) XFree((char *)h); } @@ -1483,10 +1483,10 @@ void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) if (!q->internalWinId()) return; Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - XSetWMIconName(X11->display, q->internalWinId(), qstring_to_xtp(iconText)); + XSetWMIconName(qt_x11Data->display, q->internalWinId(), qstring_to_xtp(iconText)); QByteArray icon_name = iconText.toUtf8(); - XChangeProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_ICON_NAME), ATOM(UTF8_STRING), 8, + XChangeProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_ICON_NAME), ATOM(UTF8_STRING), 8, PropModeReplace, (unsigned char *) icon_name.constData(), icon_name.size()); } @@ -1500,12 +1500,12 @@ void QWidget::grabMouse() #ifndef QT_NO_DEBUG int status = #endif - XGrabPointer(X11->display, effectiveWinId(), False, + XGrabPointer(qt_x11Data->display, effectiveWinId(), False, (uint)(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask), GrabModeAsync, GrabModeAsync, - XNone, XNone, X11->time); + XNone, XNone, qt_x11Data->time); #ifndef QT_NO_DEBUG if (status) { const char *s = @@ -1532,11 +1532,11 @@ void QWidget::grabMouse(const QCursor &cursor) #ifndef QT_NO_DEBUG int status = #endif - XGrabPointer(X11->display, effectiveWinId(), False, + XGrabPointer(qt_x11Data->display, effectiveWinId(), False, (uint)(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask), GrabModeAsync, GrabModeAsync, - XNone, cursor.handle(), X11->time); + XNone, cursor.handle(), qt_x11Data->time); #ifndef QT_NO_DEBUG if (status) { const char *s = @@ -1557,8 +1557,8 @@ void QWidget::grabMouse(const QCursor &cursor) void QWidget::releaseMouse() { if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) { - XUngrabPointer(X11->display, X11->time); - XFlush(X11->display); + XUngrabPointer(qt_x11Data->display, qt_x11Data->time); + XFlush(qt_x11Data->display); QWidgetPrivate::mouseGrabber = 0; } } @@ -1569,8 +1569,8 @@ void QWidget::grabKeyboard() if (!qt_nograb()) { if (QWidgetPrivate::keyboardGrabber && QWidgetPrivate::keyboardGrabber != this) QWidgetPrivate::keyboardGrabber->releaseKeyboard(); - XGrabKeyboard(X11->display, effectiveWinId(), False, GrabModeAsync, GrabModeAsync, - X11->time); + XGrabKeyboard(qt_x11Data->display, effectiveWinId(), False, GrabModeAsync, GrabModeAsync, + qt_x11Data->time); QWidgetPrivate::keyboardGrabber = this; } } @@ -1579,7 +1579,7 @@ void QWidget::grabKeyboard() void QWidget::releaseKeyboard() { if (!qt_nograb() && QWidgetPrivate::keyboardGrabber == this) { - XUngrabKeyboard(X11->display, X11->time); + XUngrabKeyboard(qt_x11Data->display, qt_x11Data->time); QWidgetPrivate::keyboardGrabber = 0; } } @@ -1599,32 +1599,32 @@ QWidget *QWidget::keyboardGrabber() void QWidget::activateWindow() { QWidget *tlw = window(); - if (tlw->isVisible() && !tlw->d_func()->topData()->embedded && !X11->deferred_map.contains(tlw)) { - if (X11->userTime == 0) - X11->userTime = X11->time; - qt_net_update_user_time(tlw, X11->userTime); + if (tlw->isVisible() && !tlw->d_func()->topData()->embedded && !qt_x11Data->deferred_map.contains(tlw)) { + if (qt_x11Data->userTime == 0) + qt_x11Data->userTime = qt_x11Data->time; + qt_net_update_user_time(tlw, qt_x11Data->userTime); - if (X11->isSupportedByWM(ATOM(_NET_ACTIVE_WINDOW)) + if (qt_x11Data->isSupportedByWM(ATOM(_NET_ACTIVE_WINDOW)) && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint)) { XEvent e; e.xclient.type = ClientMessage; e.xclient.message_type = ATOM(_NET_ACTIVE_WINDOW); - e.xclient.display = X11->display; + e.xclient.display = qt_x11Data->display; e.xclient.window = tlw->internalWinId(); e.xclient.format = 32; e.xclient.data.l[0] = 1; // 1 == application - e.xclient.data.l[1] = X11->userTime; + e.xclient.data.l[1] = qt_x11Data->userTime; if (QWidget *aw = QApplication::activeWindow()) e.xclient.data.l[2] = aw->internalWinId(); else e.xclient.data.l[2] = XNone; e.xclient.data.l[3] = 0; e.xclient.data.l[4] = 0; - XSendEvent(X11->display, RootWindow(X11->display, tlw->x11Info().screen()), + XSendEvent(qt_x11Data->display, RootWindow(qt_x11Data->display, tlw->x11Info().screen()), false, SubstructureNotifyMask | SubstructureRedirectMask, &e); } else { if (!qt_widget_private(tlw)->topData()->waitingForMapNotify) - XSetInputFocus(X11->display, tlw->internalWinId(), RevertToParent, X11->time); + XSetInputFocus(qt_x11Data->display, tlw->internalWinId(), RevertToParent, qt_x11Data->time); } } } @@ -1644,8 +1644,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate) QTLWExtra *top = d->topData(); if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) { - if (X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)) - && X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))) { + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)) + && qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))) { if ((newstate & Qt::WindowMaximized) && !(oldstate & Qt::WindowFullScreen)) top->normalGeometry = geometry(); qt_change_net_wm_state(this, (newstate & Qt::WindowMaximized), @@ -1678,7 +1678,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) } if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen)) { - if (X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) { + if (qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) { if (newstate & Qt::WindowFullScreen) { top->normalGeometry = geometry(); top->fullScreenOffset = d->frameStrut().topLeft(); @@ -1736,7 +1736,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) XEvent e; e.xclient.type = ClientMessage; e.xclient.message_type = ATOM(WM_CHANGE_STATE); - e.xclient.display = X11->display; + e.xclient.display = qt_x11Data->display; e.xclient.window = data->winid; e.xclient.format = 32; e.xclient.data.l[0] = IconicState; @@ -1744,12 +1744,12 @@ void QWidget::setWindowState(Qt::WindowStates newstate) e.xclient.data.l[2] = 0; e.xclient.data.l[3] = 0; e.xclient.data.l[4] = 0; - XSendEvent(X11->display, - RootWindow(X11->display,d->xinfo.screen()), + XSendEvent(qt_x11Data->display, + RootWindow(qt_x11Data->display,d->xinfo.screen()), False, (SubstructureNotifyMask|SubstructureRedirectMask), &e); } else { setAttribute(Qt::WA_Mapped); - XMapWindow(X11->display, effectiveWinId()); + XMapWindow(qt_x11Data->display, effectiveWinId()); } } @@ -1788,7 +1788,7 @@ void QWidgetPrivate::show_sys() } if (q->isWindow()) { - XWMHints *h = XGetWMHints(X11->display, q->internalWinId()); + XWMHints *h = XGetWMHints(qt_x11Data->display, q->internalWinId()); XWMHints wm_hints; bool got_hints = h != 0; if (!got_hints) { @@ -1797,7 +1797,7 @@ void QWidgetPrivate::show_sys() } h->initial_state = q->isMinimized() ? IconicState : NormalState; h->flags |= StateHint; - XSetWMHints(X11->display, q->internalWinId(), h); + XSetWMHints(qt_x11Data->display, q->internalWinId(), h); if (got_hints) XFree((char *)h); @@ -1824,15 +1824,15 @@ void QWidgetPrivate::show_sys() p = p->window(); if (p) { // transient for window - XSetTransientForHint(X11->display, q->internalWinId(), p->internalWinId()); + XSetTransientForHint(qt_x11Data->display, q->internalWinId(), p->internalWinId()); } else { // transient for group - XSetTransientForHint(X11->display, q->internalWinId(), X11->wm_client_leader); + XSetTransientForHint(qt_x11Data->display, q->internalWinId(), qt_x11Data->wm_client_leader); } } // update _MOTIF_WM_HINTS - QtMWMHints mwmhints = GetMWMHints(X11->display, q->internalWinId()); + QtMWMHints mwmhints = GetMWMHints(qt_x11Data->display, q->internalWinId()); if (data.window_modality != Qt::NonModal) { switch (data.window_modality) { @@ -1883,7 +1883,7 @@ void QWidgetPrivate::show_sys() mwmhints.functions |= MWM_FUNC_CLOSE; } - SetMWMHints(X11->display, q->internalWinId(), mwmhints); + SetMWMHints(qt_x11Data->display, q->internalWinId(), mwmhints); // update _NET_WM_STATE QVector netWmState = getNetWmState(q); @@ -1916,15 +1916,15 @@ void QWidgetPrivate::show_sys() } if (!netWmState.isEmpty()) { - XChangeProperty(X11->display, q->internalWinId(), + XChangeProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, (unsigned char *) netWmState.data(), netWmState.size()); } else { - XDeleteProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_STATE)); + XDeleteProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_STATE)); } // set _NET_WM_USER_TIME - Time userTime = X11->userTime; + Time userTime = qt_x11Data->userTime; bool setUserTime = false; if (q->testAttribute(Qt::WA_ShowWithoutActivating)) { userTime = 0; @@ -1939,9 +1939,9 @@ void QWidgetPrivate::show_sys() if (!topData()->syncUpdateCounter) { XSyncValue value; XSyncIntToValue(&value, 0); - topData()->syncUpdateCounter = XSyncCreateCounter(X11->display, value); + topData()->syncUpdateCounter = XSyncCreateCounter(qt_x11Data->display, value); - XChangeProperty(X11->display, q->internalWinId(), + XChangeProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_SYNC_REQUEST_COUNTER), XA_CARDINAL, 32, PropModeReplace, @@ -1955,14 +1955,14 @@ void QWidgetPrivate::show_sys() if (!topData()->embedded && (topData()->validWMState || topData()->waitingForMapNotify) && !q->isMinimized()) { - X11->deferred_map.append(q); + qt_x11Data->deferred_map.append(q); return; } if (q->isMaximized() && !q->isFullScreen() - && !(X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)) - && X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)))) { - XMapWindow(X11->display, q->internalWinId()); + && !(qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)) + && qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)))) { + XMapWindow(qt_x11Data->display, q->internalWinId()); data.fstrut_dirty = true; qt_x11_wait_for_window_manager(q); @@ -1986,8 +1986,8 @@ void QWidgetPrivate::show_sys() return; } - if (q->isFullScreen() && !X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) { - XMapWindow(X11->display, q->internalWinId()); + if (q->isFullScreen() && !qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) { + XMapWindow(qt_x11Data->display, q->internalWinId()); qt_x11_wait_for_window_manager(q); q->setAttribute(Qt::WA_Mapped); return; @@ -2006,22 +2006,22 @@ void QWidgetPrivate::show_sys() && (!q->autoFillBackground() || q->palette().brush(q->backgroundRole()).style() == Qt::LinearGradientPattern)) { if (q->internalWinId()) { - XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), XNone); - XMapWindow(X11->display, q->internalWinId()); + XSetWindowBackgroundPixmap(qt_x11Data->display, q->internalWinId(), XNone); + XMapWindow(qt_x11Data->display, q->internalWinId()); updateSystemBackground(); } return; } if (q->internalWinId()) - XMapWindow(X11->display, q->internalWinId()); + XMapWindow(qt_x11Data->display, q->internalWinId()); // Freedesktop.org Startup Notification - if (X11->startupId && q->isWindow()) { + if (qt_x11Data->startupId && q->isWindow()) { QByteArray message("remove: ID="); - message.append(X11->startupId); + message.append(qt_x11Data->startupId); sendStartupMessage(message.constData()); - X11->startupId = 0; + qt_x11Data->startupId = 0; } } @@ -2040,11 +2040,11 @@ void QWidgetPrivate::sendStartupMessage(const char *message) const XEvent xevent; xevent.xclient.type = ClientMessage; xevent.xclient.message_type = ATOM(_NET_STARTUP_INFO_BEGIN); - xevent.xclient.display = X11->display; + xevent.xclient.display = qt_x11Data->display; xevent.xclient.window = q->internalWinId(); xevent.xclient.format = 8; - Window rootWindow = RootWindow(X11->display, DefaultScreen(X11->display)); + Window rootWindow = RootWindow(qt_x11Data->display, DefaultScreen(qt_x11Data->display)); uint sent = 0; uint length = strlen(message) + 1; do { @@ -2054,7 +2054,7 @@ void QWidgetPrivate::sendStartupMessage(const char *message) const for (uint i = 0; i < 20 && i + sent <= length; i++) xevent.xclient.data.b[i] = message[i + sent++]; - XSendEvent(X11->display, rootWindow, false, PropertyChangeMask, &xevent); + XSendEvent(qt_x11Data->display, rootWindow, false, PropertyChangeMask, &xevent); } while (sent <= length); } @@ -2065,7 +2065,7 @@ void QWidgetPrivate::setNetWmWindowTypes() if (!q->isWindow()) { if (q->internalWinId()) - XDeleteProperty(X11->display, q->internalWinId(), ATOM(_NET_WM_WINDOW_TYPE)); + XDeleteProperty(qt_x11Data->display, q->internalWinId(), ATOM(_NET_WM_WINDOW_TYPE)); return; } @@ -2142,11 +2142,11 @@ void QWidgetPrivate::setNetWmWindowTypes() windowTypes.append(ATOM(_NET_WM_WINDOW_TYPE_NORMAL)); if (!windowTypes.isEmpty()) { - XChangeProperty(X11->display, q->winId(), ATOM(_NET_WM_WINDOW_TYPE), XA_ATOM, 32, + XChangeProperty(qt_x11Data->display, q->winId(), ATOM(_NET_WM_WINDOW_TYPE), XA_ATOM, 32, PropModeReplace, (unsigned char *) windowTypes.constData(), windowTypes.count()); } else { - XDeleteProperty(X11->display, q->winId(), ATOM(_NET_WM_WINDOW_TYPE)); + XDeleteProperty(qt_x11Data->display, q->winId(), ATOM(_NET_WM_WINDOW_TYPE)); } } @@ -2161,14 +2161,14 @@ void QWidgetPrivate::hide_sys() Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); deactivateWidgetCleanup(); if (q->isWindow()) { - X11->deferred_map.removeAll(q); + qt_x11Data->deferred_map.removeAll(q); if (q->internalWinId()) // in nsplugin, may be 0 - XWithdrawWindow(X11->display, q->internalWinId(), xinfo.screen()); - XFlush(X11->display); + XWithdrawWindow(qt_x11Data->display, q->internalWinId(), xinfo.screen()); + XFlush(qt_x11Data->display); } else { invalidateBuffer(q->rect()); if (q->internalWinId()) // in nsplugin, may be 0 - XUnmapWindow(X11->display, q->internalWinId()); + XUnmapWindow(qt_x11Data->display, q->internalWinId()); } q->setAttribute(Qt::WA_Mapped, false); } @@ -2184,7 +2184,7 @@ void QWidgetPrivate::raise_sys() Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); if (q->internalWinId()) - XRaiseWindow(X11->display, q->internalWinId()); + XRaiseWindow(qt_x11Data->display, q->internalWinId()); } void QWidgetPrivate::lower_sys() @@ -2192,7 +2192,7 @@ void QWidgetPrivate::lower_sys() Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); if (q->internalWinId()) - XLowerWindow(X11->display, q->internalWinId()); + XLowerWindow(qt_x11Data->display, q->internalWinId()); if(!q->isWindow()) invalidateBuffer(q->rect()); } @@ -2205,7 +2205,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w) Window stack[2]; stack[0] = w->internalWinId();; stack[1] = q->internalWinId(); - XRestackWindows(X11->display, stack, 2); + XRestackWindows(qt_x11Data->display, stack, 2); } if(!q->isWindow() || !w->internalWinId()) invalidateBuffer(q->rect()); @@ -2267,7 +2267,7 @@ static void do_size_hints(QWidget* widget, QWExtra *x) s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; } if (widget->internalWinId()) - XSetWMNormalHints(X11->display, widget->internalWinId(), &s); + XSetWMNormalHints(qt_x11Data->display, widget->internalWinId(), &s); } @@ -2423,15 +2423,15 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) { Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; if ((q->windowType() == Qt::Desktop)) return; if (q->isWindow()) { - if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) - && !X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) + if (!qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) + && !qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ))) data.window_state &= ~Qt::WindowMaximized; - if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) + if (!qt_x11Data->isSupportedByWM(ATOM(_NET_WM_STATE_FULLSCREEN))) data.window_state &= ~Qt::WindowFullScreen; if (QTLWExtra *topData = maybeTopData()) topData->normalGeometry = QRect(0,0,-1,-1); @@ -2480,16 +2480,16 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (isMove) { if ((data.window_flags & Qt::X11BypassWindowManagerHint) == Qt::X11BypassWindowManagerHint // work around 4Dwm's incompliance with ICCCM 4.1.5 - || X11->desktopEnvironment == DE_4DWM) { + || qt_x11Data->desktopEnvironment == DE_4DWM) { if (data.winid) XMoveResizeWindow(dpy, data.winid, x, y, w, h); } else if (q->isVisible() && topData()->validWMState - && X11->isSupportedByWM(ATOM(_NET_MOVERESIZE_WINDOW))) { + && qt_x11Data->isSupportedByWM(ATOM(_NET_MOVERESIZE_WINDOW))) { XEvent e; e.xclient.type = ClientMessage; e.xclient.message_type = ATOM(_NET_MOVERESIZE_WINDOW); - e.xclient.display = X11->display; + e.xclient.display = qt_x11Data->display; e.xclient.window = q->internalWinId(); e.xclient.format = 32; e.xclient.data.l[0] = StaticGravity | 1<<8 | 1<<9 | 1<<10 | 1<<11 | 1<<12; @@ -2497,7 +2497,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) e.xclient.data.l[2] = y; e.xclient.data.l[3] = w; e.xclient.data.l[4] = h; - XSendEvent(X11->display, RootWindow(X11->display, q->x11Info().screen()), + XSendEvent(qt_x11Data->display, RootWindow(qt_x11Data->display, q->x11Info().screen()), false, (SubstructureNotifyMask | SubstructureRedirectMask), &e); } else if (data.winid) { // pos() is right according to ICCCM 4.1.5 @@ -2548,7 +2548,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isVisible()) { if (isMove && q->pos() != oldPos) { - if (X11->desktopEnvironment != DE_4DWM) { + if (qt_x11Data->desktopEnvironment != DE_4DWM) { // pos() is right according to ICCCM 4.1.5 QMoveEvent e(q->pos(), oldPos); QApplication::sendEvent(q, &e); @@ -2591,14 +2591,14 @@ void QWidgetPrivate::setConstraints_sys() #endif if (q->testAttribute(Qt::WA_WState_Created)) { do_size_hints(q, extra); - QtMWMHints mwmHints = GetMWMHints(X11->display, q->internalWinId()); + QtMWMHints mwmHints = GetMWMHints(qt_x11Data->display, q->internalWinId()); const bool wasFuncResize = mwmHints.functions & MWM_FUNC_RESIZE; if (q->minimumSize() == q->maximumSize()) mwmHints.functions &= ~MWM_FUNC_RESIZE; else mwmHints.functions |= MWM_FUNC_RESIZE; if (wasFuncResize != (mwmHints.functions & MWM_FUNC_RESIZE)) - SetMWMHints(X11->display, q->internalWinId(), mwmHints); + SetMWMHints(qt_x11Data->display, q->internalWinId(), mwmHints); } #ifdef ALIEN_DEBUG qDebug() << "QWidgetPrivate::setConstraints_sys END" << q; @@ -2656,7 +2656,7 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) if (dx == 0 && dy == 0) return; - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; // Want expose events if (w > 0 && h > 0 && !just_update && q->internalWinId()) { GC gc = XCreateGC(dpy, q->internalWinId(), 0, 0); @@ -2710,7 +2710,7 @@ int QWidget::metric(PaintDeviceMetric m) const } else if (m == PdmHeight) { val = data->crect.height(); } else { - Display *dpy = X11->display; + Display *dpy = qt_x11Data->display; int scr = d->xinfo.screen(); switch (m) { case PdmDpiX: @@ -2780,7 +2780,7 @@ void QWidgetPrivate::deleteTLSysExtra() // QWidget::destroy() destroyInputContext(); #ifndef QT_NO_XSYNC if (extra && extra->topextra && extra->topextra->syncUpdateCounter) { - XSyncDestroyCounter(X11->display, extra->topextra->syncUpdateCounter); + XSyncDestroyCounter(qt_x11Data->display, extra->topextra->syncUpdateCounter); extra->topextra->syncUpdateCounter = 0; } #endif @@ -2793,10 +2793,10 @@ void QWidgetPrivate::setMask_sys(const QRegion ®ion) return; if (region.isEmpty()) { - XShapeCombineMask(X11->display, q->internalWinId(), ShapeBounding, 0, 0, + XShapeCombineMask(qt_x11Data->display, q->internalWinId(), ShapeBounding, 0, 0, XNone, ShapeSet); } else { - XShapeCombineRegion(X11->display, q->internalWinId(), ShapeBounding, 0, 0, + XShapeCombineRegion(qt_x11Data->display, q->internalWinId(), ShapeBounding, 0, 0, region.handle(), ShapeSet); } } @@ -2829,7 +2829,7 @@ void QWidgetPrivate::updateFrameStrut() unsigned char *data_ret; unsigned long l_unused; - while (XQueryTree(X11->display, w, &r, &p, &c, &nc)) { + while (XQueryTree(qt_x11Data->display, w, &r, &p, &c, &nc)) { if (c && nc > 0) XFree(c); @@ -2842,7 +2842,7 @@ void QWidgetPrivate::updateFrameStrut() // a NET WM virtual root window, stop here data_ret = 0; if (p == r || - (XGetWindowProperty(X11->display, p, + (XGetWindowProperty(qt_x11Data->display, p, ATOM(ENLIGHTENMENT_DESKTOP), 0, 1, False, XA_CARDINAL, &type_ret, &i_unused, &l_unused, &l_unused, &data_ret) == Success && @@ -2851,10 +2851,10 @@ void QWidgetPrivate::updateFrameStrut() XFree(data_ret); break; - } else if (X11->isSupportedByWM(ATOM(_NET_VIRTUAL_ROOTS)) && X11->net_virtual_root_list) { + } else if (qt_x11Data->isSupportedByWM(ATOM(_NET_VIRTUAL_ROOTS)) && qt_x11Data->net_virtual_root_list) { int i = 0; - while (X11->net_virtual_root_list[i] != 0) { - if (X11->net_virtual_root_list[i++] == p) + while (qt_x11Data->net_virtual_root_list[i] != 0) { + if (qt_x11Data->net_virtual_root_list[i++] == p) break; } } @@ -2866,9 +2866,9 @@ void QWidgetPrivate::updateFrameStrut() // we have our window int transx, transy; XWindowAttributes wattr; - if (XTranslateCoordinates(X11->display, l, w, + if (XTranslateCoordinates(qt_x11Data->display, l, w, 0, 0, &transx, &transy, &p) && - XGetWindowAttributes(X11->display, w, &wattr)) { + XGetWindowAttributes(qt_x11Data->display, w, &wattr)) { top->frameStrut.setCoords(transx, transy, wattr.width - data.crect.width() - transx, @@ -2909,7 +2909,7 @@ void QWidgetPrivate::setWindowRole() if (!q->internalWinId()) return; QByteArray windowRole = topData()->role.toUtf8(); - XChangeProperty(X11->display, q->internalWinId(), + XChangeProperty(qt_x11Data->display, q->internalWinId(), ATOM(WM_WINDOW_ROLE), XA_STRING, 8, PropModeReplace, (unsigned char *)windowRole.constData(), windowRole.length()); } @@ -2962,40 +2962,40 @@ XRenderColor QX11Data::preMultiply(const QColor &c) Picture QX11Data::getSolidFill(int screen, const QColor &c) { - if (!X11->use_xrender) + if (!qt_x11Data->use_xrender) return XNone; XRenderColor color = preMultiply(c); - for (int i = 0; i < X11->solid_fill_count; ++i) { - if (X11->solid_fills[i].screen == screen - && X11->solid_fills[i].color.alpha == color.alpha - && X11->solid_fills[i].color.red == color.red - && X11->solid_fills[i].color.green == color.green - && X11->solid_fills[i].color.blue == color.blue) - return X11->solid_fills[i].picture; + for (int i = 0; i < qt_x11Data->solid_fill_count; ++i) { + if (qt_x11Data->solid_fills[i].screen == screen + && qt_x11Data->solid_fills[i].color.alpha == color.alpha + && qt_x11Data->solid_fills[i].color.red == color.red + && qt_x11Data->solid_fills[i].color.green == color.green + && qt_x11Data->solid_fills[i].color.blue == color.blue) + return qt_x11Data->solid_fills[i].picture; } // none found, replace one int i = qrand() % 16; - if (X11->solid_fills[i].screen != screen && X11->solid_fills[i].picture) { - XRenderFreePicture (X11->display, X11->solid_fills[i].picture); - X11->solid_fills[i].picture = 0; + if (qt_x11Data->solid_fills[i].screen != screen && qt_x11Data->solid_fills[i].picture) { + XRenderFreePicture (qt_x11Data->display, qt_x11Data->solid_fills[i].picture); + qt_x11Data->solid_fills[i].picture = 0; } - if (!X11->solid_fills[i].picture) { - Pixmap pixmap = XCreatePixmap (X11->display, RootWindow (X11->display, screen), 1, 1, 32); + if (!qt_x11Data->solid_fills[i].picture) { + Pixmap pixmap = XCreatePixmap (qt_x11Data->display, RootWindow (qt_x11Data->display, screen), 1, 1, 32); XRenderPictureAttributes attrs; attrs.repeat = True; - X11->solid_fills[i].picture = XRenderCreatePicture (X11->display, pixmap, - XRenderFindStandardFormat(X11->display, PictStandardARGB32), + qt_x11Data->solid_fills[i].picture = XRenderCreatePicture (qt_x11Data->display, pixmap, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32), CPRepeat, &attrs); - XFreePixmap (X11->display, pixmap); + XFreePixmap (qt_x11Data->display, pixmap); } - X11->solid_fills[i].color = color; - X11->solid_fills[i].screen = screen; - XRenderFillRectangle (X11->display, PictOpSrc, X11->solid_fills[i].picture, &color, 0, 0, 1, 1); - return X11->solid_fills[i].picture; + qt_x11Data->solid_fills[i].color = color; + qt_x11Data->solid_fills[i].screen = screen; + XRenderFillRectangle (qt_x11Data->display, PictOpSrc, qt_x11Data->solid_fills[i].picture, &color, 0, 0, 1, 1); + return qt_x11Data->solid_fills[i].picture; } #endif @@ -3006,15 +3006,15 @@ void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *att) // find which screen the window is on... xd->screen = QX11Info::appScreen(); // by default, use the default :) int i; - for (i = 0; i < ScreenCount(X11->display); i++) { - if (RootWindow(X11->display, i) == a->root) { + for (i = 0; i < ScreenCount(qt_x11Data->display); i++) { + if (RootWindow(qt_x11Data->display, i) == a->root) { xd->screen = i; break; } } xd->depth = a->depth; - xd->cells = DisplayCells(X11->display, xd->screen); + xd->cells = DisplayCells(qt_x11Data->display, xd->screen); xd->visual = a->visual; xd->defaultVisual = (XVisualIDFromVisual((Visual *) a->visual) == XVisualIDFromVisual((Visual *) QX11Info::appVisual(xinfo->screen()))); @@ -3029,7 +3029,7 @@ void QWidgetPrivate::updateX11AcceptFocus() if (!q->isWindow() || !q->internalWinId()) return; - XWMHints *h = XGetWMHints(X11->display, q->internalWinId()); + XWMHints *h = XGetWMHints(qt_x11Data->display, q->internalWinId()); XWMHints wm_hints; if (!h) { memset(&wm_hints, 0, sizeof(wm_hints)); // make valgrind happy @@ -3038,7 +3038,7 @@ void QWidgetPrivate::updateX11AcceptFocus() h->flags |= InputHint; h->input = q->testAttribute(Qt::WA_X11DoNotAcceptFocus) ? False : True; - XSetWMHints(X11->display, q->internalWinId(), h); + XSetWMHints(qt_x11Data->display, q->internalWinId(), h); if (h != &wm_hints) XFree((char *)h); } diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 12df69794..6c807e650 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -851,8 +851,8 @@ bool QX11EmbedWidget::x11Event(XEvent *event) // Update qt_x_time if necessary Time msgtime = (Time) event->xclient.data.l[0]; - if (msgtime > X11->time) - X11->time = msgtime; + if (msgtime > qt_x11Data->time) + qt_x11Data->time = msgtime; switch (event->xclient.data.l[1]) { case XEMBED_WINDOW_ACTIVATE: { @@ -1471,8 +1471,8 @@ bool QX11EmbedContainer::x11Event(XEvent *event) d->clientIsXEmbed = true; Time msgtime = (Time) event->xclient.data.l[0]; - if (msgtime > X11->time) - X11->time = msgtime; + if (msgtime > qt_x11Data->time) + qt_x11Data->time = msgtime; switch (event->xclient.data.l[1]) { case XEMBED_REQUEST_FOCUS: { diff --git a/src/gui/kernel/qx11info_x11.cpp b/src/gui/kernel/qx11info_x11.cpp index 5393b5558..e401e1c12 100644 --- a/src/gui/kernel/qx11info_x11.cpp +++ b/src/gui/kernel/qx11info_x11.cpp @@ -208,13 +208,13 @@ QX11InfoData* QX11Info::getX11Data(bool def) const */ int QX11Info::appDpiX(int screen) { - if (!X11) + if (!qt_x11Data) return 75; if (screen < 0) - screen = X11->defaultScreen; - if (screen > X11->screenCount) + screen = qt_x11Data->defaultScreen; + if (screen > qt_x11Data->screenCount) return 0; - return X11->screens[screen].dpiX; + return qt_x11Data->screens[screen].dpiX; } /*! @@ -231,13 +231,13 @@ int QX11Info::appDpiX(int screen) void QX11Info::setAppDpiX(int screen, int xdpi) { - if (!X11) + if (!qt_x11Data) return; if (screen < 0) - screen = X11->defaultScreen; - if (screen > X11->screenCount) + screen = qt_x11Data->defaultScreen; + if (screen > qt_x11Data->screenCount) return; - X11->screens[screen].dpiX = xdpi; + qt_x11Data->screens[screen].dpiX = xdpi; } /*! @@ -254,13 +254,13 @@ void QX11Info::setAppDpiX(int screen, int xdpi) int QX11Info::appDpiY(int screen) { - if (!X11) + if (!qt_x11Data) return 75; if (screen < 0) - screen = X11->defaultScreen; - if (screen > X11->screenCount) + screen = qt_x11Data->defaultScreen; + if (screen > qt_x11Data->screenCount) return 0; - return X11->screens[screen].dpiY; + return qt_x11Data->screens[screen].dpiY; } /*! @@ -276,13 +276,13 @@ int QX11Info::appDpiY(int screen) */ void QX11Info::setAppDpiY(int screen, int ydpi) { - if (!X11) + if (!qt_x11Data) return; if (screen < 0) - screen = X11->defaultScreen; - if (screen > X11->screenCount) + screen = qt_x11Data->defaultScreen; + if (screen > qt_x11Data->screenCount) return; - X11->screens[screen].dpiY = ydpi; + qt_x11Data->screens[screen].dpiY = ydpi; } /*! @@ -292,7 +292,7 @@ void QX11Info::setAppDpiY(int screen, int ydpi) */ unsigned long QX11Info::appTime() { - return X11 ? X11->time : 0; + return qt_x11Data ? qt_x11Data->time : 0; } /*! @@ -302,8 +302,8 @@ unsigned long QX11Info::appTime() */ void QX11Info::setAppTime(unsigned long time) { - if (X11) { - X11->time = time; + if (qt_x11Data) { + qt_x11Data->time = time; } } @@ -314,7 +314,7 @@ void QX11Info::setAppTime(unsigned long time) */ unsigned long QX11Info::appUserTime() { - return X11 ? X11->userTime : 0; + return qt_x11Data ? qt_x11Data->userTime : 0; } /*! @@ -324,8 +324,8 @@ unsigned long QX11Info::appUserTime() */ void QX11Info::setAppUserTime(unsigned long time) { - if (X11) { - X11->userTime = time; + if (qt_x11Data) { + qt_x11Data->userTime = time; } } @@ -346,7 +346,7 @@ void QX11Info::setAppUserTime(unsigned long time) Display *QX11Info::display() { - return X11 ? X11->display : 0; + return qt_x11Data ? qt_x11Data->display : 0; } /*! @@ -357,7 +357,7 @@ Display *QX11Info::display() */ int QX11Info::appScreen() { - return X11 ? X11->defaultScreen : 0; + return qt_x11Data ? qt_x11Data->defaultScreen : 0; } /*! @@ -372,7 +372,7 @@ int QX11Info::appScreen() */ Qt::HANDLE QX11Info::appColormap(int screen) { - return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].colormap : 0; + return qt_x11Data ? qt_x11Data->screens[screen == -1 ? qt_x11Data->defaultScreen : screen].colormap : 0; } /*! @@ -389,7 +389,7 @@ Qt::HANDLE QX11Info::appColormap(int screen) void *QX11Info::appVisual(int screen) { - return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].visual : 0; + return qt_x11Data ? qt_x11Data->screens[screen == -1 ? qt_x11Data->defaultScreen : screen].visual : 0; } /*! @@ -404,7 +404,7 @@ void *QX11Info::appVisual(int screen) */ Qt::HANDLE QX11Info::appRootWindow(int screen) { - return X11 ? RootWindow(X11->display, screen == -1 ? X11->defaultScreen : screen) : 0; + return qt_x11Data ? RootWindow(qt_x11Data->display, screen == -1 ? qt_x11Data->defaultScreen : screen) : 0; } /*! @@ -421,7 +421,7 @@ Qt::HANDLE QX11Info::appRootWindow(int screen) int QX11Info::appDepth(int screen) { - return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].depth : 32; + return qt_x11Data ? qt_x11Data->screens[screen == -1 ? qt_x11Data->defaultScreen : screen].depth : 32; } /*! @@ -436,7 +436,7 @@ int QX11Info::appDepth(int screen) */ int QX11Info::appCells(int screen) -{ return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].cells : 0; } +{ return qt_x11Data ? qt_x11Data->screens[screen == -1 ? qt_x11Data->defaultScreen : screen].cells : 0; } /*! Returns true if the application has a default color map on the given @@ -448,7 +448,7 @@ int QX11Info::appCells(int screen) query for information about Xinerama screens. */ bool QX11Info::appDefaultColormap(int screen) -{ return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].defaultColormap : true; } +{ return qt_x11Data ? qt_x11Data->screens[screen == -1 ? qt_x11Data->defaultScreen : screen].defaultColormap : true; } /*! Returns true if the application has a default visual on the given \a screen; @@ -460,7 +460,7 @@ bool QX11Info::appDefaultColormap(int screen) query for information about Xinerama screens. */ bool QX11Info::appDefaultVisual(int screen) -{ return X11 ? X11->screens[screen == -1 ? X11->defaultScreen : screen].defaultVisual : true; } +{ return qt_x11Data ? qt_x11Data->screens[screen == -1 ? qt_x11Data->defaultScreen : screen].defaultVisual : true; } /*! Returns the number of the screen currently in use. @@ -537,7 +537,7 @@ bool QX11Info::defaultVisual() const */ bool QX11Info::isCompositingManagerRunning() { - return X11 ? X11->compositingManagerRunning : false; + return qt_x11Data ? qt_x11Data->compositingManagerRunning : false; } QT_END_NAMESPACE diff --git a/src/gui/painting/qcolormap_x11.cpp b/src/gui/painting/qcolormap_x11.cpp index 4d32bba3c..057643b54 100644 --- a/src/gui/painting/qcolormap_x11.cpp +++ b/src/gui/painting/qcolormap_x11.cpp @@ -322,7 +322,7 @@ static void init_direct(QColormapPrivate *d) ++i; } - XStoreColors(X11->display, d->colormap, colorTable.data(), colorTable.count()); + XStoreColors(qt_x11Data->display, d->colormap, colorTable.data(), colorTable.count()); } static QColormap **cmaps = Q_NULLPTR; @@ -339,7 +339,7 @@ void QColormap::initialize() QColormapPrivate * const d = cmaps[i]->d; bool use_stdcmap = false; - int color_count = X11->color_count; + int color_count = qt_x11Data->color_count; // defaults d->depth = DefaultDepth(display, i); @@ -350,32 +350,32 @@ void QColormap::initialize() Visual *argbVisual = Q_NULLPTR; - if (X11->visual && i == DefaultScreen(display)) { + if (qt_x11Data->visual && i == DefaultScreen(display)) { // only use the outside colormap on the default screen - d->visual = find_visual(display, i, X11->visual->c_class, - XVisualIDFromVisual(X11->visual), + d->visual = find_visual(display, i, qt_x11Data->visual->c_class, + XVisualIDFromVisual(qt_x11Data->visual), &d->depth, &d->defaultVisual); - } else if ((X11->visual_class != -1 && X11->visual_class >= 0 && X11->visual_class < 6) - || (X11->visual_id != -1)) { + } else if ((qt_x11Data->visual_class != -1 && qt_x11Data->visual_class >= 0 && qt_x11Data->visual_class < 6) + || (qt_x11Data->visual_id != -1)) { // look for a specific visual or type of visual - d->visual = find_visual(display, i, X11->visual_class, X11->visual_id, + d->visual = find_visual(display, i, qt_x11Data->visual_class, qt_x11Data->visual_id, &d->depth, &d->defaultVisual); - } else if (!X11->custom_cmap) { + } else if (!qt_x11Data->custom_cmap) { XStandardColormap *stdcmap = Q_NULLPTR; int ncmaps = 0; #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { int nvi; XVisualInfo templ; templ.screen = i; templ.depth = 32; templ.c_class = TrueColor; - XVisualInfo *xvi = XGetVisualInfo(X11->display, VisualScreenMask | + XVisualInfo *xvi = XGetVisualInfo(qt_x11Data->display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi); for (int idx = 0; idx < nvi; ++idx) { - XRenderPictFormat *format = XRenderFindVisualFormat(X11->display, + XRenderPictFormat *format = XRenderFindVisualFormat(qt_x11Data->display, xvi[idx].visual); if (format->type == PictTypeDirect && format->direct.alphaMask) { argbVisual = xvi[idx].visual; @@ -507,12 +507,12 @@ void QColormap::initialize() } bool ownColormap = false; - if (X11->colormap && i == DefaultScreen(display)) { + if (qt_x11Data->colormap && i == DefaultScreen(display)) { // only use the outside colormap on the default screen - d->colormap = X11->colormap; + d->colormap = qt_x11Data->colormap; d->defaultColormap = (d->colormap == DefaultColormap(display, i)); } else if ((!use_stdcmap - && (((d->visual->c_class & 1) && X11->custom_cmap) + && (((d->visual->c_class & 1) && qt_x11Data->custom_cmap) || d->visual != DefaultVisual(display, i))) || d->visual->c_class == DirectColor) { // allocate custom colormap (we always do this when using DirectColor visuals) @@ -536,7 +536,7 @@ void QColormap::initialize() break; } - QX11InfoData *screen = X11->screens + i; + QX11InfoData *screen = qt_x11Data->screens + i; screen->depth = d->depth; screen->visual = d->visual; screen->defaultVisual = d->defaultVisual; @@ -545,8 +545,8 @@ void QColormap::initialize() screen->cells = screen->visual->map_entries; if (argbVisual) { - X11->argbVisuals[i] = argbVisual; - X11->argbColormaps[i] = XCreateColormap(display, RootWindow(display, i), argbVisual, AllocNone); + qt_x11Data->argbVisuals[i] = argbVisual; + qt_x11Data->argbColormaps[i] = XCreateColormap(display, RootWindow(display, i), argbVisual, AllocNone); } // ### diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 0af954ebb..bf0bec064 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -265,72 +265,72 @@ void QXRenderTessellator::addTrap(const Trapezoid &trap) #ifndef QT_NO_XRENDER static Picture getPatternFill(int screen, const QBrush &b) { - if (!X11->use_xrender) + if (!qt_x11Data->use_xrender) return XNone; - XRenderColor color = X11->preMultiply(b.color()); + XRenderColor color = qt_x11Data->preMultiply(b.color()); XRenderColor bg_color; - bg_color = X11->preMultiply(QColor(0, 0, 0, 0)); + bg_color = qt_x11Data->preMultiply(QColor(0, 0, 0, 0)); - for (int i = 0; i < X11->pattern_fill_count; ++i) { - if (X11->pattern_fills[i].screen == screen - && X11->pattern_fills[i].opaque == false - && X11->pattern_fills[i].style == b.style() - && X11->pattern_fills[i].color.alpha == color.alpha - && X11->pattern_fills[i].color.red == color.red - && X11->pattern_fills[i].color.green == color.green - && X11->pattern_fills[i].color.blue == color.blue - && X11->pattern_fills[i].bg_color.alpha == bg_color.alpha - && X11->pattern_fills[i].bg_color.red == bg_color.red - && X11->pattern_fills[i].bg_color.green == bg_color.green - && X11->pattern_fills[i].bg_color.blue == bg_color.blue) - return X11->pattern_fills[i].picture; + for (int i = 0; i < qt_x11Data->pattern_fill_count; ++i) { + if (qt_x11Data->pattern_fills[i].screen == screen + && qt_x11Data->pattern_fills[i].opaque == false + && qt_x11Data->pattern_fills[i].style == b.style() + && qt_x11Data->pattern_fills[i].color.alpha == color.alpha + && qt_x11Data->pattern_fills[i].color.red == color.red + && qt_x11Data->pattern_fills[i].color.green == color.green + && qt_x11Data->pattern_fills[i].color.blue == color.blue + && qt_x11Data->pattern_fills[i].bg_color.alpha == bg_color.alpha + && qt_x11Data->pattern_fills[i].bg_color.red == bg_color.red + && qt_x11Data->pattern_fills[i].bg_color.green == bg_color.green + && qt_x11Data->pattern_fills[i].bg_color.blue == bg_color.blue) + return qt_x11Data->pattern_fills[i].picture; } // none found, replace one int i = qrand() % 16; - if (X11->pattern_fills[i].screen != screen && X11->pattern_fills[i].picture) { - XRenderFreePicture (X11->display, X11->pattern_fills[i].picture); - X11->pattern_fills[i].picture = 0; + if (qt_x11Data->pattern_fills[i].screen != screen && qt_x11Data->pattern_fills[i].picture) { + XRenderFreePicture (qt_x11Data->display, qt_x11Data->pattern_fills[i].picture); + qt_x11Data->pattern_fills[i].picture = 0; } - if (!X11->pattern_fills[i].picture) { - Pixmap pixmap = XCreatePixmap (X11->display, RootWindow (X11->display, screen), 8, 8, 32); + if (!qt_x11Data->pattern_fills[i].picture) { + Pixmap pixmap = XCreatePixmap (qt_x11Data->display, RootWindow (qt_x11Data->display, screen), 8, 8, 32); XRenderPictureAttributes attrs; attrs.repeat = True; - X11->pattern_fills[i].picture = XRenderCreatePicture (X11->display, pixmap, - XRenderFindStandardFormat(X11->display, PictStandardARGB32), + qt_x11Data->pattern_fills[i].picture = XRenderCreatePicture (qt_x11Data->display, pixmap, + XRenderFindStandardFormat(qt_x11Data->display, PictStandardARGB32), CPRepeat, &attrs); - XFreePixmap (X11->display, pixmap); + XFreePixmap (qt_x11Data->display, pixmap); } - X11->pattern_fills[i].screen = screen; - X11->pattern_fills[i].color = color; - X11->pattern_fills[i].bg_color = bg_color; - X11->pattern_fills[i].opaque = false; - X11->pattern_fills[i].style = b.style(); + qt_x11Data->pattern_fills[i].screen = screen; + qt_x11Data->pattern_fills[i].color = color; + qt_x11Data->pattern_fills[i].bg_color = bg_color; + qt_x11Data->pattern_fills[i].opaque = false; + qt_x11Data->pattern_fills[i].style = b.style(); - XRenderFillRectangle(X11->display, PictOpSrc, X11->pattern_fills[i].picture, &bg_color, 0, 0, 8, 8); + XRenderFillRectangle(qt_x11Data->display, PictOpSrc, qt_x11Data->pattern_fills[i].picture, &bg_color, 0, 0, 8, 8); QPixmap pattern(qt_pixmapForBrush(b.style(), true)); XRenderPictureAttributes attrs; attrs.repeat = true; - XRenderChangePicture(X11->display, pattern.x11PictureHandle(), CPRepeat, &attrs); + XRenderChangePicture(qt_x11Data->display, pattern.x11PictureHandle(), CPRepeat, &attrs); - Picture fill_fg = X11->getSolidFill(screen, b.color()); - XRenderComposite(X11->display, PictOpOver, fill_fg, pattern.x11PictureHandle(), - X11->pattern_fills[i].picture, + Picture fill_fg = qt_x11Data->getSolidFill(screen, b.color()); + XRenderComposite(qt_x11Data->display, PictOpOver, fill_fg, pattern.x11PictureHandle(), + qt_x11Data->pattern_fills[i].picture, 0, 0, 0, 0, 0, 0, 8, 8); - return X11->pattern_fills[i].picture; + return qt_x11Data->pattern_fills[i].picture; } static void qt_render_bitmap(Display *dpy, int scrn, Picture src, Picture dst, int sx, int sy, int x, int y, int sw, int sh, const QPen &pen) { - Picture fill_fg = X11->getSolidFill(scrn, pen.color()); + Picture fill_fg = qt_x11Data->getSolidFill(scrn, pen.color()); XRenderComposite(dpy, PictOpOver, fill_fg, src, dst, sx, sy, sx, sy, x, y, sw, sh); } @@ -402,12 +402,12 @@ static QPaintEngine::PaintEngineFeatures qt_decide_features() | QPaintEngine::PainterPaths | QPaintEngine::RasterOpModes; - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { features |= QPaintEngine::Antialiasing; features |= QPaintEngine::PorterDuff; features |= QPaintEngine::MaskedBrush; #if 0 - if (X11->xrender_version > 10) { + if (qt_x11Data->xrender_version > 10) { features |= QPaintEngine::LinearGradientFill; // ### } @@ -456,7 +456,7 @@ bool QX11PaintEngine::begin(QPaintDevice *pdev) } else if (pdev->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast(pdev); QX11PixmapData *data = static_cast(pm->data.data()); - if (X11->use_xrender && data->depth() != 32 && data->x11_mask) + if (qt_x11Data->use_xrender && data->depth() != 32 && data->x11_mask) data->convertToARGB32(); d->picture = (::Picture)static_cast(pdev)->x11PictureHandle(); } @@ -809,12 +809,12 @@ void QX11PaintEngine::drawRects(const QRect *rects, int rectCount) #if !defined(QT_NO_XRENDER) ::Picture pict = d->picture; - if (X11->use_xrender && pict && d->has_brush && d->pdev_depth != 1 + if (qt_x11Data->use_xrender && pict && d->has_brush && d->pdev_depth != 1 && (d->has_texture || d->has_alpha_brush || complexPictOp(d->composition_mode))) { XRenderColor xc; if (!d->has_texture && !d->has_pattern) - xc = X11->preMultiply(d->cbrush.color()); + xc = qt_x11Data->preMultiply(d->cbrush.color()); for (int i = 0; i < rectCount; ++i) { QRect r(rects[i]); @@ -909,7 +909,7 @@ static inline void setCapStyle(int cap_style, GC gc) ulong mask = GCCapStyle; XGCValues vals; vals.cap_style = cap_style; - XChangeGC(X11->display, gc, mask, &vals); + XChangeGC(qt_x11Data->display, gc, mask, &vals); } void QX11PaintEngine::drawPoints(const QPoint *points, int pointCount) @@ -924,7 +924,7 @@ void QX11PaintEngine::drawPoints(const QPoint *points, int pointCount) // use the same test here as in drawPath to ensure that we don't use the path fallback // and end up in XDrawLines for pens with width <= 1 if (d->cpen.widthF() > 1.0f - || (X11->use_xrender && (d->has_alpha_pen || (d->render_hints & QPainter::Antialiasing))) + || (qt_x11Data->use_xrender && (d->has_alpha_pen || (d->render_hints & QPainter::Antialiasing))) || (!d->cpen.isCosmetic() && d->txop > QTransform::TxTranslate)) { Qt::PenCapStyle capStyle = d->cpen.capStyle(); @@ -982,7 +982,7 @@ void QX11PaintEngine::drawPoints(const QPointF *points, int pointCount) // use the same test here as in drawPath to ensure that we don't use the path fallback // and end up in XDrawLines for pens with width <= 1 if (d->cpen.widthF() > 1.0f - || (X11->use_xrender && (d->has_alpha_pen || (d->render_hints & QPainter::Antialiasing))) + || (qt_x11Data->use_xrender && (d->has_alpha_pen || (d->render_hints & QPainter::Antialiasing))) || (!d->cpen.isCosmetic() && d->txop > QTransform::TxTranslate)) { Qt::PenCapStyle capStyle = d->cpen.capStyle(); @@ -1032,7 +1032,7 @@ void QX11PaintEngine::drawPoints(const QPointF *points, int pointCount) QPainter::RenderHints QX11PaintEngine::supportedRenderHints() const { #if !defined(QT_NO_XRENDER) - if (X11->use_xrender) + if (qt_x11Data->use_xrender) return QPainter::Antialiasing; #endif return QFlag(0); @@ -1123,8 +1123,8 @@ void QX11PaintEngine::updateState(const QPaintEngineState &state) qpainterOpToXrender(state.compositionMode()); } #endif - XSetFunction(X11->display, d->gc, function); - XSetFunction(X11->display, d->gc_brush, function); + XSetFunction(qt_x11Data->display, d->gc, function); + XSetFunction(qt_x11Data->display, d->gc_brush, function); } d->decidePathFallback(); d->decideCoordAdjust(); @@ -1136,7 +1136,7 @@ void QX11PaintEngine::updateRenderHints(QPainter::RenderHints hints) d->render_hints = hints; #if !defined(QT_NO_XRENDER) - if (X11->use_xrender && d->picture) { + if (qt_x11Data->use_xrender && d->picture) { XRenderPictureAttributes attrs; attrs.poly_edge = (hints & QPainter::Antialiasing) ? PolyEdgeSmooth : PolyEdgeSharp; XRenderChangePicture(d->dpy, d->picture, CPPolyEdge, &attrs); @@ -1253,7 +1253,7 @@ void QX11PaintEngine::updatePen(const QPen &pen) vals.foreground = qGray(pen.color().rgb()) > 127 ? 0 : 1; vals.background = qGray(QColor(Qt::transparent).rgb()) > 127 ? 0 : 1; } else if (d->pdev->devType() == QInternal::Pixmap && d->pdev_depth == 32 - && X11->use_xrender) { + && qt_x11Data->use_xrender) { vals.foreground = pen.color().rgba(); vals.background = QColor(Qt::transparent).rgba(); } else { @@ -1313,7 +1313,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) if (d->pdev_depth == 1) { vals.foreground = qGray(d->cbrush.color().rgb()) > 127 ? 0 : 1; vals.background = qGray(QColor(Qt::transparent).rgb()) > 127 ? 0 : 1; - } else if (X11->use_xrender && d->pdev->devType() == QInternal::Pixmap + } else if (qt_x11Data->use_xrender && d->pdev->devType() == QInternal::Pixmap && d->pdev_depth == 32) { vals.foreground = d->cbrush.color().rgba(); vals.background = QColor(Qt::transparent).rgba(); @@ -1322,7 +1322,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) vals.foreground = cmap.pixel(d->cbrush.color()); vals.background = cmap.pixel(QColor(Qt::transparent)); - if (!X11->use_xrender && d->has_brush && !d->has_pattern && !brush.isOpaque()) { + if (!qt_x11Data->use_xrender && d->has_brush && !d->has_pattern && !brush.isOpaque()) { QPixmap pattern = qt_patternForAlpha(brush.color().alpha(), d->scrn); mask |= GCStipple; vals.stipple = pattern.handle(); @@ -1338,7 +1338,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) if (bs == Qt::TexturePattern) { d->brush_pm = qt_toX11Pixmap(d->cbrush.texture()); #if !defined(QT_NO_XRENDER) - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { XRenderPictureAttributes attrs; attrs.repeat = true; XRenderChangePicture(d->dpy, d->brush_pm.x11PictureHandle(), CPRepeat, &attrs); @@ -1356,13 +1356,13 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) vals.stipple = d->brush_pm.handle(); s = FillStippled; #if !defined(QT_NO_XRENDER) - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { d->bitmap_texture = QPixmap(d->brush_pm.size()); d->bitmap_texture.fill(Qt::transparent); d->bitmap_texture = qt_toX11Pixmap(d->bitmap_texture); d->bitmap_texture.x11SetScreen(d->scrn); - ::Picture src = X11->getSolidFill(d->scrn, d->cbrush.color()); + ::Picture src = qt_x11Data->getSolidFill(d->scrn, d->cbrush.color()); XRenderComposite(d->dpy, PictOpSrc, src, d->brush_pm.x11PictureHandle(), d->bitmap_texture.x11PictureHandle(), 0, 0, d->brush_pm.width(), d->brush_pm.height(), @@ -1399,7 +1399,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) } #if !defined(QT_NO_XRENDER) else if (d->has_alpha_brush) { - d->current_brush = X11->getSolidFill(d->scrn, d->cbrush.color()); + d->current_brush = qt_x11Data->getSolidFill(d->scrn, d->cbrush.color()); } #endif @@ -1484,7 +1484,7 @@ void QX11PaintEnginePrivate::fillPolygon_translated(const QPointF *polygonPoints QPointF offset(matrix.dx(), matrix.dy()); qreal offs = adjust_coords ? aliasedCoordinateDelta : 0.0; - if (!X11->use_xrender || !(render_hints & QPainter::Antialiasing)) + if (!qt_x11Data->use_xrender || !(render_hints & QPainter::Antialiasing)) offset += QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta); for (int i = 0; i < pointCount; ++i) { @@ -1546,7 +1546,7 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p if (current_brush) src = current_brush; else - src = X11->getSolidFill(scrn, fill.color()); + src = qt_x11Data->getSolidFill(scrn, fill.color()); #endif } else { fill = QBrush(cpen.brush()); @@ -1560,7 +1560,7 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p else if (has_fill_pattern) src = getPatternFill(scrn, fill); else - src = X11->getSolidFill(scrn, fill.color()); + src = qt_x11Data->getSolidFill(scrn, fill.color()); #endif } @@ -1576,7 +1576,7 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p bool antialias = render_hints & QPainter::Antialiasing; - if (X11->use_xrender + if (qt_x11Data->use_xrender && picture && !has_fill_pattern && (clippedCount > 0) @@ -1727,7 +1727,7 @@ void QX11PaintEnginePrivate::fillPath(const QPainterPath &path, QX11PaintEngineP for (int j = 0; j < polys.at(i).size(); ++j) { translated_points[j] = polys.at(i).at(j); - if (!X11->use_xrender || !(render_hints & QPainter::Antialiasing)) { + if (!qt_x11Data->use_xrender || !(render_hints & QPainter::Antialiasing)) { translated_points[j].rx() = qRound(translated_points[j].rx() + aliasedCoordinateDelta) + offs; translated_points[j].ry() = qRound(translated_points[j].ry() + aliasedCoordinateDelta) + offs; } @@ -1747,7 +1747,7 @@ void QX11PaintEngine::drawPath(const QPainterPath &path) if (d->has_brush) d->fillPath(path, QX11PaintEnginePrivate::BrushGC, true); if (d->has_pen - && ((X11->use_xrender && (d->has_alpha_pen || (d->render_hints & QPainter::Antialiasing))) + && ((qt_x11Data->use_xrender && (d->has_alpha_pen || (d->render_hints & QPainter::Antialiasing))) || (!d->cpen.isCosmetic() && d->txop > QTransform::TxTranslate && !d->has_non_scaling_xform) || (d->cpen.style() == Qt::CustomDashLine))) { @@ -1808,7 +1808,7 @@ Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const Q const int h = rect.height(); QImage im; - int image_byte_order = ImageByteOrder(X11->display); + int image_byte_order = ImageByteOrder(qt_x11Data->display); if ((QSysInfo::ByteOrder == QSysInfo::BigEndian && ((image_byte_order == LSBFirst) || bgr_layout)) || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) || (image_byte_order == LSBFirst && bgr_layout)) @@ -1891,9 +1891,9 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect return; if ((d->xinfo && d->xinfo->screen() != pixmap.x11Info().screen()) - || (pixmap.x11Info().screen() != DefaultScreen(X11->display))) { + || (pixmap.x11Info().screen() != DefaultScreen(qt_x11Data->display))) { QPixmap* p = const_cast(&pixmap); - p->x11SetScreen(d->xinfo ? d->xinfo->screen() : DefaultScreen(X11->display)); + p->x11SetScreen(d->xinfo ? d->xinfo->screen() : DefaultScreen(qt_x11Data->display)); } QPixmap::x11SetDefaultScreen(pixmap.x11Info().screen()); @@ -2092,15 +2092,15 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co Q_D(QX11PaintEngine); if ((d->xinfo && d->xinfo->screen() != pixmap.x11Info().screen()) - || (pixmap.x11Info().screen() != DefaultScreen(X11->display))) { + || (pixmap.x11Info().screen() != DefaultScreen(qt_x11Data->display))) { QPixmap* p = const_cast(&pixmap); - p->x11SetScreen(d->xinfo ? d->xinfo->screen() : DefaultScreen(X11->display)); + p->x11SetScreen(d->xinfo ? d->xinfo->screen() : DefaultScreen(qt_x11Data->display)); } QPixmap::x11SetDefaultScreen(pixmap.x11Info().screen()); #ifndef QT_NO_XRENDER - if (X11->use_xrender && d->picture && pixmap.x11PictureHandle()) { + if (qt_x11Data->use_xrender && d->picture && pixmap.x11PictureHandle()) { #if 0 // ### Qt 5: enable this XRenderPictureAttributes attrs; @@ -2335,7 +2335,7 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) return; } - const bool xrenderPath = (X11->use_xrender + const bool xrenderPath = (qt_x11Data->use_xrender && !(d->pdev->devType() == QInternal::Pixmap && static_cast(d->pdev)->data->pixelType() == QPixmapData::BitmapType)); @@ -2365,10 +2365,10 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) if (xrenderPath) { GlyphSet glyphSet = set->id; const QColor &pen = d->cpen.color(); - ::Picture src = X11->getSolidFill(d->scrn, pen); + ::Picture src = qt_x11Data->getSolidFill(d->scrn, pen); XRenderPictFormat *maskFormat = 0; if (ft->xglyph_format != PictStandardA1) - maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format); + maskFormat = XRenderFindStandardFormat(qt_x11Data->display, ft->xglyph_format); enum { t_min = SHRT_MIN, t_max = SHRT_MAX }; @@ -2411,7 +2411,7 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) xp = positions[i].x; yp = positions[i].y; - XRenderCompositeText32(X11->display, PictOpOver, src, d->picture, + XRenderCompositeText32(qt_x11Data->display, PictOpOver, src, d->picture, maskFormat, 0, 0, 0, 0, &elt, 1); elt.chars = &glyphs[i]; @@ -2420,7 +2420,7 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) elt.yOff = qRound(yp + offs); } } - XRenderCompositeText32(X11->display, PictOpOver, src, d->picture, + XRenderCompositeText32(qt_x11Data->display, PictOpOver, src, d->picture, maskFormat, 0, 0, 0, 0, &elt, 1); diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 46fdb8a29..9383b11d7 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -598,7 +598,7 @@ void QPrinter::init(PrinterMode mode) #if !defined(Q_WS_X11) if (!qApp) { #else - if (!qApp || !X11) { + if (!qApp || !qt_x11Data) { #endif qFatal("QPrinter: Must construct a QApplication before a QPaintDevice"); return; @@ -817,7 +817,7 @@ bool QPrinter::isValid() const { Q_D(const QPrinter); #if defined(Q_WS_X11) - if (!qApp || !X11) { + if (!qApp || !qt_x11Data) { return false; } #endif diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index d0e14839a..bd145fadb 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -78,9 +78,9 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa : QWindowSurface(window, setDefaultSurface), d_ptr(new QRasterWindowSurfacePrivate) { #ifdef Q_WS_X11 - d_ptr->gc = XCreateGC(X11->display, window->handle(), 0, 0); + d_ptr->gc = XCreateGC(qt_x11Data->display, window->handle(), 0, 0); #ifndef QT_NO_XRENDER - d_ptr->translucentBackground = X11->use_xrender + d_ptr->translucentBackground = qt_x11Data->use_xrender && window->x11Info().depth() == 32; #endif #ifndef QT_NO_XSHM @@ -95,7 +95,7 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa QRasterWindowSurface::~QRasterWindowSurface() { #ifdef Q_WS_X11 - XFreeGC(X11->display, d_ptr->gc); + XFreeGC(qt_x11Data->display, d_ptr->gc); #endif if (d_ptr->image) delete d_ptr->image; @@ -111,7 +111,7 @@ void QRasterWindowSurface::syncX() { // delay writing to the backbuffer until we know for sure X is done reading from it if (d_ptr->needsSync) { - XSync(X11->display, false); + XSync(qt_x11Data->display, false); d_ptr->needsSync = false; } } @@ -151,8 +151,8 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); if (widget->window() != window()) { - XFreeGC(X11->display, d_ptr->gc); - d_ptr->gc = XCreateGC(X11->display, widget->handle(), 0, 0); + XFreeGC(qt_x11Data->display, d_ptr->gc); + d_ptr->gc = XCreateGC(qt_x11Data->display, widget->handle(), 0, 0); } QRegion wrgn(rgn); @@ -162,7 +162,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi if (wrgn.rectCount() != 1) { int num; XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); - XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); + XSetClipRectangles(qt_x11Data->display, d_ptr->gc, 0, 0, rects, num, YXBanded); } QPoint widgetOffset = offset + wOffset; @@ -173,7 +173,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi int depth = widget->x11Info().depth(); const QImage *src = d->image; - if (src->format() != QImage::Format_RGB32 || (depth != 24 && depth != 32) || X11->bppForDepth.value(depth) != 32) { + if (src->format() != QImage::Format_RGB32 || (depth != 24 && depth != 32) || qt_x11Data->bppForDepth.value(depth) != 32) { Q_ASSERT(src->depth() >= 16); const QImage sub_src(src->scanLine(br.y()) + br.x() * (uint(src->depth()) / 8), br.width(), br.height(), src->bytesPerLine(), src->format()); @@ -181,15 +181,15 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi data->xinfo = widget->x11Info(); data->fromImage(sub_src, Qt::NoOpaqueDetection); QPixmap pm = QPixmap(data); - XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wpos.x(), wpos.y()); + XCopyArea(qt_x11Data->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wpos.x(), wpos.y()); } else { // qpaintengine_x11.cpp extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage *image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth); - qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), depth); + qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, qt_x11Data->display, (Visual *)widget->x11Info().visual(), depth); } if (wrgn.rectCount() != 1) - XSetClipMask(X11->display, d_ptr->gc, XNone); + XSetClipMask(qt_x11Data->display, d_ptr->gc, XNone); #endif // Q_WS_X11 } diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 35c4c13d5..b5497f834 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -68,7 +68,7 @@ QX11WindowSurface::QX11WindowSurface(QWidget *widget) { d_ptr->widget = widget; #ifndef QT_NO_XRENDER - d_ptr->translucentBackground = X11->use_xrender + d_ptr->translucentBackground = qt_x11Data->use_xrender && widget->x11Info().depth() == 32; #endif } @@ -78,7 +78,7 @@ QX11WindowSurface::~QX11WindowSurface() { delete d_ptr; if (gc) { - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); gc = 0; } } @@ -96,13 +96,13 @@ void QX11WindowSurface::beginPaint(const QRegion &rgn) if (d_ptr->translucentBackground) { if (d_ptr->device.depth() != 32) static_cast(d_ptr->device.data_ptr().data())->convertToARGB32(); - ::Picture src = X11->getSolidFill(d_ptr->device.x11Info().screen(), Qt::transparent); + ::Picture src = qt_x11Data->getSolidFill(d_ptr->device.x11Info().screen(), Qt::transparent); ::Picture dst = d_ptr->device.x11PictureHandle(); const QVector rects = rgn.rects(); const int w = d_ptr->device.width(); const int h = d_ptr->device.height(); for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) - XRenderComposite(X11->display, PictOpSrc, src, 0, dst, + XRenderComposite(qt_x11Data->display, PictOpSrc, src, 0, dst, 0, 0, w, h, it->x(), it->y(), it->width(), it->height()); } @@ -129,11 +129,11 @@ void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint // for (int i = 0; i < num; ++i) // qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height; if (num != 1) - XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded); - XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc, + XSetClipRectangles(qt_x11Data->display, gc, 0, 0, rects, num, YXBanded); + XCopyArea(qt_x11Data->display, d_ptr->device.handle(), widget->handle(), gc, br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y()); if (num != 1) - XSetClipMask(X11->display, gc, XNone); + XSetClipMask(qt_x11Data->display, gc, XNone); } void QX11WindowSurface::setGeometry(const QRect &rect) @@ -174,12 +174,12 @@ void QX11WindowSurface::setGeometry(const QRect &rect) int num; XRectangle *rects = (XRectangle *)qt_getClipRects(staticRegion, num); - GC tmpGc = XCreateGC(X11->display, oldData->hd, 0, 0); - XSetClipRectangles(X11->display, tmpGc, 0, 0, rects, num, YXBanded); - XCopyArea(X11->display, oldData->hd, newData->hd, tmpGc, + GC tmpGc = XCreateGC(qt_x11Data->display, oldData->hd, 0, 0); + XSetClipRectangles(qt_x11Data->display, tmpGc, 0, 0, rects, num, YXBanded); + XCopyArea(qt_x11Data->display, oldData->hd, newData->hd, tmpGc, dx, dy, qMin(boundingRect.width(), size.width()), qMin(boundingRect.height(), size.height()), dx, dy); - XFreeGC(X11->display, tmpGc); + XFreeGC(qt_x11Data->display, tmpGc); newData->flags &= ~QX11PixmapData::Uninitialized; d_ptr->device = QPixmap(newData); @@ -189,12 +189,12 @@ void QX11WindowSurface::setGeometry(const QRect &rect) } if (gc) { - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); gc = 0; } if (!d_ptr->device.isNull()) { - gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); - XSetGraphicsExposures(X11->display, gc, False); + gc = XCreateGC(qt_x11Data->display, d_ptr->device.handle(), 0, 0); + XSetGraphicsExposures(qt_x11Data->display, gc, False); } } @@ -205,11 +205,11 @@ bool QX11WindowSurface::scroll(const QRegion &area, int dx, int dy) if (d_ptr->device.isNull()) return false; - GC gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); - XCopyArea(X11->display, d_ptr->device.handle(), d_ptr->device.handle(), gc, + GC gc = XCreateGC(qt_x11Data->display, d_ptr->device.handle(), 0, 0); + XCopyArea(qt_x11Data->display, d_ptr->device.handle(), d_ptr->device.handle(), gc, rect.x(), rect.y(), rect.width(), rect.height(), rect.x()+dx, rect.y()+dy); - XFreeGC(X11->display, gc); + XFreeGC(qt_x11Data->display, gc); return true; } @@ -238,14 +238,14 @@ QPixmap QX11WindowSurface::grabWidget(const QWidget *widget, QPixmap::x11SetDefaultScreen(widget->x11Info().screen()); QPixmap px(srcRect.width(), srcRect.height()); - GC tmpGc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); + GC tmpGc = XCreateGC(qt_x11Data->display, d_ptr->device.handle(), 0, 0); // Copy srcRect from the backing store to the new pixmap - XSetGraphicsExposures(X11->display, tmpGc, False); - XCopyArea(X11->display, d_ptr->device.handle(), px.handle(), tmpGc, + XSetGraphicsExposures(qt_x11Data->display, tmpGc, False); + XCopyArea(qt_x11Data->display, d_ptr->device.handle(), px.handle(), tmpGc, srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height(), 0, 0); - XFreeGC(X11->display, tmpGc); + XFreeGC(qt_x11Data->display, tmpGc); return px; } diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 6da020dd2..131009c5a 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -4866,9 +4866,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_DialogButtonLayout: ret = QDialogButtonBox::WinLayout; #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (qt_x11Data->desktopEnvironment == DE_KDE) ret = QDialogButtonBox::KdeLayout; - else if (X11->desktopEnvironment == DE_GNOME) + else if (qt_x11Data->desktopEnvironment == DE_GNOME) ret = QDialogButtonBox::GnomeLayout; #endif break; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4f37a3bcc..ccd30dd4c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1801,7 +1801,7 @@ static void initFontSubst() if (!fontSubst->isEmpty()) return; #if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) - if (X11->has_fontconfig) + if (qt_x11Data->has_fontconfig) return; #endif diff --git a/src/gui/text/qfontdatabase_x11.h b/src/gui/text/qfontdatabase_x11.h index cd6e335bd..8aba0c3e0 100644 --- a/src/gui/text/qfontdatabase_x11.h +++ b/src/gui/text/qfontdatabase_x11.h @@ -755,7 +755,7 @@ QFontDef qt_FcPatternToQFontDef(FcPattern *pattern, const QFontDef &request) double dpi; if (FcPatternGetDouble(pattern, FC_DPI, 0, &dpi) != FcResultMatch) { - if (X11->display) + if (qt_x11Data->display) dpi = QX11Info::appDpiY(); else dpi = qt_defaultDpiY(); @@ -1003,7 +1003,7 @@ static void loadFontConfig() { Q_ASSERT_X(X11, "QFontDatabase", "A QApplication object needs to be constructed before FontConfig is used."); - if (!X11->has_fontconfig) + if (!qt_x11Data->has_fontconfig) return; Q_ASSERT_X(int(QUnicodeTables::ScriptCount) == SpecialLanguageCount, @@ -1228,7 +1228,7 @@ static void initializeDb(); static void load(const QString &family = QString(), int script = -1, bool forceXLFD = false) { - if (X11->has_fontconfig && !forceXLFD) { + if (qt_x11Data->has_fontconfig && !forceXLFD) { initializeDb(); return; } @@ -1384,7 +1384,7 @@ static void initializeDb() #ifdef QFONTDATABASE_DEBUG #ifndef QT_NO_FONTCONFIG - if (!X11->has_fontconfig) + if (!qt_x11Data->has_fontconfig) #endif // load everything at startup in debug mode. loadXlfds(0, -1); @@ -1468,7 +1468,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD FcPatternDel(pattern, FC_PIXEL_SIZE); FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value); - if (X11->display && QX11Info::appDepth(screen) <= 8) { + if (qt_x11Data->display && QX11Info::appDepth(screen) <= 8) { FcPatternDel(pattern, FC_ANTIALIAS); // can't do antialiasing on 8bpp FcPatternAddBool(pattern, FC_ANTIALIAS, false); @@ -1530,7 +1530,7 @@ static bool preferScalable(const QFontDef &request) static FcPattern *getFcPattern(const QFontPrivate *fp, int script, const QFontDef &request) { - if (!X11->has_fontconfig) + if (!qt_x11Data->has_fontconfig) return 0; FcPattern *pattern = FcPatternCreate(); @@ -1966,7 +1966,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (mainThread) fe = loadRaw(d, req); #ifndef QT_NO_FONTCONFIG - } else if (X11->has_fontconfig) { + } else if (qt_x11Data->has_fontconfig) { fe = loadFc(d, script, req); #endif } else if (mainThread && qt_is_gui_used) { @@ -2001,7 +2001,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) #if defined(QT_NO_FONTCONFIG) return; #else - if (!X11->has_fontconfig) + if (!qt_x11Data->has_fontconfig) return; FcConfig *config = FcConfigGetCurrent(); @@ -2118,7 +2118,7 @@ bool QFontDatabase::supportsThreadedFontRendering() #if defined(QT_NO_FONTCONFIG) return false; #else - return X11->has_fontconfig; + return qt_x11Data->has_fontconfig; #endif } diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index 9dab40e8b..818c7846b 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -147,7 +147,7 @@ static QStringList fontPath() int npaths; char** font_path; - font_path = XGetFontPath(X11->display, &npaths); + font_path = XGetFontPath(qt_x11Data->display, &npaths); bool xfsconfig_read = false; for (int i=0; ifc_antialias; + bool antialias = qt_x11Data->fc_antialias; QByteArray file_name; int face_index; qt_x11ft_convert_pattern(pattern, &file_name, &face_index, &antialias); @@ -985,7 +985,7 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s subpixelType = Subpixel_None; if (antialias) { - int subpixel = X11->display ? X11->screens[screen].subpixel : FC_RGBA_UNKNOWN; + int subpixel = qt_x11Data->display ? qt_x11Data->screens[screen].subpixel : FC_RGBA_UNKNOWN; if (subpixel == FC_RGBA_UNKNOWN) (void) FcPatternGetInteger(pattern, FC_RGBA, 0, &subpixel); if (!antialias || subpixel == FC_RGBA_UNKNOWN) @@ -1020,11 +1020,11 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s int hint_style = 0; // Try to use Xft.hintstyle from XDefaults first if running in GNOME, to match // the behavior of cairo - if (X11->fc_hint_style > -1 && X11->desktopEnvironment == DE_GNOME) - hint_style = X11->fc_hint_style; + if (qt_x11Data->fc_hint_style > -1 && qt_x11Data->desktopEnvironment == DE_GNOME) + hint_style = qt_x11Data->fc_hint_style; else if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch - && X11->fc_hint_style > -1) - hint_style = X11->fc_hint_style; + && qt_x11Data->fc_hint_style > -1) + hint_style = qt_x11Data->fc_hint_style; switch (hint_style) { case FC_HINT_NONE: @@ -1092,7 +1092,7 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s GlyphFormat defaultFormat = Format_None; #ifndef QT_NO_XRENDER - if (X11->use_xrender) { + if (qt_x11Data->use_xrender) { int format = PictStandardA8; if (!antialias) format = PictStandardA1; @@ -1130,9 +1130,9 @@ QFontEngineX11FT::~QFontEngineX11FT() unsigned long QFontEngineX11FT::allocateServerGlyphSet() { #ifndef QT_NO_XRENDER - if (!canUploadGlyphsToServer || !X11->use_xrender) + if (!canUploadGlyphsToServer || !qt_x11Data->use_xrender) return 0; - return XRenderCreateGlyphSet(X11->display, XRenderFindStandardFormat(X11->display, xglyph_format)); + return XRenderCreateGlyphSet(qt_x11Data->display, XRenderFindStandardFormat(qt_x11Data->display, xglyph_format)); #else return 0; #endif @@ -1143,7 +1143,7 @@ void QFontEngineX11FT::freeServerGlyphSet(unsigned long id) #ifndef QT_NO_XRENDER if (!id) return; - XRenderFreeGlyphSet(X11->display, id); + XRenderFreeGlyphSet(qt_x11Data->display, id); #endif } @@ -1156,7 +1156,7 @@ bool QFontEngineX11FT::uploadGlyphToServer(QGlyphSet *set, uint glyphid, Glyph * /* * swap bit order around; FreeType is always MSBFirst */ - if (BitmapBitOrder(X11->display) != MSBFirst) { + if (BitmapBitOrder(qt_x11Data->display) != MSBFirst) { unsigned char *line = g->data; int i = glyphDataSize; while (i--) { @@ -1171,7 +1171,7 @@ bool QFontEngineX11FT::uploadGlyphToServer(QGlyphSet *set, uint glyphid, Glyph * } ::Glyph xglyph = glyphid; - XRenderAddGlyphs (X11->display, set->id, &xglyph, info, 1, (const char *)g->data, glyphDataSize); + XRenderAddGlyphs (qt_x11Data->display, set->id, &xglyph, info, 1, (const char *)g->data, glyphDataSize); delete [] g->data; g->data = 0; g->format = Format_None; diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index ef1d4e5f7..01885ffbd 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -212,7 +212,7 @@ void QComboBoxPrivate::_q_modelDestroyed() QRect QComboBoxPrivate::popupGeometry(int screen) const { #if defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (qt_x11Data->desktopEnvironment == DE_KDE) return QApplication::desktop()->screenGeometry(screen); #endif return QApplication::desktop()->availableGeometry(screen); diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index a4cbfec5b..ad00f2349 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -165,7 +165,7 @@ int QMenuPrivate::scrollerHeight() const QRect QMenuPrivate::popupGeometry(const QWidget *widget) const { #if defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (qt_x11Data->desktopEnvironment == DE_KDE) return QApplication::desktop()->screenGeometry(widget); #endif return QApplication::desktop()->availableGeometry(widget); @@ -175,7 +175,7 @@ QRect QMenuPrivate::popupGeometry(const QWidget *widget) const QRect QMenuPrivate::popupGeometry(int screen) const { #if defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (qt_x11Data->desktopEnvironment == DE_KDE) return QApplication::desktop()->screenGeometry(screen); #endif return QApplication::desktop()->availableGeometry(screen); diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp index bf8f01663..05f2bc950 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/gui/widgets/qsizegrip.cpp @@ -270,13 +270,13 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) #ifdef Q_WS_X11 // Use a native X11 sizegrip for "real" top-level windows if supported. - if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE)) + if (tlw->isWindow() && qt_x11Data->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE)) && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) { XEvent xev; xev.xclient.type = ClientMessage; xev.xclient.message_type = ATOM(_NET_WM_MOVERESIZE); - xev.xclient.display = X11->display; + xev.xclient.display = qt_x11Data->display; xev.xclient.window = tlw->winId(); xev.xclient.format = 32; xev.xclient.data.l[0] = e->globalPos().x(); @@ -287,8 +287,8 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) xev.xclient.data.l[2] = d->atLeft() ? 0 : 2; // topleft/topright xev.xclient.data.l[3] = Button1; xev.xclient.data.l[4] = 0; - XUngrabPointer(X11->display, X11->time); - XSendEvent(X11->display, QX11Info::appRootWindow(x11Info().screen()), False, + XUngrabPointer(qt_x11Data->display, qt_x11Data->time); + XSendEvent(qt_x11Data->display, QX11Info::appRootWindow(x11Info().screen()), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); return; } @@ -369,7 +369,7 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e) return; #ifdef Q_WS_X11 - if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE)) + if (tlw->isWindow() && qt_x11Data->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE)) && tlw->isTopLevel() && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) return; diff --git a/src/network/access/qabstractnetworkcache.cpp b/src/network/access/qabstractnetworkcache.cpp index 37e752dd7..822cc5af2 100644 --- a/src/network/access/qabstractnetworkcache.cpp +++ b/src/network/access/qabstractnetworkcache.cpp @@ -361,7 +361,7 @@ QDataStream &operator>>(QDataStream &in, QNetworkCacheMetaData &metaData) static inline QDataStream &operator>>(QDataStream &in, QNetworkCacheMetaData::AttributesMap &hash) { hash.clear(); - QDataStream::StreamStatus oldStatus = in.status(); + QDataStream::DataStatus oldStatus = in.status(); in.resetStatus(); hash.clear(); diff --git a/src/tools/qtconfig/mainwindow.cpp b/src/tools/qtconfig/mainwindow.cpp index 5c8c0093c..c1021ee54 100644 --- a/src/tools/qtconfig/mainwindow.cpp +++ b/src/tools/qtconfig/mainwindow.cpp @@ -242,7 +242,7 @@ MainWindow::MainWindow() connect(ui->buttonWindowColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette())); #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (qt_x11Data->desktopEnvironment == DE_KDE) ui->colorConfig->hide(); else ui->kdeNoteLabel->hide();