diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-13 08:49:52 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-13 09:45:00 +0200 |
commit | 3ba6c3b7a4261147addc1d7fb06060dae7522691 (patch) | |
tree | cded7ec5f02e5f6ea082110185c6da2e03d514e9 /src/plugins/platforms/xlib | |
parent | 0108e888480e47e65d82d94e10a7c7c910e42d79 (diff) | |
download | qt4-tools-3ba6c3b7a4261147addc1d7fb06060dae7522691.tar.gz |
Remove DefaultSharedContext from Lighthouse API.
QPlatformWindowFormat::setUseDefaultSharedContext was meant as a
convenience, but it adds complexity in the platform plugin
implementation, and can be implemented by the above layers using
QPlatformWindowFormat::setSharedContext.
Reviewed-by: Jørgen Lind
Diffstat (limited to 'src/plugins/platforms/xlib')
-rw-r--r-- | src/plugins/platforms/xlib/qglxintegration.cpp | 44 | ||||
-rw-r--r-- | src/plugins/platforms/xlib/qglxintegration.h | 2 |
2 files changed, 1 insertions, 45 deletions
diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 6746e22fd1..7a0f36dc99 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -61,8 +61,6 @@ QT_BEGIN_NAMESPACE -QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); - QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_screen(screen) @@ -71,20 +69,7 @@ QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWind { const QPlatformGLContext *sharePlatformContext; - if (format.useDefaultSharedContext()) { - if (!QPlatformGLContext::defaultSharedContext()) { - if (m_defaultSharedContextMutex.tryLock()){ - createDefaultSharedContext(screen); - m_defaultSharedContextMutex.unlock(); - } else { - m_defaultSharedContextMutex.lock(); //wait to the the shared context is created - m_defaultSharedContextMutex.unlock(); - } - } - sharePlatformContext = QPlatformGLContext::defaultSharedContext(); - } else { - sharePlatformContext = format.sharedGLContext(); - } + sharePlatformContext = format.sharedGLContext(); GLXContext shareGlxContext = 0; if (sharePlatformContext) shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext(); @@ -112,33 +97,6 @@ QGLXContext::~QGLXContext() } } -void QGLXContext::createDefaultSharedContext(QXlibScreen *screen) -{ - int x = 0; - int y = 0; - int w = 3; - int h = 3; - - QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); - GLXContext context; - GLXFBConfig config = qglx_findConfig(screen->display()->nativeDisplay(),screen->xScreenNumber(),format); - if (config) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display()->nativeDisplay(),config); - Colormap cmap = XCreateColormap(screen->display()->nativeDisplay(),screen->rootWindow(),visualInfo->visual,AllocNone); - XSetWindowAttributes a; - a.colormap = cmap; - Window sharedWindow = XCreateWindow(screen->display()->nativeDisplay(), screen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - - context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,0,TRUE); - QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); - QPlatformGLContext::setDefaultSharedContext(sharedContext); - } else { - qWarning("Warning no shared context created"); - } -} - void QGLXContext::makeCurrent() { QPlatformGLContext::makeCurrent(); diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h index cf6b006fd2..57c716bef0 100644 --- a/src/plugins/platforms/xlib/qglxintegration.h +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -76,8 +76,6 @@ private: QPlatformWindowFormat m_windowFormat; QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); - static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContext(QXlibScreen *xd); }; QT_END_NAMESPACE |