Make it compile with EGL

This commit is contained in:
Martin Gräßlin 2010-11-20 13:33:24 +01:00
parent b145ad6065
commit 0f0509cbd9
2 changed files with 10 additions and 0 deletions

View file

@ -119,6 +119,7 @@ void CompositingPrefs::detect()
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
// HACK: This is needed for AIGLX
if( qstrcmp( qgetenv( "KWIN_DIRECT_GL" ), "1" ) != 0 )
{
@ -160,12 +161,14 @@ void CompositingPrefs::detect()
else
glXMakeCurrent( display(), olddrawable, oldcontext );
deleteGLXContext();
#endif
#endif
}
bool CompositingPrefs::initGLXContext()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
mGLContext = NULL;
KXErrorHandler handler;
// Most of this code has been taken from glxinfo.c
@ -209,6 +212,9 @@ bool CompositingPrefs::initGLXContext()
visinfo->visual, mask, &attr );
return glXMakeCurrent( display(), mGLWindow, mGLContext ) && !handler.error( true );
#else
return false;
#endif
#else
return false;
#endif
@ -217,11 +223,13 @@ bool CompositingPrefs::initGLXContext()
void CompositingPrefs::deleteGLXContext()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
if( mGLContext == NULL )
return;
glXDestroyContext( display(), mGLContext );
XDestroyWindow( display(), mGLWindow );
#endif
#endif
}
void CompositingPrefs::detectDriverAndVersion()

View file

@ -67,9 +67,11 @@ private:
bool mStrictBinding;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
GLXContext mGLContext;
Window mGLWindow;
#endif
#endif
};
}