diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-02-14 12:36:13 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-02-14 13:39:16 (GMT) |
commit | 7be3f2585676cb18821b51427527275fb441fa46 (patch) | |
tree | e835213fd69aa901044e8b60f487bfaa5900de85 /src | |
parent | 5582311143115dc16281d8ee258bde92e00d55b8 (diff) | |
download | Qt-7be3f2585676cb18821b51427527275fb441fa46.zip Qt-7be3f2585676cb18821b51427527275fb441fa46.tar.gz Qt-7be3f2585676cb18821b51427527275fb441fa46.tar.bz2 |
Lighthouse: renaming testlite to xlib
Diffstat (limited to 'src')
23 files changed, 301 insertions, 303 deletions
diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 2f6aa8b..131d399 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -44,36 +44,36 @@ QT_BEGIN_NAMESPACE -class QTestLiteIntegrationPlugin : public QPlatformIntegrationPlugin +class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); }; -QStringList QTestLiteIntegrationPlugin::keys() const +QStringList QXlibIntegrationPlugin::keys() const { QStringList list; - list << "TestLite"; + list << "Xlib"; #ifndef QT_NO_OPENGL - list << "TestLiteGL"; + list << "XlibGL"; #endif return list; } -QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "testlite") - return new QTestLiteIntegration; + if (system.toLower() == "xlib") + return new QXlibIntegration; #ifndef QT_NO_OPENGL - if (system.toLower() == "testlitegl") - return new QTestLiteIntegration(true); + if (system.toLower() == "xlibgl") + return new QXlibIntegration(true); #endif return 0; } -Q_EXPORT_PLUGIN2(testlite, QTestLiteIntegrationPlugin) +Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 8023014..46dfef9 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -113,7 +113,7 @@ QVector<int> QGLXContext::buildSpec(const QPlatformWindowFormat &format) return spec; } -GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) +GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) { bool reduced = true; GLXFBConfig chosenConfig = 0; @@ -149,7 +149,7 @@ GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatfo return chosenConfig; } -XVisualInfo *QGLXContext::findVisualInfo(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) +XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) { GLXFBConfig config = QGLXContext::findConfig(screen,format); XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); @@ -237,7 +237,7 @@ QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWin return retFormat; } -QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatformWindowFormat &format) +QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_screen(screen) , m_drawable((Drawable)window) @@ -272,7 +272,7 @@ QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatform #endif } -QGLXContext::QGLXContext(QTestLiteScreen *screen, Drawable drawable, GLXContext context) +QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) { @@ -286,7 +286,7 @@ QGLXContext::~QGLXContext() } } -void QGLXContext::createDefaultSharedContex(QTestLiteScreen *screen) +void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) { int x = 0; int y = 0; diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index abece45..f982708 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE class QGLXContext : public QPlatformGLContext { public: - QGLXContext(Window window, QTestLiteScreen *xd, const QPlatformWindowFormat &format); + QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); ~QGLXContext(); virtual void makeCurrent(); @@ -69,22 +69,22 @@ public: QPlatformWindowFormat platformWindowFormat() const; - static XVisualInfo *findVisualInfo(const QTestLiteScreen *xd, const QPlatformWindowFormat &format); + static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); private: - static GLXFBConfig findConfig(const QTestLiteScreen *xd,const QPlatformWindowFormat &format); + static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); static QVector<int> buildSpec(const QPlatformWindowFormat &format); static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; Drawable m_drawable; GLXContext m_context; QPlatformWindowFormat m_windowFormat; - QGLXContext (QTestLiteScreen *screen, Drawable drawable, GLXContext context); + QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContex(QTestLiteScreen *xd); + static void createDefaultSharedContex(QXlibScreen *xd); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp index 9bab7f9..1264b5a 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ b/src/plugins/platforms/testlite/qtestliteclipboard.cpp @@ -48,12 +48,12 @@ #include <QtCore/QDebug> -class QTestLiteClipboardMime : public QTestLiteMime +class QXlibClipboardMime : public QXlibMime { Q_OBJECT public: - QTestLiteClipboardMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard) - : QTestLiteMime() + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() , m_clipboard(clipboard) { switch (mode) { @@ -62,7 +62,7 @@ public: break; case QClipboard::Clipboard: - modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); break; default: @@ -78,11 +78,11 @@ protected: return QStringList(); if (!formatList.count()) { - QTestLiteClipboardMime *that = const_cast<QTestLiteClipboardMime *>(this); + QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); // get the list of targets from the current clipboard owner - we do this // once so that multiple calls to this function don't require multiple // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); if (format_atoms.size() > 0) { Atom *targets = (Atom *) format_atoms.data(); @@ -141,14 +141,14 @@ private: Atom modeAtom; - QTestLiteClipboard *m_clipboard; + QXlibClipboard *m_clipboard; QStringList formatList; QByteArray format_atoms; }; -const int QTestLiteClipboard::clipboard_timeout = 5000; +const int QXlibClipboard::clipboard_timeout = 5000; -QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) : QPlatformClipboard() , m_screen(screen) , m_xClipboard(0) @@ -160,14 +160,14 @@ QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) { } -const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const { if (mode == QClipboard::Clipboard) { if (!m_xClipboard) { - QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); - that->m_xClipboard = new QTestLiteClipboardMime(mode,that); + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)); + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { return m_clientClipboard; } else { @@ -175,8 +175,8 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const } } else if (mode == QClipboard::Selection) { if (!m_xSelection) { - QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); - that->m_xSelection = new QTestLiteClipboardMime(mode,that); + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); } Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); if (clipboardOwner == owner()) { @@ -188,7 +188,7 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const return 0; } -void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) { Atom modeAtom; QMimeData **d; @@ -199,7 +199,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) break; case QClipboard::Clipboard: - modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); d = &m_clientClipboard; break; @@ -226,7 +226,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) } -bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const { if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) return true; @@ -234,16 +234,16 @@ bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const } -QTestLiteScreen * QTestLiteClipboard::screen() const +QXlibScreen * QXlibClipboard::screen() const { return m_screen; } -Window QTestLiteClipboard::requestor() const +Window QXlibClipboard::requestor() const { if (!m_requestor) { int x = 0, y = 0, w = 3, h = 3; - QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); @@ -252,7 +252,7 @@ Window QTestLiteClipboard::requestor() const return m_requestor; } -void QTestLiteClipboard::setRequestor(Window window) +void QXlibClipboard::setRequestor(Window window) { if (m_requestor != XNone) { XDestroyWindow(m_screen->display(),m_requestor); @@ -260,11 +260,11 @@ void QTestLiteClipboard::setRequestor(Window window) m_requestor = window; } -Window QTestLiteClipboard::owner() const +Window QXlibClipboard::owner() const { if (!m_owner) { int x = 0, y = 0, w = 3, h = 3; - QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); @@ -273,7 +273,7 @@ Window QTestLiteClipboard::owner() const return m_owner; } -void QTestLiteClipboard::setOwner(Window window) +void QXlibClipboard::setOwner(Window window) { if (m_owner != XNone){ XDestroyWindow(m_screen->display(),m_owner); @@ -281,45 +281,45 @@ void QTestLiteClipboard::setOwner(Window window) m_owner = window; } -Atom QTestLiteClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) { QVector<Atom> types; QStringList formats = QInternalMimeData::formatsHelper(d); for (int i = 0; i < formats.size(); ++i) { - QList<Atom> atoms = QTestLiteMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); } } - types.append(QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::SAVE_TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); return property; } -Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) { Atom atomFormat = target; int dataFormat = 0; QByteArray data; - QString fmt = QTestLiteMime::mimeAtomToString(screen()->display(), target); + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); if (fmt.isEmpty()) { // Not a MIME type we have qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); return XNone; } qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - if (QTestLiteMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QTestLiteStatic::atom(QTestLiteStatic::CLIP_TEMPORARY); + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes @@ -327,7 +327,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, if (data.size() > increment && allow_incr) { long bytes = data.size(); XChangeProperty(screen()->display(), window, property, - QTestLiteStatic::atom(QTestLiteStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); // (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); qDebug() << "not implemented INCRT just YET!"; @@ -346,7 +346,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, return property; } -void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) { XSelectionRequestEvent *req = &xevent->xselectionrequest; @@ -367,7 +367,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) QMimeData *d; if (req->selection == XA_PRIMARY) { d = m_clientSelection; - } else if (req->selection == QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)) { + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { d = m_clientClipboard; } else { qWarning("QClipboard: Unknown selection '%lx'", req->selection); @@ -381,9 +381,9 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) return; } - Atom xa_targets = QTestLiteStatic::atom(QTestLiteStatic::TARGETS); - Atom xa_multiple = QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE); - Atom xa_timestamp = QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP); + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); struct AtomPair { Atom target; Atom property; } *multi = 0; Atom multi_type = XNone; @@ -469,7 +469,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) static inline int maxSelectionIncr(Display *dpy) { return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } -bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const { int maxsize = maxSelectionIncr(screen()->display()); ulong bytes_left; // bytes_after @@ -549,7 +549,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d XFree((char*)data); } - if (*format == 8 && *type == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { // convert COMPOUND_TEXT to a multibyte string XTextProperty textprop; textprop.encoding = *type; @@ -581,7 +581,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d return ok; } -QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) { XEvent event; @@ -639,7 +639,7 @@ QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom return QByteArray(); } -QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) { QByteArray buf; @@ -647,8 +647,8 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - XDeleteProperty(screen()->display(), win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), win, CurrentTime); + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); XSync(screen()->display(), false); XEvent xevent; @@ -660,10 +660,10 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) Atom type; XSelectInput(screen()->display(), win, PropertyChangeMask); - if (clipboardReadProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QTestLiteStatic::atom(QTestLiteStatic::INCR)) { + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), nbytes, false); + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); } } diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h index 76065a2..109714c 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.h +++ b/src/plugins/platforms/testlite/qtestliteclipboard.h @@ -45,18 +45,18 @@ #include <QPlatformClipboard> #include "qtestlitestaticinfo.h" -class QTestLiteScreen; -class QTestLiteClipboard : public QPlatformClipboard +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard { public: - QTestLiteClipboard(QTestLiteScreen *screen); + QXlibClipboard(QXlibScreen *screen); const QMimeData *mimeData(QClipboard::Mode mode) const; void setMimeData(QMimeData *data, QClipboard::Mode mode); bool supportsMode(QClipboard::Mode mode) const; - QTestLiteScreen *screen() const; + QXlibScreen *screen() const; Window requestor() const; void setRequestor(Window window); @@ -76,7 +76,7 @@ private: Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; QMimeData *m_xClipboard; QMimeData *m_clientClipboard; diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp index e7ef673..2f7cfbf 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.cpp +++ b/src/plugins/platforms/testlite/qtestlitecursor.cpp @@ -51,17 +51,17 @@ QT_BEGIN_NAMESPACE -QTestLiteCursor::QTestLiteCursor(QTestLiteScreen *screen) +QXlibCursor::QXlibCursor(QXlibScreen *screen) : QPlatformCursor(screen) { } -void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) { - QTestLiteWindow *w = 0; + QXlibWindow *w = 0; if (widget) { QWidget *window = widget->window(); - w = static_cast<QTestLiteWindow*>(window->platformWindow()); + w = static_cast<QXlibWindow*>(window->platformWindow()); } else { // No X11 cursor control when there is no widget under the cursor return; @@ -89,7 +89,7 @@ void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) w->setCursor(c); } -Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) { XColor bg, fg; bg.red = 255 << 8; @@ -132,7 +132,7 @@ Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) return c; } -Cursor QTestLiteCursor::createCursorShape(int cshape) +Cursor QXlibCursor::createCursorShape(int cshape) { Cursor cursor = 0; @@ -191,9 +191,9 @@ Cursor QTestLiteCursor::createCursorShape(int cshape) return cursor; } -QTestLiteScreen * QTestLiteCursor::testLiteScreen() const +QXlibScreen * QXlibCursor::testLiteScreen() const { - return static_cast<QTestLiteScreen *>(screen); + return static_cast<QXlibScreen *>(screen); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h index bb3549e..db9f9e2 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.h +++ b/src/plugins/platforms/testlite/qtestlitecursor.h @@ -48,10 +48,10 @@ QT_BEGIN_NAMESPACE -class QTestLiteCursor : QPlatformCursor +class QXlibCursor : QPlatformCursor { public: - QTestLiteCursor(QTestLiteScreen *screen); + QXlibCursor(QXlibScreen *screen); void changeCursor(QCursor * cursor, QWidget * widget); private: @@ -59,7 +59,7 @@ private: Cursor createCursorBitmap(QCursor * cursor); Cursor createCursorShape(int cshape); - QTestLiteScreen *testLiteScreen() const; + QXlibScreen *testLiteScreen() const; QMap<int, Cursor> cursorMap; }; diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp index 532c63d..9bbe0ca 100644 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp @@ -52,7 +52,7 @@ static int countBits(unsigned long mask) return count; } -VisualID QTestLiteEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) { VisualID visualId = 0; EGLint eglValue = 0; diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.h b/src/plugins/platforms/testlite/qtestliteeglintegration.h index 99e9018..4c2e50d 100644 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.h +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.h @@ -45,7 +45,7 @@ #include "qtestlitestaticinfo.h" #include "../eglconvenience/qeglconvenience.h" -class QTestLiteEglIntegration +class QXlibEglIntegration { public: static VisualID getCompatibleVisualId(Display *display, EGLConfig config); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index dc8a6d7..cdc5c29 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -61,16 +61,16 @@ QT_BEGIN_NAMESPACE -QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) +QXlibIntegration::QXlibIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) , mFontDb(new QGenericUnixFontDatabase()) , mClipboard(0) { - mPrimaryScreen = new QTestLiteScreen(); + mPrimaryScreen = new QXlibScreen(); mScreens.append(mPrimaryScreen); } -QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) @@ -79,33 +79,33 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } -QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLWindowSurface(widget); #endif - return new QTestLiteWindowSurface(widget); + return new QXlibWindowSurface(widget); } -QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - return new QTestLiteWindow(widget); + return new QXlibWindow(widget); } -QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const { QImage image; QWidget *widget = QWidget::find(window); if (widget) { - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); image = screen->grabWindow(window,x,y,width,height); } else { for (int i = 0; i < mScreens.size(); i++) { - QTestLiteScreen *screen = static_cast<QTestLiteScreen *>(mScreens[i]); + QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); if (screen->rootWindow() == window) { image = screen->grabWindow(window,x,y,width,height); } @@ -114,33 +114,33 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap::fromImage(image); } -QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const { return mFontDb; } -QPlatformClipboard * QTestLiteIntegration::clipboard() const +QPlatformClipboard * QXlibIntegration::clipboard() const { //Use lazy init since clipboard needs QTestliteScreen if (!mClipboard) { - QTestLiteIntegration *that = const_cast<QTestLiteIntegration *>(this); - that->mClipboard = new QTestLiteClipboard(mPrimaryScreen); + QXlibIntegration *that = const_cast<QXlibIntegration *>(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); } return mClipboard; } -bool QTestLiteIntegration::hasOpenGL() const +bool QXlibIntegration::hasOpenGL() const { #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - QTestLiteScreen *screen = static_cast<const QTestLiteScreen *>(mScreens.at(0)); + QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); return glXQueryExtension(screen->display(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; static bool wasEglInitialized = false; if (!eglHasbeenInitialized) { eglHasbeenInitialized = true; - const QTestLiteScreen *screen = static_cast<const QTestLiteScreen *>(mScreens.at(0)); + const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); EGLDisplay disp = eglGetDisplay(screen->display()); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 320cf00..c3125b8 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE -class QTestLiteScreen; +class QXlibScreen; -class QTestLiteIntegration : public QPlatformIntegration +class QXlibIntegration : public QPlatformIntegration { public: - QTestLiteIntegration(bool useOpenGL = false); + QXlibIntegration(bool useOpenGL = false); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -74,7 +74,7 @@ public: private: bool mUseOpenGL; - QTestLiteScreen *mPrimaryScreen; + QXlibScreen *mPrimaryScreen; QList<QPlatformScreen *> mScreens; QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index 5b4ebd7..fb0cf2e 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -740,7 +740,7 @@ static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) return QChar(0x0); } -Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) { Qt::KeyboardModifiers ret = 0; if (s & ShiftMask) @@ -756,7 +756,7 @@ Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) return ret; } -void QTestLiteKeyboard::setMask(KeySym sym, uint mask) +void QXlibKeyboard::setMask(KeySym sym, uint mask) { if (m_alt_mask == 0 && m_meta_mask != mask @@ -800,7 +800,7 @@ void QTestLiteKeyboard::setMask(KeySym sym, uint mask) } } -int QTestLiteKeyboard::translateKeySym(uint key) const +int QXlibKeyboard::translateKeySym(uint key) const { int code = -1; int i = 0; // any other keys @@ -822,7 +822,7 @@ int QTestLiteKeyboard::translateKeySym(uint key) const return code; } -QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count) { @@ -939,7 +939,7 @@ QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, return text; } -QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) : m_screen(screen) , m_alt_mask(0) , m_super_mask(0) @@ -949,7 +949,7 @@ QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) changeLayout(); } -void QTestLiteKeyboard::changeLayout() +void QXlibKeyboard::changeLayout() { XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { @@ -986,7 +986,7 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) } } -void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) { int qtcode = 0; Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h index 6873a09..98df4e1 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.h @@ -44,10 +44,10 @@ #include "qtestliteintegration.h" -class QTestLiteKeyboard +class QXlibKeyboard { public: - QTestLiteKeyboard(QTestLiteScreen *screen); + QXlibKeyboard(QXlibScreen *screen); void changeLayout(); @@ -63,7 +63,7 @@ private: int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; uint m_alt_mask; uint m_super_mask; diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp index c509991..5335ae9 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ b/src/plugins/platforms/testlite/qtestlitemime.cpp @@ -48,22 +48,22 @@ #include <QtGui/QImageWriter> #include <QtCore/QBuffer> -QTestLiteMime::QTestLiteMime() +QXlibMime::QXlibMime() : QInternalMimeData() { } -QTestLiteMime::~QTestLiteMime() +QXlibMime::~QXlibMime() {} -QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) +QString QXlibMime::mimeAtomToString(Display *display, Atom a) { if (!a) return 0; - if (a == XA_STRING || a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) { + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { return "text/plain"; // some Xdnd clients are dumb } char *atom = XGetAtomName(display, a); @@ -72,14 +72,14 @@ QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) return result; } -Atom QTestLiteMime::mimeStringToAtom(Display *display, const QString &mimeType) +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) { if (mimeType.isEmpty()) return 0; return XInternAtom(display, mimeType.toLatin1().constData(), False); } -QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) { QStringList formats; if (a) { @@ -87,10 +87,10 @@ QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) formats.append(atomName); // special cases for string type - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) formats.append(QLatin1String("text/plain")); // special cases for uris @@ -104,7 +104,7 @@ QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) return formats; } -bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) { bool ret = false; *atomFormat = a; @@ -116,27 +116,27 @@ bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeDat *dataFormat = 16; ret = true; } else { - if ((a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)){ + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); ret = true; } else if (a == XA_STRING) { *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); ret = true; - } else if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { // the ICCCM states that TEXT and COMPOUND_TEXT are in the // encoding of choice, so we choose the encoding of the locale QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); char *list[] = { strData.data(), NULL }; - XICCEncodingStyle style = (a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) ? XCompoundTextStyle : XStdICCTextStyle; XTextProperty textprop; if (list[0] != NULL @@ -165,17 +165,17 @@ bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeDat return ret && data != 0; } -QList<Atom> QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &format) +QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) { QList<Atom> atoms; atoms.append(mimeStringToAtom(display, format)); // special cases for strings if (format == QLatin1String("text/plain")) { - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)); + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); atoms.append(XA_STRING); - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::TEXT)); - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); } // special cases for uris @@ -192,7 +192,7 @@ QList<Atom> QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &f return atoms; } -QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) { QString atomName = mimeAtomToString(display,a); if (atomName == format) @@ -212,12 +212,12 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt // special cases for string types if (format == QLatin1String("text/plain")) { - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) return QString::fromUtf8(data); if (a == XA_STRING) return QString::fromLatin1(data); - if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) // #### might be wrong for COMPUND_TEXT return QString::fromLocal8Bit(data, data.size()); } @@ -251,7 +251,7 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QTestLiteStatic::qimageFromXImage(ximg); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); XDestroyImage(ximg); QImageWriter imageWriter; @@ -266,18 +266,18 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt return QVariant(); } -Atom QTestLiteMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) { requestedEncoding->clear(); // find matches for string types if (format == QLatin1String("text/plain")) { - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING))) - return QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING); - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT))) - return QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT); - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::TEXT))) - return QTestLiteStatic::atom(QTestLiteStatic::TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); if (atoms.contains(XA_STRING)) return XA_STRING; } diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h index f11070f..6a70ea4 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.h +++ b/src/plugins/platforms/testlite/qtestlitemime.h @@ -49,11 +49,11 @@ #include "qtestliteintegration.h" #include "qtestliteclipboard.h" -class QTestLiteMime : public QInternalMimeData { +class QXlibMime : public QInternalMimeData { Q_OBJECT public: - QTestLiteMime(); - ~QTestLiteMime(); + QXlibMime(); + ~QXlibMime(); static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); static QString mimeAtomToString(Display *display, Atom a); diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index c211ee6..714c17b 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -188,7 +188,7 @@ qDebug() << "qt_x_errhandler" << err->error_code; return 0; } -QTestLiteScreen::QTestLiteScreen() +QXlibScreen::QXlibScreen() : mFormat(QImage::Format_RGB32) { char *display_name = getenv("DISPLAY"); @@ -228,11 +228,11 @@ QTestLiteScreen::QTestLiteScreen() QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - mCursor = new QTestLiteCursor(this); - mKeyboard = new QTestLiteKeyboard(this); + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); } -QTestLiteScreen::~QTestLiteScreen() +QXlibScreen::~QXlibScreen() { delete mCursor; XCloseDisplay(mDisplay); @@ -245,17 +245,17 @@ QTestLiteScreen::~QTestLiteScreen() #undef KeyRelease #endif -bool QTestLiteScreen::handleEvent(XEvent *xe) +bool QXlibScreen::handleEvent(XEvent *xe) { int quit = false; - QTestLiteWindow *platformWindow = 0; + QXlibWindow *platformWindow = 0; QWidget *widget = QWidget::find(xe->xany.window); if (widget) { - platformWindow = static_cast<QTestLiteWindow *>(widget->platformWindow()); + platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); } - Atom wmProtocolsAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); switch (xe->type) { case ClientMessage: @@ -346,14 +346,14 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) { - Atom clipboard = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY || e->xselectionrequest.selection == clipboard)) || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY || e->xselectionclear.selection == clipboard))); } -bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) { QElapsedTimer timer; timer.start(); @@ -377,7 +377,7 @@ bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, return false; } -void QTestLiteScreen::eventDispatcher() +void QXlibScreen::eventDispatcher() { ulong marker = XNextRequest(mDisplay); // int i = 0; @@ -402,7 +402,7 @@ void QTestLiteScreen::eventDispatcher() } } -QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) { if (w == 0 || h ==0) return QImage(); @@ -437,31 +437,31 @@ QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) return result; } -QTestLiteScreen * QTestLiteScreen::testLiteScreenForWidget(QWidget *widget) +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) { QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QTestLiteScreen *>(platformScreen); + return static_cast<QXlibScreen *>(platformScreen); } -Display * QTestLiteScreen::display() const +Display * QXlibScreen::display() const { return mDisplay; } -int QTestLiteScreen::xScreenNumber() const +int QXlibScreen::xScreenNumber() const { return mScreen; } -QTestLiteKeyboard * QTestLiteScreen::keyboard() const +QXlibKeyboard * QXlibScreen::keyboard() const { return mKeyboard; } -void QTestLiteScreen::handleSelectionRequest(XEvent *event) +void QXlibScreen::handleSelectionRequest(XEvent *event) { QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QTestLiteClipboard *clipboard = static_cast<QTestLiteClipboard *>(integration->clipboard()); + QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); clipboard->handleSelectionRequest(event); } diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h index 860a67c..7e59a59 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ b/src/plugins/platforms/testlite/qtestlitescreen.h @@ -47,16 +47,16 @@ QT_BEGIN_NAMESPACE -class QTestLiteCursor; -class QTestLiteKeyboard; +class QXlibCursor; +class QXlibKeyboard; -class QTestLiteScreen : public QPlatformScreen +class QXlibScreen : public QPlatformScreen { Q_OBJECT public: - QTestLiteScreen(); + QXlibScreen(); - ~QTestLiteScreen(); + ~QXlibScreen(); QString displayName() const { return mDisplayName; } @@ -74,12 +74,12 @@ public: QImage grabWindow(Window window, int x, int y, int w, int h); - static QTestLiteScreen *testLiteScreenForWidget(QWidget *widget); + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); Display *display() const; int xScreenNumber() const; - QTestLiteKeyboard *keyboard() const; + QXlibKeyboard *keyboard() const; public slots: void eventDispatcher(); @@ -92,8 +92,8 @@ private: QSize mPhysicalSize; int mDepth; QImage::Format mFormat; - QTestLiteCursor *mCursor; - QTestLiteKeyboard *mKeyboard; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; Display * mDisplay; int mScreen; diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp index 2c6404d..837636c 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp @@ -261,7 +261,7 @@ public: , xfixes_eventbase(0) , xfixes_errorbase(0) { - QTestLiteScreen *screen = qobject_cast<QTestLiteScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); Q_ASSERT(screen); initializeAllAtoms(screen); @@ -287,7 +287,7 @@ public: return supported; } - Atom atom(QTestLiteStatic::X11Atom atom) + Atom atom(QXlibStatic::X11Atom atom) { return m_allAtoms[atom]; } @@ -351,8 +351,8 @@ public: private: - void initializeAllAtoms(QTestLiteScreen *screen) { - const char *names[QTestLiteStatic::NAtoms]; + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; const char *ptr = x11_atomnames; int i = 0; @@ -363,22 +363,22 @@ private: ++ptr; } - Q_ASSERT(i == QTestLiteStatic::NPredefinedAtoms); + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); settings_atom_name += XDisplayName(qPrintable(screen->displayName())); names[i++] = settings_atom_name; - Q_ASSERT(i == QTestLiteStatic::NAtoms); + Q_ASSERT(i == QXlibStatic::NAtoms); #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); #else - for (i = 0; i < QTestLiteStatic::NAtoms; ++i) + for (i = 0; i < QXlibStatic::NAtoms; ++i) m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); #endif } - void initializeSupportedAtoms(QTestLiteScreen *screen) + void initializeSupportedAtoms(QXlibScreen *screen) { Atom type; int format; @@ -387,7 +387,7 @@ private: unsigned char *data = 0; int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStatic::_NET_SUPPORTED), 0, 0, + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) XFree(data); @@ -398,7 +398,7 @@ private: while (after > 0) { XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStatic::_NET_SUPPORTED), offset, 1024, + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (type == XA_ATOM && format == 32) { @@ -423,7 +423,7 @@ private: } } - void resolveXFixes(QTestLiteScreen *screen) + void resolveXFixes(QXlibScreen *screen) { #ifndef QT_NO_XFIXES // See if Xfixes is supported on the connected display @@ -456,7 +456,7 @@ private: } Atom *m_supportedAtoms; - Atom m_allAtoms[QTestLiteStatic::NAtoms]; + Atom m_allAtoms[QXlibStatic::NAtoms]; #ifndef QT_NO_XFIXES PtrXFixesQueryExtension ptrXFixesQueryExtension; @@ -474,28 +474,28 @@ private: Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); -Atom QTestLiteStatic::atom(QTestLiteStatic::X11Atom atom) +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) { return qTestLiteStaticInfoPrivate()->atom(atom); } -bool QTestLiteStatic::isSupportedByWM(Atom atom) +bool QXlibStatic::isSupportedByWM(Atom atom) { return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); } -bool QTestLiteStatic::useXFixes() +bool QXlibStatic::useXFixes() { return qTestLiteStaticInfoPrivate()->useXFixes(); } -int QTestLiteStatic::xFixesEventBase() +int QXlibStatic::xFixesEventBase() { return qTestLiteStaticInfoPrivate()->xFixesEventBase(); } #ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() { qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); if (!qTestLiteStaticInfoPrivate()->useXFixes()) @@ -504,7 +504,7 @@ PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); } -QImage QTestLiteStatic::qimageFromXImage(XImage *xi) +QImage QXlibStatic::qimageFromXImage(XImage *xi) { return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); } diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h index 0876768..8473ee9 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.h +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.h @@ -231,7 +231,7 @@ enum { #endif -class QTestLiteStatic +class QXlibStatic { public: enum X11Atom { diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index b7c5e99..0f11a81 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -68,10 +68,10 @@ QT_BEGIN_NAMESPACE -QTestLiteWindow::QTestLiteWindow(QWidget *window) +QXlibWindow::QXlibWindow(QWidget *window) : QPlatformWindow(window) , mGLContext(0) - , mScreen(QTestLiteScreen::testLiteScreenForWidget(window)) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) { int x = window->x(); int y = window->y(); @@ -88,7 +88,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); @@ -133,20 +133,20 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) Atom protocols[5]; int n = 0; - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_PING); // support _NET_WM_PING protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol #ifndef QT_NO_XSYNC - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol #endif // QT_NO_XSYNC if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_CONTEXT_HELP); + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); XSetWMProtocols(mScreen->display(), x_window, protocols, n); } -QTestLiteWindow::~QTestLiteWindow() +QXlibWindow::~QXlibWindow() { #ifdef MYX11_DEBUG qDebug() << "~QTestLiteWindow" << hex << x_window; @@ -172,7 +172,7 @@ static Qt::MouseButtons translateMouseButtons(int s) -void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) { static QPoint mousePoint; @@ -215,68 +215,68 @@ void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) mousePoint = QPoint(e->x_root, e->y_root); } -void QTestLiteWindow::handleCloseEvent() +void QXlibWindow::handleCloseEvent() { QWindowSystemInterface::handleCloseEvent(widget()); } -void QTestLiteWindow::handleEnterEvent() +void QXlibWindow::handleEnterEvent() { QWindowSystemInterface::handleEnterEvent(widget()); } -void QTestLiteWindow::handleLeaveEvent() +void QXlibWindow::handleLeaveEvent() { QWindowSystemInterface::handleLeaveEvent(widget()); } -void QTestLiteWindow::handleFocusInEvent() +void QXlibWindow::handleFocusInEvent() { QWindowSystemInterface::handleWindowActivated(widget()); } -void QTestLiteWindow::handleFocusOutEvent() +void QXlibWindow::handleFocusOutEvent() { QWindowSystemInterface::handleWindowActivated(0); } -void QTestLiteWindow::setGeometry(const QRect &rect) +void QXlibWindow::setGeometry(const QRect &rect) { XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } -Qt::WindowFlags QTestLiteWindow::windowFlags() const +Qt::WindowFlags QXlibWindow::windowFlags() const { return mWindowFlags; } -WId QTestLiteWindow::winId() const +WId QXlibWindow::winId() const { return x_window; } -void QTestLiteWindow::setParent(const QPlatformWindow *window) +void QXlibWindow::setParent(const QPlatformWindow *window) { QPoint topLeft = geometry().topLeft(); XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); } -void QTestLiteWindow::raise() +void QXlibWindow::raise() { XRaiseWindow(mScreen->display(), x_window); } -void QTestLiteWindow::lower() +void QXlibWindow::lower() { XLowerWindow(mScreen->display(), x_window); } -void QTestLiteWindow::setWindowTitle(const QString &title) +void QXlibWindow::setWindowTitle(const QString &title) { QByteArray ba = title.toLatin1(); //We're not making a general solution here... XTextProperty windowName; @@ -288,7 +288,7 @@ void QTestLiteWindow::setWindowTitle(const QString &title) XSetWMName(mScreen->display(), x_window, &windowName); } -GC QTestLiteWindow::createGC() +GC QXlibWindow::createGC() { GC gc; @@ -299,7 +299,7 @@ GC QTestLiteWindow::createGC() return gc; } -void QTestLiteWindow::paintEvent() +void QXlibWindow::paintEvent() { #ifdef MYX11_DEBUG // qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; @@ -309,12 +309,12 @@ void QTestLiteWindow::paintEvent() surface->flush(widget(), widget()->geometry(), QPoint()); } -void QTestLiteWindow::requestActivateWindow() +void QXlibWindow::requestActivateWindow() { XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); } -void QTestLiteWindow::resizeEvent(XConfigureEvent *e) +void QXlibWindow::resizeEvent(XConfigureEvent *e) { int xpos = geometry().x(); int ypos = geometry().y(); @@ -333,7 +333,7 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) QWindowSystemInterface::handleGeometryChange(widget(), newRect); } -void QTestLiteWindow::mousePressEvent(XButtonEvent *e) +void QXlibWindow::mousePressEvent(XButtonEvent *e) { static long prevTime = 0; static Window prevWindow; @@ -356,22 +356,22 @@ void QTestLiteWindow::mousePressEvent(XButtonEvent *e) handleMouseEvent(type, e); } -QtMWMHints QTestLiteWindow::getMWMHints() const +QXlibMWMHints QXlibWindow::getMWMHints() const { - QtMWMHints mwmhints; + QXlibMWMHints mwmhints; Atom type; int format; ulong nitems, bytesLeft; uchar *data = 0; - Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) && (type == atomForMotifWmHints && format == 32 && nitems >= 5)) { - mwmhints = *(reinterpret_cast<QtMWMHints *>(data)); + mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); } else { mwmhints.flags = 0L; mwmhints.functions = MWM_FUNC_ALL; @@ -386,9 +386,9 @@ QtMWMHints QTestLiteWindow::getMWMHints() const return mwmhints; } -void QTestLiteWindow::setMWMHints(const QtMWMHints &mwmhints) +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) { - Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { XChangeProperty(mScreen->display(), x_window, atomForMotifWmHints, atomForMotifWmHints, 32, @@ -411,7 +411,7 @@ static inline bool isTransient(const QWidget *w) && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); } -QVector<Atom> QTestLiteWindow::getNetWmState() const +QVector<Atom> QXlibWindow::getNetWmState() const { QVector<Atom> returnValue; @@ -421,7 +421,7 @@ QVector<Atom> QTestLiteWindow::getNetWmState() const ulong propertyLength; ulong bytesLeft; uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, 0, + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) == Success && actualType == XA_ATOM && actualFormat == 32) { @@ -429,7 +429,7 @@ QVector<Atom> QTestLiteWindow::getNetWmState() const XFree((char*) propertyData); // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) != Success) { returnValue.clear(); @@ -447,7 +447,7 @@ QVector<Atom> QTestLiteWindow::getNetWmState() const return returnValue; } -Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) { // Q_ASSERT(flags & Qt::Window); mWindowFlags = flags; @@ -478,7 +478,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) XSetWindowAttributes wsa; - QtMWMHints mwmhints; + QXlibMWMHints mwmhints; mwmhints.flags = 0L; mwmhints.functions = 0L; mwmhints.decorations = 0; @@ -567,35 +567,35 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) if (flags & Qt::WindowStaysOnTopHint) { if (flags & Qt::WindowStaysOnBottomHint) qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); } if (widget()->isFullScreen()) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); } if (widget()->isMaximized()) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); } if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); } if (!netWmState.isEmpty()) { XChangeProperty(mScreen->display(), x_window, - QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, (unsigned char *) netWmState.data(), netWmState.size()); } else { - XDeleteProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE)); + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); } //##### only if initializeWindow??? @@ -620,7 +620,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) return flags; } -void QTestLiteWindow::setVisible(bool visible) +void QXlibWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; @@ -630,7 +630,7 @@ void QTestLiteWindow::setVisible(bool visible) if (widget()->parentWidget()) { QWidget *widgetParent = widget()->parentWidget()->window(); if (widgetParent && widgetParent->platformWindow()) { - QTestLiteWindow *parentWidnow = static_cast<QTestLiteWindow *>(widgetParent->platformWindow()); + QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); parentXWindow = parentWidnow->x_window; } } @@ -646,18 +646,18 @@ void QTestLiteWindow::setVisible(bool visible) } } -void QTestLiteWindow::setCursor(const Cursor &cursor) +void QXlibWindow::setCursor(const Cursor &cursor) { XDefineCursor(mScreen->display(), x_window, cursor); XFlush(mScreen->display()); } -QPlatformGLContext *QTestLiteWindow::glContext() const +QPlatformGLContext *QXlibWindow::glContext() const { if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) return 0; if (!mGLContext) { - QTestLiteWindow *that = const_cast<QTestLiteWindow *>(this); + QXlibWindow *that = const_cast<QXlibWindow *>(this); #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); @@ -680,17 +680,17 @@ QPlatformGLContext *QTestLiteWindow::glContext() const return mGLContext; } -Window QTestLiteWindow::xWindow() const +Window QXlibWindow::xWindow() const { return x_window; } -GC QTestLiteWindow::graphicsContext() const +GC QXlibWindow::graphicsContext() const { return gc; } -void QTestLiteWindow::doSizeHints() +void QXlibWindow::doSizeHints() { Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); XSizeHints s; @@ -709,7 +709,7 @@ void QTestLiteWindow::doSizeHints() XSetWMNormalHints(mScreen->display(), x_window, &s); } -QPlatformWindowFormat QTestLiteWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const { // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, // so this might be not what we want to do :) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 2ca7e10..ccf6867 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -50,7 +50,7 @@ #include <QObject> #include <QImage> -struct QtMWMHints { +struct QXlibMWMHints { ulong flags, functions, decorations; long input_mode; ulong status; @@ -83,11 +83,11 @@ enum { MWM_INPUT_FULL_APPLICATION_MODAL = 3L }; -class QTestLiteWindow : public QPlatformWindow +class QXlibWindow : public QPlatformWindow { public: - QTestLiteWindow(QWidget *window); - ~QTestLiteWindow(); + QXlibWindow(QWidget *window); + ~QXlibWindow(); void mousePressEvent(XButtonEvent*); @@ -124,8 +124,8 @@ public: protected: QVector<Atom> getNetWmState() const; - void setMWMHints(const QtMWMHints &mwmhints); - QtMWMHints getMWMHints() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; void doSizeHints(); @@ -138,7 +138,7 @@ private: GC createGC(); QPlatformGLContext *mGLContext; - QTestLiteScreen *mScreen; + QXlibScreen *mScreen; Qt::WindowFlags mWindowFlags; }; diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index ced964a..088730d 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -55,9 +55,9 @@ QT_BEGIN_NAMESPACE -struct MyShmImageInfo { - MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~MyShmImageInfo() { destroy(); } +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } void destroy(); @@ -68,7 +68,7 @@ struct MyShmImageInfo { #ifndef DONT_USE_MIT_SHM -void MyShmImageInfo::destroy() +void QXlibShmImageInfo::destroy() { XShmDetach (display, &shminfo); XDestroyImage (image); @@ -77,18 +77,18 @@ void MyShmImageInfo::destroy() } #endif -void QTestLiteWindowSurface::resizeShmImage(int width, int height) +void QXlibWindowSurface::resizeShmImage(int width, int height) { #ifdef DONT_USE_MIT_SHM shm_img = QImage(width, height, QImage::Format_RGB32); #else - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(window()); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); if (image_info) image_info->destroy(); else - image_info = new MyShmImageInfo(screen->display()); + image_info = new QXlibShmImageInfo(screen->display()); Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); @@ -115,37 +115,37 @@ void QTestLiteWindowSurface::resizeShmImage(int width, int height) } -void QTestLiteWindowSurface::resizeBuffer(QSize s) +void QXlibWindowSurface::resizeBuffer(QSize s) { if (shm_img.size() != s) resizeShmImage(s.width(), s.height()); } -QSize QTestLiteWindowSurface::bufferSize() const +QSize QXlibWindowSurface::bufferSize() const { return shm_img.size(); } -QTestLiteWindowSurface::QTestLiteWindowSurface (QWidget *window) +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) : QWindowSurface(window), painted(false), image_info(0) { - xw = static_cast<QTestLiteWindow*>(window->platformWindow()); + xw = static_cast<QXlibWindow*>(window->platformWindow()); // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; } -QTestLiteWindowSurface::~QTestLiteWindowSurface() +QXlibWindowSurface::~QXlibWindowSurface() { delete image_info; } -QPaintDevice *QTestLiteWindowSurface::paintDevice() +QPaintDevice *QXlibWindowSurface::paintDevice() { return &shm_img; } -void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(region); @@ -154,7 +154,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const if (!painted) return; - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); GC gc = xw->graphicsContext(); Window window = xw->xWindow(); #ifdef DONT_USE_MIT_SHM @@ -197,7 +197,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) { if (shm_img.isNull()) return false; @@ -210,13 +210,13 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) } -void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) +void QXlibWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); resizeBuffer(size()); } -void QTestLiteWindowSurface::endPaint(const QRegion ®ion) +void QXlibWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); painted = true; //there is content in the buffer diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h index ca900e5..12b4c60 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.h +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.h @@ -47,21 +47,19 @@ QT_BEGIN_NAMESPACE -class QTestLiteWindow; -class QTestLiteIntegration; -class QTestLiteScreen; -class MyShmImageInfo; +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; -class QTestLiteWindowSurface : public QWindowSurface +class QXlibWindowSurface : public QWindowSurface { public: - QTestLiteWindowSurface (QWidget *window); - ~QTestLiteWindowSurface(); + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); QPaintDevice *paintDevice(); -// void flush(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); -// void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); @@ -76,9 +74,9 @@ private: void resizeShmImage(int width, int height); QImage shm_img; - MyShmImageInfo *image_info; + QXlibShmImageInfo *image_info; - QTestLiteWindow *xw; + QXlibWindow *xw; }; |