From 0f0509cbd94a72cc0559ebb986db581684f60036 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <kde@martin-graesslin.com>
Date: Sat, 20 Nov 2010 13:33:24 +0100
Subject: [PATCH] Make it compile with EGL

---
 compositingprefs.cpp | 8 ++++++++
 compositingprefs.h   | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/compositingprefs.cpp b/compositingprefs.cpp
index 2341f13337..7e9fd2f463 100644
--- a/compositingprefs.cpp
+++ b/compositingprefs.cpp
@@ -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()
diff --git a/compositingprefs.h b/compositingprefs.h
index 2f857d18c6..bbaaa5a828 100644
--- a/compositingprefs.h
+++ b/compositingprefs.h
@@ -67,9 +67,11 @@ private:
     bool mStrictBinding;
 
 #ifdef KWIN_HAVE_OPENGL_COMPOSITING
+#ifndef KWIN_HAVE_OPENGLES
     GLXContext mGLContext;
     Window mGLWindow;
 #endif
+#endif
 };
 
 }