mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
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 <xakepa10@laimg.moc>
This commit is contained in:
parent
be048dee40
commit
a78f51acfc
44 changed files with 1123 additions and 1134 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<T> &set)
|
|||
template <class Key, class T>
|
||||
Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QHash<Key, T> &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<Key,
|
|||
template <class aKey, class aT>
|
||||
Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &map)
|
||||
{
|
||||
QDataStream::StreamStatus oldStatus = in.status();
|
||||
QDataStream::DataStatus oldStatus = in.status();
|
||||
in.resetStatus();
|
||||
map.clear();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -48,14 +48,8 @@ QT_BEGIN_HEADER
|
|||
|
||||
#ifndef QT_NO_SETTINGS
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -46,10 +46,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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<QGraphicsWidget *>(item), painter, option, widget, true, painterStateProtection);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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<XFixesSelectionNotifyEvent *>(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<Atom> types;
|
||||
QStringList formats = QInternalMimeData::formatsHelper(d->source());
|
||||
for (int i = 0; i < formats.size(); ++i) {
|
||||
QList<Atom> atoms = X11->xdndMimeAtomsForFormat(formats.at(i));
|
||||
QList<Atom> 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,
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Atom> atoms = X11->xdndMimeAtomsForFormat(fmts.at(i));
|
||||
QList<Atom> 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));
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -74,7 +74,7 @@ static gboolean x11EventSourcePrepare(GSource *s, gint *timeout)
|
|||
if (timeout)
|
||||
*timeout = -1;
|
||||
GX11EventSource *source = reinterpret_cast<GX11EventSource *>(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<GX11EventSource *>(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<GX11EventSource *>(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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
// ###
|
||||
|
|
|
@ -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<const QPixmap *>(pdev);
|
||||
QX11PixmapData *data = static_cast<QX11PixmapData*>(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<const QPixmap *>(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<QPixmap *>(&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<QPixmap *>(&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<const QPixmap *>(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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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<QX11PixmapData *>(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<QRect> rects = rgn.rects();
|
||||
const int w = d_ptr->device.width();
|
||||
const int h = d_ptr->device.height();
|
||||
for (QVector<QRect>::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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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; i<npaths; i++) {
|
||||
// If we're using xfs, append font paths from /etc/X11/fs/config
|
||||
|
@ -973,7 +973,7 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s
|
|||
{
|
||||
// FcPatternPrint(pattern);
|
||||
|
||||
bool antialias = X11->fc_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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue