diff --git a/CMakeLists.txt b/CMakeLists.txt
index d28ca9011c..2ef13e59cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,21 +213,40 @@ qt4_add_dbus_interface( kwin_KDEINIT_SRCS
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
-kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
-
-target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES})
+set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES})
if(KWIN_BUILD_SCRIPTING)
- target_link_libraries(kdeinit_kwin ${QT_QTSCRIPT_LIBRARY})
+ set(kwinLibs ${kwinLibs} ${QT_QTSCRIPT_LIBRARY})
endif(KWIN_BUILD_SCRIPTING)
if(KWIN_BUILD_TABBOX)
- target_link_libraries(kdeinit_kwin ${QT_QTXML_LIBRARY})
+ set(kwinLibs ${kwinLibs} ${QT_QTXML_LIBRARY})
endif(KWIN_BUILD_TABBOX)
-if(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
+if (X11_Xrandr_FOUND)
+ set(kwinLibs ${kwinLibs} ${X11_Xrandr_LIB})
+endif (X11_Xrandr_FOUND)
+if (X11_Xcomposite_FOUND)
+ set(kwinLibs ${kwinLibs} ${X11_Xcomposite_LIB})
+endif (X11_Xcomposite_FOUND)
+if (X11_Xdamage_FOUND)
+ set(kwinLibs ${kwinLibs} ${X11_Xdamage_LIB})
+endif (X11_Xdamage_FOUND)
+if (X11_Xrender_FOUND)
+ set(kwinLibs ${kwinLibs} ${X11_Xrender_LIB})
+endif (X11_Xrender_FOUND)
+if (X11_Xfixes_FOUND)
+ set(kwinLibs ${kwinLibs} ${X11_Xfixes_LIB})
+endif (X11_Xfixes_FOUND)
+
+kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
+
+target_link_libraries(kdeinit_kwin ${kwinLibs})
+
+if(OPENGL_FOUND)
+ set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL)
add_subdirectory(opengltest)
- target_link_libraries(kdeinit_kwin ${OPENGL_gl_LIBRARY})
+ target_link_libraries(kdeinit_kwin kwinglutils ${OPENGL_gl_LIBRARY})
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
@@ -235,31 +254,18 @@ if(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
endif(DL_LIBRARY)
# must be after opengl, to be initialized first by the linker
target_link_libraries(kdeinit_kwin kwinnvidiahack)
-endif(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
-
-if(KWIN_HAVE_OPENGLES_COMPOSITING)
- target_link_libraries(kdeinit_kwin ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
-endif(KWIN_HAVE_OPENGLES_COMPOSITING)
-
-if (X11_Xrandr_FOUND)
- target_link_libraries(kdeinit_kwin ${X11_Xrandr_LIB})
-endif (X11_Xrandr_FOUND)
-if (X11_Xcomposite_FOUND)
- target_link_libraries(kdeinit_kwin ${X11_Xcomposite_LIB})
-endif (X11_Xcomposite_FOUND)
-if (X11_Xdamage_FOUND)
- target_link_libraries(kdeinit_kwin ${X11_Xdamage_LIB})
-endif (X11_Xdamage_FOUND)
-if (X11_Xrender_FOUND)
- target_link_libraries(kdeinit_kwin ${X11_Xrender_LIB})
-endif (X11_Xrender_FOUND)
-if (X11_Xfixes_FOUND)
- target_link_libraries(kdeinit_kwin ${X11_Xfixes_LIB})
-endif (X11_Xfixes_FOUND)
+endif(OPENGL_FOUND)
install(TARGETS kdeinit_kwin ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} )
+if(OPENGLES_FOUND)
+ kde4_add_kdeinit_executable( kwin_gles ${kwin_KDEINIT_SRCS})
+ target_link_libraries(kdeinit_kwin_gles ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
+ set_target_properties(kdeinit_kwin_gles PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGL -DKWIN_HAVE_OPENGLES")
+ install(TARGETS kdeinit_kwin_gles ${INSTALL_TARGETS_DEFAULT_ARGS} )
+ install(TARGETS kwin_gles ${INSTALL_TARGETS_DEFAULT_ARGS} )
+endif(OPENGLES_FOUND)
########### next target ###############
diff --git a/composite.cpp b/composite.cpp
index b309bd9d38..d2c31c0219 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -122,6 +122,14 @@ void Workspace::setupCompositing()
else {
unsafeConfig.writeEntry("OpenGLIsUnsafe", true);
unsafeConfig.sync();
+#ifndef KWIN_HAVE_OPENGLES
+ if (!CompositingPrefs::hasGlx()) {
+ unsafeConfig.writeEntry("OpenGLIsUnsafe", false);
+ unsafeConfig.sync();
+ kDebug(1212) << "No glx extensions available";
+ break;
+ }
+#endif
scene = new SceneOpenGL(this);
diff --git a/compositingprefs.cpp b/compositingprefs.cpp
index 025048e70d..cf3bc1436b 100644
--- a/compositingprefs.cpp
+++ b/compositingprefs.cpp
@@ -80,7 +80,7 @@ bool CompositingPrefs::compositingPossible()
return false;
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
- if (Extensions::glxAvailable())
+ if (hasGlx())
return true;
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@@ -116,14 +116,14 @@ QString CompositingPrefs::compositingNotPossibleReason()
return i18n("Required X extensions (XComposite and XDamage) are not available.");
}
#if defined( KWIN_HAVE_OPENGL_COMPOSITING ) && !defined( KWIN_HAVE_XRENDER_COMPOSITING )
- if (!Extensions::glxAvailable())
+ if (!hasGlx())
return i18n("GLX/OpenGL are not available and only OpenGL support is compiled.");
#elif !defined( KWIN_HAVE_OPENGL_COMPOSITING ) && defined( KWIN_HAVE_XRENDER_COMPOSITING )
if (!(Extensions::renderAvailable() && Extensions::fixesAvailable()))
return i18n("XRender/XFixes extensions are not available and only XRender support"
" is compiled.");
#else
- if (!(Extensions::glxAvailable()
+ if (!(hasGlx()
|| (Extensions::renderAvailable() && Extensions::fixesAvailable()))) {
return i18n("GLX/OpenGL and XRender/XFixes are not available.");
}
@@ -135,6 +135,24 @@ QString CompositingPrefs::compositingNotPossibleReason()
#endif
}
+static bool s_glxDetected = false;
+static bool s_hasGlx = false;
+
+bool CompositingPrefs::hasGlx()
+{
+ if (s_glxDetected) {
+ return s_hasGlx;
+ }
+#ifdef KWIN_HAVE_OPENGL_COMPOSITING
+#ifndef KWIN_HAVE_OPENGLES
+ int event_base, error_base;
+ s_hasGlx = glXQueryExtension(display(), &event_base, &error_base);
+#endif
+#endif
+ s_glxDetected = true;
+ return s_hasGlx;
+}
+
void CompositingPrefs::detect()
{
if (!compositingPossible() || openGlIsBroken()) {
@@ -186,7 +204,7 @@ void CompositingPrefs::detect()
if (QProcess::execute(opengl_test) != 0)
setenv("LIBGL_ALWAYS_INDIRECT", "1", true);
}
- if (!Extensions::glxAvailable()) {
+ if (!hasGlx()) {
kDebug(1212) << "No GLX available";
gl_workaround_config.writeEntry("OpenGLIsUnsafe", false);
gl_workaround_config.sync();
diff --git a/compositingprefs.h b/compositingprefs.h
index 4cfc0095ef..3ecb03b5ce 100644
--- a/compositingprefs.h
+++ b/compositingprefs.h
@@ -40,6 +40,16 @@ public:
static bool compositingPossible();
static QString compositingNotPossibleReason();
static bool openGlIsBroken();
+ /**
+ * Tests whether GLX is supported and returns @c true
+ * in case KWin is compiled with OpenGL support and GLX
+ * is available.
+ *
+ * If KWin is compiled with OpenGL ES or without OpenGL at
+ * all, @c false is returned.
+ * @returns @c true if GLX is available, @c false otherwise and if not build with OpenGL support.
+ **/
+ static bool hasGlx();
bool recommendCompositing() const;
bool enableVSync() const {
return mEnableVSync;
diff --git a/effects.cpp b/effects.cpp
index 143b033b9f..45233136f8 100644
--- a/effects.cpp
+++ b/effects.cpp
@@ -1040,6 +1040,11 @@ unsigned long EffectsHandlerImpl::xrenderBufferPicture()
KLibrary* EffectsHandlerImpl::findEffectLibrary(KService* service)
{
QString libname = service->library();
+#ifdef KWIN_HAVE_OPENGLES
+ if (libname.startsWith("kwin4_effect_")) {
+ libname.replace("kwin4_effect_", "kwin4_effect_gles_");
+ }
+#endif
KLibrary* library = new KLibrary(libname);
if (!library) {
kError(1212) << "couldn't open library for effect '" <<
diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt
index 8683b35779..986f5921c9 100644
--- a/effects/CMakeLists.txt
+++ b/effects/CMakeLists.txt
@@ -3,15 +3,31 @@ kde4_no_enable_final(kwineffects)
# Uncomment to have the test effects built as well
#add_subdirectory( _test )
+macro( KWIN4_ADD_EFFECT_BACKEND name )
+ kde4_add_plugin( ${name} ${ARGN} )
+ target_link_libraries( ${name} kwineffects ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${X11_Xfixes_LIB} ${X11_Xcursor_LIB})
+endmacro( KWIN4_ADD_EFFECT_BACKEND )
# Adds effect plugin with given name. Sources are given after the name
macro( KWIN4_ADD_EFFECT name )
- kde4_add_plugin( kwin4_effect_${name} ${ARGN} )
- target_link_libraries( kwin4_effect_${name} kwineffects ${KDE4_KDEUI_LIBS} kephal ${KDE4_PLASMA_LIBS} ${X11_Xfixes_LIB} ${X11_Xcursor_LIB})
- if (X11_Xfixes_FOUND)
- target_link_libraries(kwin4_effect_${name} ${X11_Xfixes_LIB})
- endif (X11_Xfixes_FOUND)
- install( TARGETS kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
+ if(OPENGL_FOUND OR NOT(OPENGL_FOUND AND OPENGLES_FOUND))
+ # OpenGL or neither OpenGL nor OpenGL ES - default set
+ KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN})
+ if(OPENGL_FOUND)
+ target_link_libraries(kwin4_effect_${name} kwinglutils)
+ set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL)
+ endif(OPENGL_FOUND)
+ install( TARGETS kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
+ endif(OPENGL_FOUND OR NOT(OPENGL_FOUND AND OPENGLES_FOUND))
+
+
+ if(OPENGLES_FOUND)
+ KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_gles_${name} ${ARGN})
+ # OpenGL ES gets into a different library
+ target_link_libraries(kwin4_effect_gles_${name} kwinglesutils)
+ set_target_properties(kwin4_effect_gles_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGL -DKWIN_HAVE_OPENGLES")
+ install( TARGETS kwin4_effect_gles_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
+ endif(OPENGLES_FOUND)
endmacro( KWIN4_ADD_EFFECT )
macro( KWIN4_ADD_EFFECT_CONFIG name )
@@ -28,21 +44,22 @@ macro( KWIN4_ADD_EFFECT_CONFIG name )
kde4_add_ui_files( kwin4_effect_src ${kwin4_effect_ui} )
kde4_add_plugin( kcm_kwin4_effect_${name} ${kwin4_effect_src} )
- target_link_libraries( kcm_kwin4_effect_${name} kwineffects ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} kephal )
+ target_link_libraries( kcm_kwin4_effect_${name} kwineffects ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} )
install( TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
endmacro( KWIN4_ADD_EFFECT_CONFIG )
macro( KWIN4_EFFECT_LINK_XRENDER name )
if( KWIN_HAVE_XRENDER_COMPOSITING )
- target_link_libraries( kwin4_effect_${name} ${X11_Xrender_LIB} ${X11_LIBRARIES} kephal )
+ target_link_libraries( kwin4_effect_${name} ${X11_Xrender_LIB} ${X11_LIBRARIES} )
+
+ # if building for OpenGL and OpenGL ES we have two targets
+ # TODO: if building for OpenGL ES we should not build XRender support
+ if(OPENGLES_FOUND)
+ target_link_libraries( kwin4_effect_gles_${name} ${X11_Xrender_LIB} ${X11_LIBRARIES} )
+ endif(OPENGLES_FOUND)
endif( KWIN_HAVE_XRENDER_COMPOSITING )
endmacro( KWIN4_EFFECT_LINK_XRENDER )
-# Make sure we can see our libraries
-include_directories(
- ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/lib
- )
-
# Install the KWin/Effect service type
install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp
index d0a5c1dc28..7f1c50cd11 100644
--- a/effects/logout/logout.cpp
+++ b/effects/logout/logout.cpp
@@ -200,6 +200,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
effects->paintScreen(mask, region, data);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
+#ifndef KWIN_HAVE_OPENGLES
if (effects->compositingType() == KWin::OpenGLCompositing && progress > 0.0) {
if (!blurSupported) {
if (!logoutWindowPassed)
@@ -289,6 +290,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
}
}
#endif
+#endif
}
void LogoutEffect::postPaintScreen()
@@ -353,6 +355,7 @@ bool LogoutEffect::isLogoutDialog(EffectWindow* w)
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
void LogoutEffect::renderVignetting()
{
+#ifndef KWIN_HAVE_OPENGLES
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT);
glEnable(GL_BLEND); // If not already (Such as when rendered straight to the screen)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -376,6 +379,7 @@ void LogoutEffect::renderVignetting()
glDisable(GL_SCISSOR_TEST);
}
glPopAttrib();
+#endif
}
#endif
diff --git a/effects/showfps/showfps.h b/effects/showfps/showfps.h
index 88349566b5..44a4d809b9 100644
--- a/effects/showfps/showfps.h
+++ b/effects/showfps/showfps.h
@@ -24,11 +24,11 @@ along with this program. If not, see .
#include
#include
-#include
namespace KWin
{
+class GLTexture;
class ShowFpsEffect
: public Effect
diff --git a/effects/showfps/showfps_config.cpp b/effects/showfps/showfps_config.cpp
index dcbe93bc05..81dda4f1d1 100644
--- a/effects/showfps/showfps_config.cpp
+++ b/effects/showfps/showfps_config.cpp
@@ -19,6 +19,7 @@ along with this program. If not, see .
*********************************************************************/
#include "showfps_config.h"
+#include "showfps.h"
#include
diff --git a/effects/showfps/showfps_config.h b/effects/showfps/showfps_config.h
index b1846222aa..ad79519d4e 100644
--- a/effects/showfps/showfps_config.h
+++ b/effects/showfps/showfps_config.h
@@ -24,7 +24,6 @@ along with this program. If not, see .
#include
#include "ui_showfps_config.h"
-#include "showfps.h"
namespace KWin
{
diff --git a/geometry.cpp b/geometry.cpp
index 04c7b9d567..a357162b15 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -1154,6 +1154,15 @@ void Client::checkWorkspacePosition(const QRect &geo)
newGeom.x() + newGeom.width() - 1));
}
+ if (newGeom.x() > screenArea.right()) {
+ int screenWidth = screenArea.width();
+ newGeom.moveLeft(screenWidth - (screenWidth / 4));
+ }
+ if (newGeom.y() > screenArea.bottom()) {
+ int screenHeight = screenArea.height();
+ newGeom.moveBottom(screenHeight - (screenHeight / 4));
+ }
+
// Obey size hints. TODO: We really should make sure it stays in the right place
newGeom.setSize(adjustedSize(newGeom.size()));
diff --git a/kcmkwin/kwincompositing/CMakeLists.txt b/kcmkwin/kwincompositing/CMakeLists.txt
index 57d77506d5..be97b0bd98 100644
--- a/kcmkwin/kwincompositing/CMakeLists.txt
+++ b/kcmkwin/kwincompositing/CMakeLists.txt
@@ -19,7 +19,8 @@ install(TARGETS kcm_kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR} )
# CompositingPrefs uses OpenGL
if(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
- target_link_libraries(kcm_kwincompositing ${OPENGL_gl_LIBRARY})
+ target_link_libraries(kcm_kwincompositing kwinglutils ${OPENGL_gl_LIBRARY})
+ set_target_properties(kcm_kwincompositing PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL)
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
@@ -27,7 +28,8 @@ if(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
endif(DL_LIBRARY)
endif(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
if(KWIN_HAVE_OPENGLES_COMPOSITING)
- target_link_libraries(kcm_kwincompositing ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
+ target_link_libraries(kcm_kwincompositing kwinglesutils ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
+ set_target_properties(kcm_kwincompositing PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGL -DKWIN_HAVE_OPENGLES")
endif(KWIN_HAVE_OPENGLES_COMPOSITING)
if (X11_Xrender_FOUND)
target_link_libraries(kcm_kwincompositing ${X11_Xrender_LIB})
diff --git a/kcmkwin/kwinscreenedges/CMakeLists.txt b/kcmkwin/kwinscreenedges/CMakeLists.txt
index 94e841c2c7..685eed18bb 100644
--- a/kcmkwin/kwinscreenedges/CMakeLists.txt
+++ b/kcmkwin/kwinscreenedges/CMakeLists.txt
@@ -15,7 +15,8 @@ install( TARGETS kcm_kwinscreenedges DESTINATION ${PLUGIN_INSTALL_DIR} )
# CompositingPrefs uses OpenGL
if( OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING )
- target_link_libraries( kcm_kwinscreenedges ${OPENGL_gl_LIBRARY} )
+ target_link_libraries( kcm_kwinscreenedges kwinglutils ${OPENGL_gl_LIBRARY} )
+ set_target_properties(kcm_kwinscreenedges PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL)
# -ldl used by OpenGL code
find_library( DL_LIBRARY dl )
if( DL_LIBRARY )
@@ -23,7 +24,8 @@ if( OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING )
endif( DL_LIBRARY )
endif( OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING )
if(KWIN_HAVE_OPENGLES_COMPOSITING)
- target_link_libraries(kcm_kwinscreenedges ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
+ target_link_libraries(kcm_kwinscreenedges kwinglesutils ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
+ set_target_properties(kcm_kwinscreenedges PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGL -DKWIN_HAVE_OPENGLES")
endif(KWIN_HAVE_OPENGLES_COMPOSITING)
if( X11_Xrender_FOUND )
target_link_libraries( kcm_kwinscreenedges ${X11_Xrender_LIB} )
diff --git a/libkwineffects/CMakeLists.txt b/libkwineffects/CMakeLists.txt
index cb9703b6fc..9c3a79ce0f 100644
--- a/libkwineffects/CMakeLists.txt
+++ b/libkwineffects/CMakeLists.txt
@@ -4,10 +4,6 @@
set(kwin_EFFECTSLIB_SRCS
kwinglobals.cpp
kwineffects.cpp
- kwinglutils.cpp
- kwingltexture.cpp
- kwinglutils_funcs.cpp
- kwinglplatform.cpp
kwinxrenderutils.cpp
)
@@ -18,21 +14,45 @@ set_target_properties(kwineffects PROPERTIES VERSION 1.0.0 SOVERSION 1 )
install(TARGETS kwineffects EXPORT kdeworkspaceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
-if(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
- target_link_libraries(kwineffects ${OPENGL_gl_LIBRARY})
- target_link_libraries(kwineffects LINK_INTERFACE_LIBRARIES ${OPENGL_gl_LIBRARY})
-# -ldl used by OpenGL code
- find_library(DL_LIBRARY dl)
- if (DL_LIBRARY)
- target_link_libraries(kwineffects ${DL_LIBRARY})
- endif(DL_LIBRARY)
- include_directories(${OPENGL_INCLUDE_DIR})
-endif(OPENGL_FOUND AND NOT KWIN_HAVE_OPENGLES_COMPOSITING)
-if(KWIN_HAVE_OPENGLES_COMPOSITING)
- target_link_libraries(kwineffects ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
- target_link_libraries(kwineffects LINK_INTERFACE_LIBRARIES ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
- include_directories(${OPENGLES_INCLUDE_DIR})
-endif(KWIN_HAVE_OPENGLES_COMPOSITING)
+if(OPENGL_FOUND OR OPENGLES_FOUND)
+
+ set(kwin_GLUTILSLIB_SRCS
+ kwinglutils.cpp
+ kwingltexture.cpp
+ kwinglutils_funcs.cpp
+ kwinglplatform.cpp
+ )
+
+ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
+ include_directories(${glinclude})
+ kde4_add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
+ target_link_libraries(${name} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} kephal kwineffects)
+ set_target_properties(${name} PROPERTIES VERSION 1.0.0 SOVERSION 1 )
+ target_link_libraries(${name} ${ARGN})
+ target_link_libraries(${name} LINK_INTERFACE_LIBRARIES ${ARGN})
+
+ install(TARGETS ${name} EXPORT kdeworkspaceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
+ endmacro( KWIN4_ADD_GLUTILS_BACKEND )
+
+ if(OPENGLES_FOUND)
+ KWIN4_ADD_GLUTILS_BACKEND(kwinglesutils ${OPENGLES_INCLUDE_DIR} ${OPENGLES_LIBRARIES} ${OPENGLES_EGL_LIBRARIES})
+ set_target_properties(kwinglesutils PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGL -DKWIN_HAVE_OPENGLES")
+ endif(OPENGLES_FOUND)
+ if(OPENGL_FOUND)
+ KWIN4_ADD_GLUTILS_BACKEND(kwinglutils ${OPENGL_INCLUDE_DIR} ${OPENGL_gl_LIBRARY})
+ set_target_properties(kwinglutils PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL)
+
+ target_link_libraries(kwinglutils ${OPENGL_gl_LIBRARY})
+ target_link_libraries(kwinglutils LINK_INTERFACE_LIBRARIES ${OPENGL_gl_LIBRARY})
+ # -ldl used by OpenGL code
+ find_library(DL_LIBRARY dl)
+ if (DL_LIBRARY)
+ target_link_libraries(kwinglutils ${DL_LIBRARY})
+ endif(DL_LIBRARY)
+ endif(OPENGL_FOUND)
+
+endif(OPENGL_FOUND OR OPENGLES_FOUND)
+
if (X11_Xrender_FOUND)
target_link_libraries(kwineffects ${X11_Xrender_LIB})
endif (X11_Xrender_FOUND)
diff --git a/libkwineffects/kwinconfig.h.cmake b/libkwineffects/kwinconfig.h.cmake
index 22405a585c..381231908d 100644
--- a/libkwineffects/kwinconfig.h.cmake
+++ b/libkwineffects/kwinconfig.h.cmake
@@ -9,21 +9,6 @@
#ifndef KWINCONFIG_H
#define KWINCONFIG_H
-#if ${HAVE_OPENGL}
-#define KWIN_HAVE_OPENGL 1
-#else
-#undef KWIN_HAVE_OPENGL
-#endif
-
-#if ${KWIN_HAVE_OPENGLES}
-#define KWIN_HAVE_OPENGLES 1
-#ifndef KWIN_HAVE_OPENGL
-#define KWIN_HAVE_OPENGL 1
-#endif
-#else
-#undef KWIN_HAVE_OPENGLES
-#endif
-
/*
These should be primarily used to detect what kind of compositing
@@ -37,9 +22,6 @@
/* KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available */
#cmakedefine KWIN_HAVE_OPENGL_COMPOSITING
-/* KWIN_HAVE_OPENGLES_COMPOSITING - whether OpenGL ES-based compositing support is available */
-#cmakedefine KWIN_HAVE_OPENGLES_COMPOSITING
-
/* KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available */
#cmakedefine KWIN_HAVE_XRENDER_COMPOSITING
diff --git a/libkwineffects/kwinglobals.cpp b/libkwineffects/kwinglobals.cpp
index d126a7cc9a..4b719c34cb 100644
--- a/libkwineffects/kwinglobals.cpp
+++ b/libkwineffects/kwinglobals.cpp
@@ -49,9 +49,6 @@ along with this program. If not, see .
#ifdef HAVE_XCOMPOSITE
#include
#endif
-#ifdef HAVE_OPENGL
-#include
-#endif
#ifdef HAVE_XSYNC
#include
#endif
@@ -68,7 +65,6 @@ int Extensions::damage_event_base = 0;
int Extensions::composite_version = 0;
int Extensions::fixes_version = 0;
int Extensions::render_version = 0;
-bool Extensions::has_glx = false;
bool Extensions::has_sync = false;
int Extensions::sync_event_base = 0;
bool Extensions::non_native_pixmaps = false;
@@ -145,14 +141,6 @@ void Extensions::init()
render_version = major * 0x10 + minor;
addData("RENDER");
}
-#endif
- has_glx = false;
-#ifdef HAVE_OPENGL
-#ifndef KWIN_HAVE_OPENGLES
- has_glx = glXQueryExtension(display(), &event_base, &error_base);
- if (has_glx)
- addData("GLX");
-#endif
#endif
#ifdef HAVE_XSYNC
if (XSyncQueryExtension(display(), &sync_event_base, &error_base)) {
diff --git a/libkwineffects/kwinglobals.h b/libkwineffects/kwinglobals.h
index 2a4ea7196d..f34bdba5c5 100644
--- a/libkwineffects/kwinglobals.h
+++ b/libkwineffects/kwinglobals.h
@@ -165,9 +165,6 @@ public:
return fixes_version > 0;
}
static bool fixesRegionAvailable();
- static bool glxAvailable() {
- return has_glx;
- }
static bool syncAvailable() {
return has_sync;
}
@@ -187,7 +184,6 @@ private:
static int composite_version;
static int render_version;
static int fixes_version;
- static bool has_glx;
static bool has_sync;
static int sync_event_base;
static const char* data_extensions[ 32 ];
diff --git a/scene_opengl_glx.cpp b/scene_opengl_glx.cpp
index f9358267e2..5eeb5c7406 100644
--- a/scene_opengl_glx.cpp
+++ b/scene_opengl_glx.cpp
@@ -39,10 +39,6 @@ SceneOpenGL::SceneOpenGL(Workspace* ws)
: Scene(ws)
, init_ok(false)
{
- if (!Extensions::glxAvailable()) {
- kDebug(1212) << "No glx extensions available";
- return; // error
- }
initGLX();
// check for FBConfig support
if (!hasGLExtension("GLX_SGIX_fbconfig") || !glXGetFBConfigAttrib || !glXGetFBConfigs ||