summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xlib/qglxintegration.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-04-13 06:49:52 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-04-13 07:45:00 (GMT)
commit3ba6c3b7a4261147addc1d7fb06060dae7522691 (patch)
treecded7ec5f02e5f6ea082110185c6da2e03d514e9 /src/plugins/platforms/xlib/qglxintegration.cpp
parent0108e888480e47e65d82d94e10a7c7c910e42d79 (diff)
downloadQt-3ba6c3b7a4261147addc1d7fb06060dae7522691.zip
Qt-3ba6c3b7a4261147addc1d7fb06060dae7522691.tar.gz
Qt-3ba6c3b7a4261147addc1d7fb06060dae7522691.tar.bz2
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/qglxintegration.cpp')
-rw-r--r--src/plugins/platforms/xlib/qglxintegration.cpp44
1 files changed, 1 insertions, 43 deletions
diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp
index 6746e22..7a0f36d 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();