diff options
-rw-r--r-- | src/gui/kernel/kernel.pri | 3 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_qpa.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformglcontext_qpa.cpp | 54 | ||||
-rw-r--r-- | src/gui/kernel/qplatformglcontext_qpa.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_qpa.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindowformat_qpa.cpp | 37 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindowformat_qpa.h | 17 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_qpa.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl_qpa.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qglxintegration.cpp | 133 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qglxintegration.h | 18 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestlitewindow.cpp | 43 |
13 files changed, 247 insertions, 80 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 43b1ab8..9941b1b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -241,7 +241,8 @@ qpa { kernel/qplatformintegrationplugin_qpa.cpp \ kernel/qplatformwindow_qpa.cpp \ kernel/qplatformwindowformat_qpa.cpp \ - kernel/qplatformeventloopintegration_qpa.cpp + kernel/qplatformeventloopintegration_qpa.cpp \ + kernel/qplatformglcontext_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 26ae82d..e5b5396 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -510,7 +510,7 @@ void qt_init(QApplicationPrivate *priv, int type) } QList<QByteArray> pluginList; - QString platformName = qgetenv("QT_QPA_PLATFORM"); + QString platformName = QLatin1String(qgetenv("QT_QPA_PLATFORM")); // Get command line params @@ -526,7 +526,7 @@ void qt_init(QApplicationPrivate *priv, int type) appFont = argv[i]; } else if (arg == "-platform") { if (++i < argc) - platformName = argv[i]; + platformName = QLatin1String(argv[i]); } else if (arg == "-plugin") { if (++i < argc) pluginList << argv[i]; diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp new file mode 100644 index 0000000..a2ffbf3 --- /dev/null +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformglcontext_qpa.h" + +static QPlatformGLContext *staticSharedContext = 0; + +void QPlatformGLContext::setDefaultSharedContext(QPlatformGLContext *sharedContext) +{ + staticSharedContext = sharedContext; +} + +QPlatformGLContext *QPlatformGLContext::defaultSharedContext() +{ + return staticSharedContext; +} diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index dcfd54c..9f3bfb3 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -58,6 +58,11 @@ public: virtual void swapBuffers() = 0; virtual void* getProcAddress(const QString& procName) = 0; + static QPlatformGLContext *defaultSharedContext(); + +protected: + static void setDefaultSharedContext(QPlatformGLContext *sharedContext); + }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index f6f10a8..9f7367e 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -73,10 +73,12 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; -// Experimental +// Experimental in mainthread eventloop integration +// This should only be used if it is only possible to do window system event processing in +// the gui thread. All of the functions in QWindowSystemInterface are thread safe. virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; -// should it be hasGLContext? +//jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index bc234ab..9d86948 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -50,7 +50,8 @@ public: : ref(1) , opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer | QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering - | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions) + | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions + | QPlatformWindowFormat::UseDefaultSharedContext) , depthSize(-1) , accumSize(-1) , stencilSize(-1) @@ -60,9 +61,8 @@ public: , alphaSize(-1) , numSamples(-1) , swapInterval(-1) - , majorVersion(1) - , minorVersion(0) , windowApi(QPlatformWindowFormat::Raster) + , sharedContext(0) { } @@ -78,9 +78,8 @@ public: alphaSize(other->alphaSize), numSamples(other->numSamples), swapInterval(other->swapInterval), - majorVersion(other->majorVersion), - minorVersion(other->minorVersion), - windowApi(other->windowApi) + windowApi(other->windowApi), + sharedContext(other->sharedContext) { } QAtomicInt ref; @@ -94,9 +93,8 @@ public: int alphaSize; int numSamples; int swapInterval; - int majorVersion; - int minorVersion; QPlatformWindowFormat::WindowApi windowApi; + QPlatformGLContext *sharedContext; }; /*! @@ -519,6 +517,16 @@ void QPlatformWindowFormat::setSampleBuffers(bool enable) setOption(enable ? QPlatformWindowFormat::SampleBuffers : QPlatformWindowFormat::NoSampleBuffers); } +void QPlatformWindowFormat::setUseDefaultSharedContext(bool enable) +{ + if (enable) { + setOption(QPlatformWindowFormat::UseDefaultSharedContext); + d->sharedContext = 0; + } else { + setOption(QPlatformWindowFormat::NoDefaultSharedContext); + } +} + /*! Returns the number of samples per pixel when multisampling is enabled. By default, the highest number of samples that is @@ -595,6 +603,17 @@ QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const return d->windowApi; } +void QPlatformWindowFormat::setSharedContext(QPlatformGLContext *context) +{ + setUseDefaultSharedContext(false); + d->sharedContext = context; +} + +QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const +{ + return d->sharedContext; +} + ///*! // \fn bool QGLFormat::hasOverlay() const @@ -952,8 +971,6 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval - && a.d->majorVersion == b.d->majorVersion - && a.d->minorVersion == b.d->minorVersion && a.d->windowApi == b.d->windowApi); } diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 3c5f907..37e628d 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -64,6 +64,7 @@ public: HasOverlay = 0x0100, SampleBuffers = 0x0200, DeprecatedFunctions = 0x0400, + UseDefaultSharedContext = 0x0800, SingleBuffer = DoubleBuffer << 16, NoDepthBuffer = DepthBuffer << 16, ColorIndex = Rgba << 16, @@ -74,7 +75,9 @@ public: IndirectRendering = DirectRendering << 16, NoOverlay = HasOverlay << 16, NoSampleBuffers = SampleBuffers << 16, - NoDeprecatedFunctions = DeprecatedFunctions << 16 + NoDeprecatedFunctions = DeprecatedFunctions << 16, + NoDefaultSharedContext = UseDefaultSharedContext << 16 + }; Q_DECLARE_FLAGS(FormatOptions, FormatOption) @@ -123,6 +126,9 @@ public: void setWindowApi(QPlatformWindowFormat::WindowApi api); WindowApi windowApi() const; + void setSharedContext(QPlatformGLContext *context); + QPlatformGLContext *sharedGLContext() const; + bool doubleBuffer() const; void setDoubleBuffer(bool enable); bool depth() const; @@ -139,6 +145,8 @@ public: void setStereo(bool enable); bool directRendering() const; void setDirectRendering(bool enable); + bool useDefaultSharedContext() const; + void setUseDefaultSharedContext(bool enable); // bool hasOverlay() const; // void setOverlay(bool enable); @@ -148,9 +156,6 @@ public: static QPlatformWindowFormat defaultFormat(); static void setDefaultFormat(const QPlatformWindowFormat& f); -// static QPlatformWindowFormat defaultOverlayFormat(); -// static void setDefaultOverlayFormat(const QPlatformWindowFormat& f); - private: QPlatformWindowFormatPrivate *d; @@ -215,6 +220,10 @@ inline bool QPlatformWindowFormat::sampleBuffers() const return testOption(QPlatformWindowFormat::SampleBuffers); } +inline bool QPlatformWindowFormat::useDefaultSharedContext() const +{ + return testOption(QPlatformWindowFormat::UseDefaultSharedContext); +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 958c476..c236c60 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2410,7 +2410,9 @@ WId QWidget::winId() const qDebug() << "QWidget::winId: creating native window for" << this; #endif QWidget *that = const_cast<QWidget*>(this); +#ifndef Q_WS_QPA that->setAttribute(Qt::WA_NativeWindow); +#endif that->d_func()->createWinId(); return that->data->winid; } diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 1b7d9d2..104c529 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -182,7 +182,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); // Reparenting toplevel to child - if (!(f&Qt::Window) && (oldFlags&Qt::Window)) { + if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) { //qDebug() << "setParent_sys() change from toplevel"; q->destroy(); } diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index aa124fe..0fc885c 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -66,6 +66,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) }else { QWidget *widget = static_cast<QWidget *>(d->paintDevice); if (!widget->platformWindow()){ + QPlatformWindowFormat format = widget->platformWindowFormat(); + format.setWindowApi(QPlatformWindowFormat::OpenGL); + widget->setPlatformWindowFormat(format); widget->winId();//make window } d->platformContext = widget->platformWindow()->glContext(); diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index ba89dbd..4d807b0 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -57,8 +57,12 @@ QT_BEGIN_NAMESPACE -GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, int drawableType) +QMutex QGLXGLContext::m_defaultSharedContextMutex(QMutex::Recursive); + +QVector<int> QGLXGLContext::buildSpec(const QPlatformWindowFormat &format) { + QVector<int> spec(48); + int i = 0; int depthSize = 0; int stencilSize = 0; int sampleSize = 0; @@ -70,33 +74,30 @@ GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, i if (format.sampleBuffers()) sampleSize = (format.samples() == -1) ? 1 : format.samples(); - int configAttribs[] = { - GLX_DRAWABLE_TYPE, drawableType, - GLX_LEVEL, format.plane(), - GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DOUBLEBUFFER, format.doubleBuffer() ? True : False, - GLX_STEREO, format.stereo() ? True : False, - - GLX_DEPTH_SIZE, depthSize, - GLX_STENCIL_SIZE, stencilSize, - GLX_SAMPLE_BUFFERS_ARB, sampleSize, - - GLX_RED_SIZE, (format.redBufferSize() == -1) ? 1 : format.redBufferSize(), - GLX_GREEN_SIZE, (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(), - GLX_BLUE_SIZE, (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(), - GLX_ALPHA_SIZE, (format.alphaBufferSize() == -1) ? 0 : format.alphaBufferSize(), - - GLX_ACCUM_RED_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - GLX_ACCUM_GREEN_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - GLX_ACCUM_BLUE_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - GLX_ACCUM_ALPHA_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - XNone - }; + spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; - GLXFBConfig *configs; - int configCount = 0; - configs = glXChooseFBConfig(xd->display, xd->screen, configAttribs, &configCount); + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = depthSize; + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = stencilSize; + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; spec[i++] = sampleSize; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 0 : format.alphaBufferSize(); + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = XNone; + return spec; +} + +GLXFBConfig QGLXGLContext::findConfig(const GLXFBConfig *configs, int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd) +{ if (!configs) return 0; @@ -121,31 +122,60 @@ GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, i } else break; // Just choose the first in the list if there's no alpha requested } - - // TODO: Populate the QGLFormat with the values of the GLXFBConfig - - XFree(configs); return chosenConfig; } -QGLXGLContext::QGLXGLContext(WId winId, MyDisplay *xd, QGLFormat& format, QPlatformGLContext* shareContext) +QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_xd(xd) - , m_drawable((Drawable)winId) - , m_config(0) + , m_drawable((Drawable)window) , m_context(0) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(xd); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } + + QPlatformGLContext *sharePlatformContext; + if (format.useDefaultSharedContext()) { + sharePlatformContext = QPlatformGLContext::defaultSharedContext(); + } else { + sharePlatformContext = format.sharedGLContext(); + } GLXContext shareGlxContext = 0; - if (shareContext) - shareGlxContext = static_cast<QGLXGLContext*>(shareContext)->glxContext(); + if (sharePlatformContext) + shareGlxContext = static_cast<QGLXGLContext*>(sharePlatformContext)->glxContext(); - m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); + QVector<int> spec = buildSpec(format); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + if (confcount) + { + GLXFBConfig config = findConfig(configs,confcount,format,xd); + m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + XFree(configs); + } else { + qFatal("Warning no context created"); + } - m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; #endif +// TODO: Populate the QGLFormat with the values of the GLXFBConfig + +} + +QGLXGLContext::QGLXGLContext(MyDisplay *display, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_xd(display), m_drawable(drawable), m_context(context) +{ + } QGLXGLContext::~QGLXGLContext() @@ -156,6 +186,35 @@ QGLXGLContext::~QGLXGLContext() } } +void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) +{ + int x = 0; + int y = 0; + int w = 3; + int h = 3; + + Window sharedWindow = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); + GLXContext context; + QPlatformWindowFormat format; + QVector<int> spec = buildSpec(format); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + if (confcount) + { + GLXFBConfig config = findConfig(configs,confcount,format,xd); + context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,0,TRUE); + XFree(configs); + QPlatformGLContext *sharedContext = new QGLXGLContext(xd,sharedWindow,context); + QPlatformGLContext::setDefaultSharedContext(sharedContext); + } else { + qFatal("Warning no shared context created"); + } + +} + void QGLXGLContext::makeCurrent() { #ifdef MYX11_DEBUG diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 6d9a216..decbe36 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -42,7 +42,13 @@ #ifndef Q_GLX_CONTEXT_H #define Q_GLX_CONTEXT_H +#include "qtestlitewindow.h" + #include <QtGui/QPlatformGLContext> +#include <QtGui/QPlatformWindowFormat> + +#include <QtCore/QMutex> + #include <GL/glx.h> QT_BEGIN_NAMESPACE @@ -52,7 +58,7 @@ class MyDisplay; class QGLXGLContext : public QPlatformGLContext { public: - QGLXGLContext(WId winId, MyDisplay *xd, QGLFormat& format, QPlatformGLContext* shareContext); + QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format); ~QGLXGLContext(); virtual void makeCurrent(); @@ -61,11 +67,19 @@ public: virtual void* getProcAddress(const QString& procName); GLXContext glxContext() {return m_context;} + + private: + static QVector<int> buildSpec(const QPlatformWindowFormat &format); + static GLXFBConfig findConfig(const GLXFBConfig *configs,int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd); + MyDisplay *m_xd; Drawable m_drawable; - GLXFBConfig m_config; GLXContext m_context; + + QGLXGLContext (MyDisplay *display, Drawable drawable, GLXContext context); + static QMutex m_defaultSharedContextMutex; + static void createDefaultSharedContex(MyDisplay *xd); }; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 0f6c921..f774458 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -84,8 +84,6 @@ static bool seen_badwindow; static Atom wmProtocolsAtom; static Atom wmDeleteWindowAtom; - - class MyX11CursorNode { public: @@ -155,14 +153,26 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration xd = platformIntegration->xd; xd->windowList.append(this); { - int x = 0; - int y = 0; - int w = 300; - int h = 300; //### - - x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), - x, y, w, h, 0 /*border_width*/, - xd->blackPixel(), xd->whitePixel()); + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); + +// int n, i; +// if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL) { +// x_visualInfo = QGLXGLContext::findVisual(window->platformWindowFormat(),xd); + +// XSetWindowAttributes a; +// a.background_pixel = xd->whitePixel(); +// a.border_pixel = xd->blackPixel(); +// x_window = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, +// 0, visualInfo()->depth, InputOutput, visualInfo()->visual, +// CWBackPixel|CWBorderPixel, &a); +// } else { + x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); +// } #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; @@ -187,16 +197,7 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration wmProtocolsAtom, XA_ATOM, 32, PropModeAppend, (unsigned char *) &wmDeleteWindowAtom, 1); - - - setWindowTitle(QLatin1String("Qt Lighthouse")); - currentCursor = -1; - - setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility - - - //xw->windowTL = this; } @@ -209,6 +210,7 @@ QTestLiteWindow::~QTestLiteWindow() XDestroyWindow(xd->display, x_window); xd->windowList.removeAll(this); + delete mGLContext; } @@ -1019,8 +1021,7 @@ QPlatformGLContext *QTestLiteWindow::glContext() QPlatformGLContext *QTestLiteWindow::createGLContext() { - QGLFormat format; - QPlatformGLContext *context = new QGLXGLContext(x_window, xd, format, 0); + QPlatformGLContext *context = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat()); return context; } |