diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-02-10 10:23:15 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-10 16:24:47 +0100 |
commit | 38257651b7e2085ae66c1c67ee9e33e93587b573 (patch) | |
tree | 28a27f3a1f1faf410e37182ad7e30597745df78a /src/plugins | |
parent | 7dca7c3c571ec595b792bbc2d2d448aac587886a (diff) |
Properly read back the actual format in xcb and xlib plugins.
Change-Id: Iccef2c4a87863b93914b84edf3a6015dad5e512a
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 12 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qglxintegration.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibwindow.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qxlibwindow.h | 2 |
6 files changed, 18 insertions, 11 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 6ada127beb..0144caae3d 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -64,6 +64,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat : QPlatformOpenGLContext() , m_screen(screen) , m_context(0) + , m_format(format) { m_shareContext = 0; if (share) @@ -82,7 +83,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat if (m_context) m_format = qglx_surfaceFormatFromGLXFBConfig(DISPLAY_FROM_XCB(screen), config, m_context); } else { - XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen), screen->screenNumber(), format); + XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen), screen->screenNumber(), &m_format); if (!visualInfo) qFatal("Could not initialize GLX"); m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, m_shareContext, true); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 959209dd33..4f05c4cf5a 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -201,19 +201,21 @@ void QXcbWindow::create() if (parent()) xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window(); - m_requestedFormat = window()->format(); + m_format = window()->requestedFormat(); #if (defined(XCB_USE_GLX) || defined(XCB_USE_EGL)) && defined(XCB_USE_XLIB) if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) - || window()->format().hasAlpha()) + || m_format.hasAlpha()) { #if defined(XCB_USE_GLX) - XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window()->format()); + XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber(), &m_format); if (!visualInfo) qFatal("Could not initialize GLX"); #elif defined(XCB_USE_EGL) EGLDisplay eglDisplay = connection()->egl_display(); - EGLConfig eglConfig = q_configFromGLFormat(eglDisplay, window()->format(), true); + EGLConfig eglConfig = q_configFromGLFormat(eglDisplay, m_format, true); + m_format = q_glFormatFromConfig(eglDisplay, eglConfig); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this), eglDisplay, eglConfig); XVisualInfo visualInfoTemplate; @@ -1167,7 +1169,7 @@ void QXcbWindow::setOrientation(Qt::ScreenOrientation orientation) QSurfaceFormat QXcbWindow::format() const { // ### return actual format - return m_requestedFormat; + return m_format; } #if defined(XCB_USE_EGL) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 3cbf9e7e0d..365c8b0549 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -155,7 +155,7 @@ private: bool m_transparent; xcb_window_t m_netWmUserTimeWindow; - QSurfaceFormat m_requestedFormat; + QSurfaceFormat m_format; mutable bool m_dirtyFrameMargins; mutable QMargins m_frameMargins; diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index e78689374a..51621408b9 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -65,6 +65,7 @@ QGLXContext::QGLXContext(QXlibScreen *screen, const QSurfaceFormat &format, QPla : QPlatformOpenGLContext() , m_screen(screen) , m_context(0) + , m_windowFormat(format) { GLXContext shareGlxContext = 0; if (share) @@ -77,7 +78,7 @@ QGLXContext::QGLXContext(QXlibScreen *screen, const QSurfaceFormat &format, QPla m_context = glXCreateNewContext(xDisplay,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); m_windowFormat = qglx_surfaceFormatFromGLXFBConfig(xDisplay,config,m_context); } else { - XVisualInfo *visualInfo = qglx_findVisualInfo(xDisplay, screen->xScreenNumber(), format); + XVisualInfo *visualInfo = qglx_findVisualInfo(xDisplay, screen->xScreenNumber(), &m_windowFormat); if (!visualInfo) qFatal("Could not initialize GLX"); m_context = glXCreateContext(xDisplay, visualInfo, shareGlxContext, true); diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 635caf81f8..94c4332e65 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -82,11 +82,12 @@ QXlibWindow::QXlibWindow(QWindow *window) int w = window->width(); int h = window->height(); + mSurfaceFormat = window->requestedFormat(); + #if !defined(QT_NO_OPENGL) if(window->surfaceType() == QWindow::OpenGLSurface) { #if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber(), - window->format()); + XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber(), &mSurfaceFormat); if (!visualInfo) qFatal("Could not initialize GLX"); #else @@ -694,7 +695,7 @@ void QXlibWindow::setCursor(const Cursor &cursor) QSurfaceFormat QXlibWindow::format() const { - return window()->format(); + return mSurfaceFormat; } diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index 8287f3a8a2..6b9e2d63bd 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -143,6 +143,8 @@ private: QImage::Format mFormat; Visual* mVisual; + QSurfaceFormat mSurfaceFormat; + GC createGC(); QPlatformOpenGLContext *mGLContext; |