diff --git a/compositingprefs.cpp b/compositingprefs.cpp index e5c24dc3bb..a4698c6251 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -133,27 +133,23 @@ void CompositingPrefs::detect() if( hasglx13 ) oldreaddrawable = glXGetCurrentReadDrawable(); - if( createGLXContext() ) + if( initGLXContext() ) { detectDriverAndVersion(); applyDriverSpecificOptions(); - - deleteGLXContext(); } if( hasglx13 ) - { glXMakeContextCurrent( display(), olddrawable, oldreaddrawable, oldcontext ); - } else - { glXMakeCurrent( display(), olddrawable, oldcontext ); - } + deleteGLXContext(); #endif } -bool CompositingPrefs::createGLXContext() +bool CompositingPrefs::initGLXContext() { #ifdef KWIN_HAVE_OPENGL_COMPOSITING + mGLContext = NULL; KXErrorHandler handler; // Most of this code has been taken from glxinfo.c QVector attribs; @@ -204,6 +200,8 @@ bool CompositingPrefs::createGLXContext() void CompositingPrefs::deleteGLXContext() { #ifdef KWIN_HAVE_OPENGL_COMPOSITING + if( mGLContext == NULL ) + return; glXDestroyContext( display(), mGLContext ); XDestroyWindow( display(), mGLWindow ); #endif diff --git a/compositingprefs.h b/compositingprefs.h index b73a6a99cd..73155a0ee9 100644 --- a/compositingprefs.h +++ b/compositingprefs.h @@ -70,7 +70,7 @@ protected: void applyDriverSpecificOptions(); static bool detectXgl(); - bool createGLXContext(); + bool initGLXContext(); void deleteGLXContext();