From 50bacdcfe3e95e989ccb68bce19259bca3dc811a Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Sun, 30 Sep 2007 14:08:24 +0000 Subject: [PATCH] Don't try to use GLX 1.3 functions when it's not available svn path=/trunk/KDE/kdebase/workspace/; revision=719170 --- compositingprefs.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/compositingprefs.cpp b/compositingprefs.cpp index d21453f452..79f922ad2d 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -63,11 +63,20 @@ void CompositingPrefs::detect() kDebug( 1212 ) << "No GLX available"; return; } + int glxmajor, glxminor; + glXQueryVersion( display(), &glxmajor, &glxminor ); + kDebug() << "glx version is " << glxmajor << "." << glxminor; + bool hasglx13 = ( glxmajor > 1 || ( glxmajor == 1 && glxminor >= 3 )); // remember and later restore active context GLXContext oldcontext = glXGetCurrentContext(); GLXDrawable olddrawable = glXGetCurrentDrawable(); - GLXDrawable oldreaddrawable = glXGetCurrentReadDrawable(); + GLXDrawable oldreaddrawable; + if( hasglx13 ) + { + oldreaddrawable = glXGetCurrentReadDrawable(); + } + if( createGLXContext() ) { detectDriverAndVersion(); @@ -76,7 +85,16 @@ void CompositingPrefs::detect() deleteGLXContext(); } if( oldcontext != NULL ) - glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext ); + { + if( hasglx13 ) + { + glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext ); + } + else + { + glXMakeCurrent( display(), olddrawable, oldcontext ); + } + } #endif }