From 987bc837d91e0d0e27c1df04254f0186163f35ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 13 Aug 2011 15:21:51 +0200 Subject: [PATCH] Remove define KWIN_HAVE_OPENGL_COMPOSITING Due to changes in build system we have always either OpenGL or OpenGL ES. This allows to remove the KWIN_HAVE_OPENGL_COMPOSITING define. In the effects the define is kept as KWIN_HAVE_OPENGL which can be used in future to build also an XRender only effect system. --- CMakeLists.txt | 15 ++------ composite.cpp | 6 --- compositingprefs.cpp | 22 +---------- compositingprefs.h | 2 - effects.cpp | 4 -- effects/CMakeLists.txt | 38 +++++++++---------- effects/configs_builtins.cpp | 4 +- effects/logout/logout.cpp | 22 +++++------ effects/logout/logout.h | 2 +- effects/presentwindows/presentwindows.cpp | 6 +-- effects/resize/resize.cpp | 4 +- effects/showfps/showfps.cpp | 12 +++--- effects/showfps/showfps.h | 4 +- effects/showpaint/showpaint.cpp | 6 +-- effects/taskbarthumbnail/taskbarthumbnail.cpp | 4 +- effects/trackmouse/trackmouse.cpp | 4 -- effects/zoom/zoom.cpp | 8 +--- kcmkwin/kwincompositing/main.cpp | 6 --- lanczosfilter.cpp | 22 ----------- lanczosfilter.h | 6 --- libkwineffects/kwinconfig.h.cmake | 3 -- libkwineffects/kwineffects.cpp | 8 ---- options.cpp | 2 - scene_opengl.cpp | 4 -- scene_opengl.h | 4 -- shadow.cpp | 4 -- 26 files changed, 55 insertions(+), 167 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46e9c81da9..602a4d41a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,30 +28,21 @@ if(KWIN_PLASMA_ACTIVE) set(KWIN_BUILD_WITH_OPENGLES ON) endif(KWIN_PLASMA_ACTIVE) -# KWIN_HAVE_OPENGL_COMPOSITING - always have either OpenGL or OpenGL ES -set( KWIN_HAVE_OPENGL_COMPOSITING 1 ) - # KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled if( KWIN_BUILD_XRENDER_COMPOSITING ) set( KWIN_HAVE_XRENDER_COMPOSITING 1 ) endif( KWIN_BUILD_XRENDER_COMPOSITING ) -# KWIN_HAVE_OPENGLES_COMPOSITING - whether OpenGL ES-based compositing support is available -if( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES) - set( KWIN_HAVE_OPENGLES_COMPOSITING 1 ) - message("Compiling KWin for mobile.") -endif( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES ) - macro_bool_to_01( OPENGL_FOUND KWIN_HAVE_OPENGL ) -macro_bool_to_01( KWIN_HAVE_OPENGLES_COMPOSITING KWIN_HAVE_OPENGLES ) +macro_bool_to_01( OPENGLES_FOUND KWIN_HAVE_OPENGLES ) if(OPENGL_FOUND) include_directories(${OPENGL_INCLUDE_DIR}) endif(OPENGL_FOUND) -if(OPENGLES_FOUND AND KWIN_HAVE_OPENGLES_COMPOSITING) +if(OPENGLES_FOUND) include_directories(${OPENGLES_INCLUDE_DIR}) -endif(OPENGLES_FOUND AND KWIN_HAVE_OPENGLES_COMPOSITING) +endif(OPENGLES_FOUND) # for things that are also used by kwin libraries configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h ) diff --git a/composite.cpp b/composite.cpp index 0675caac97..edd09a5ca6 100644 --- a/composite.cpp +++ b/composite.cpp @@ -109,7 +109,6 @@ void Workspace::setupCompositing() kDebug( 1212 ) << "X compositing"; scene = new SceneBasic( this ); break; // don't fall through (this is a testing one) */ -#ifdef KWIN_HAVE_OPENGL_COMPOSITING case OpenGLCompositing: { kDebug(1212) << "Initializing OpenGL compositing"; @@ -145,7 +144,6 @@ void Workspace::setupCompositing() // Do not Fall back to XRender - it causes problems when selfcheck fails during startup, but works later on break; } -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING case XRenderCompositing: kDebug(1212) << "Initializing XRender compositing"; @@ -672,7 +670,6 @@ void Toplevel::addDamage(int x, int y, int w, int h) damageRatio = float(damageArea) / float(rect().width()*rect().height()); repaints_region += r; emit damaged(this, r); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING // discard lanczos texture if (effect_window) { QVariant cachedTextureVariant = effect_window->data(LanczosCacheRole); @@ -683,7 +680,6 @@ void Toplevel::addDamage(int x, int y, int w, int h) effect_window->setData(LanczosCacheRole, QVariant()); } } -#endif workspace()->checkCompositeTimer(); } @@ -695,7 +691,6 @@ void Toplevel::addDamageFull() repaints_region = rect(); damageRatio = 1.0; emit damaged(this, rect()); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING // discard lanczos texture if (effect_window) { QVariant cachedTextureVariant = effect_window->data(LanczosCacheRole); @@ -706,7 +701,6 @@ void Toplevel::addDamageFull() effect_window->setData(LanczosCacheRole, QVariant()); } } -#endif workspace()->checkCompositeTimer(); } diff --git a/compositingprefs.cpp b/compositingprefs.cpp index 3b952b56a4..e5ec647490 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -78,10 +78,8 @@ bool CompositingPrefs::compositingPossible() kDebug(1212) << "No damage extension available"; return false; } -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (hasGlx()) return true; -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (Extensions::renderAvailable() && Extensions::fixesAvailable()) return true; @@ -110,13 +108,9 @@ QString CompositingPrefs::compositingNotPossibleReason() if (!Extensions::compositeAvailable() || !Extensions::damageAvailable()) { return i18n("Required X extensions (XComposite and XDamage) are not available."); } -#if defined( KWIN_HAVE_OPENGL_COMPOSITING ) && !defined( KWIN_HAVE_XRENDER_COMPOSITING ) +#if !defined( KWIN_HAVE_XRENDER_COMPOSITING ) 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 (!(hasGlx() || (Extensions::renderAvailable() && Extensions::fixesAvailable()))) { @@ -134,11 +128,9 @@ 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; @@ -159,7 +151,6 @@ void CompositingPrefs::detect() gl_workaround_config.writeEntry("OpenGLIsUnsafe", true); gl_workaround_config.sync(); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGLES bool haveContext = false; bool canDetect = false; @@ -232,12 +223,10 @@ void CompositingPrefs::detect() #endif gl_workaround_config.writeEntry("OpenGLIsUnsafe", false); gl_workaround_config.sync(); -#endif } bool CompositingPrefs::initGLXContext() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGLES mGLContext = NULL; KXErrorHandler handler; @@ -282,21 +271,16 @@ bool CompositingPrefs::initGLXContext() #else return false; #endif -#else - return false; -#endif } void CompositingPrefs::deleteGLXContext() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGLES if (mGLContext == NULL) return; glXDestroyContext(display(), mGLContext); XDestroyWindow(display(), mGLWindow); #endif -#endif } bool CompositingPrefs::initEGLContext() @@ -387,17 +371,14 @@ void CompositingPrefs::deleteEGLContext() void CompositingPrefs::detectDriverAndVersion() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING GLPlatform *gl = GLPlatform::instance(); gl->detect(); gl->printResults(); -#endif } // See http://techbase.kde.org/Projects/KWin/HW for a list of some cards that are known to work. void CompositingPrefs::applyDriverSpecificOptions() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING // Always recommend mRecommendCompositing = true; @@ -405,7 +386,6 @@ void CompositingPrefs::applyDriverSpecificOptions() mStrictBinding = !gl->supports(LooseBinding); if (gl->driver() == Driver_Intel) mEnableVSync = false; -#endif } } // namespace diff --git a/compositingprefs.h b/compositingprefs.h index 3ecb03b5ce..50c036406b 100644 --- a/compositingprefs.h +++ b/compositingprefs.h @@ -80,7 +80,6 @@ private: bool mEnableDirectRendering; bool mStrictBinding; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGLES EGLDisplay mEGLDisplay; EGLContext mEGLContext; @@ -89,7 +88,6 @@ private: GLXContext mGLContext; #endif Window mGLWindow; -#endif }; } diff --git a/effects.cpp b/effects.cpp index 1420b1ff09..bbf5a45858 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1288,13 +1288,11 @@ EffectWindowImpl::EffectWindowImpl() : EffectWindow() EffectWindowImpl::~EffectWindowImpl() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING QVariant cachedTextureVariant = data(LanczosCacheRole); if (cachedTextureVariant.isValid()) { GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value()); delete cachedTexture; } -#endif } bool EffectWindowImpl::isPaintingEnabled() @@ -1773,9 +1771,7 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders); if (effects->compositingType() == OpenGLCompositing) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING m_sceneFrame = new SceneOpenGL::EffectFrame(this); -#endif } else if (effects->compositingType() == XRenderCompositing) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING m_sceneFrame = new SceneXrender::EffectFrame(this); diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 3af7a6f365..f785565112 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -114,28 +114,26 @@ if( NOT KWIN_MOBILE_EFFECTS ) endif( NOT KWIN_MOBILE_EFFECTS ) # OpenGL-specific effects -if( KWIN_HAVE_OPENGL_COMPOSITING ) - include( blur/CMakeLists.txt ) - include( screenshot/CMakeLists.txt ) - # OpenGL-specific effects for desktop - if( NOT KWIN_MOBILE_EFFECTS ) - include( coverswitch/CMakeLists.txt ) - include( cube/CMakeLists.txt ) - include( explosion/CMakeLists.txt ) - include( flipswitch/CMakeLists.txt ) - include( glide/CMakeLists.txt ) - include( invert/CMakeLists.txt ) - include( lookingglass/CMakeLists.txt ) +include( blur/CMakeLists.txt ) +include( screenshot/CMakeLists.txt ) +# OpenGL-specific effects for desktop +if( NOT KWIN_MOBILE_EFFECTS ) + include( coverswitch/CMakeLists.txt ) + include( cube/CMakeLists.txt ) + include( explosion/CMakeLists.txt ) + include( flipswitch/CMakeLists.txt ) + include( glide/CMakeLists.txt ) + include( invert/CMakeLists.txt ) + include( lookingglass/CMakeLists.txt ) # Magnifier currently broken due to removed PaintClipper # include( magnifier/CMakeLists.txt ) - include( mousemark/CMakeLists.txt ) - include( sheet/CMakeLists.txt ) - include( snaphelper/CMakeLists.txt ) - include( startupfeedback/CMakeLists.txt ) - include( trackmouse/CMakeLists.txt ) - include( wobblywindows/CMakeLists.txt ) - endif( NOT KWIN_MOBILE_EFFECTS ) -endif( KWIN_HAVE_OPENGL_COMPOSITING ) + include( mousemark/CMakeLists.txt ) + include( sheet/CMakeLists.txt ) + include( snaphelper/CMakeLists.txt ) + include( startupfeedback/CMakeLists.txt ) + include( trackmouse/CMakeLists.txt ) + include( wobblywindows/CMakeLists.txt ) +endif( NOT KWIN_MOBILE_EFFECTS ) ############################################################################### diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 0bd2592f6d..85db0c8010 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -36,7 +36,7 @@ along with this program. If not, see . #include "windowgeometry/windowgeometry_config.h" #include "zoom/zoom_config.h" -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #include "blur/blur_config.h" #include "coverswitch/coverswitch_config.h" #include "cube/cube_config.h" @@ -76,7 +76,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE(builtins, KWIN_EFFECT_CONFIG_SINGLE(windowgeometry, WindowGeometryConfig) KWIN_EFFECT_CONFIG_SINGLE(zoom, ZoomEffectConfig) -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL KWIN_EFFECT_CONFIG_SINGLE(blur, BlurEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(coverswitch, CoverSwitchEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(cube, CubeEffectConfig) diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index 7f1c50cd11..7880daee22 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -55,7 +55,7 @@ LogoutEffect::LogoutEffect() XChangeProperty(display(), sel, hack, hack, 8, PropModeReplace, (unsigned char*)&hack, 1); // the atom is not removed when effect is destroyed, this is temporary anyway -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL blurTexture = NULL; blurTarget = NULL; #endif @@ -68,7 +68,7 @@ LogoutEffect::LogoutEffect() LogoutEffect::~LogoutEffect() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL delete blurTexture; delete blurTarget; #endif @@ -76,7 +76,7 @@ LogoutEffect::~LogoutEffect() void LogoutEffect::reconfigure(ReconfigureFlags) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL frameDelay = 0; KConfigGroup conf = effects->effectConfig("Logout"); useBlur = conf.readEntry("UseBlur", true); @@ -90,7 +90,7 @@ void LogoutEffect::reconfigure(ReconfigureFlags) void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (!displayEffect && progress == 0.0) { if (blurTexture) { delete blurTexture; @@ -132,7 +132,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) progress = qMax(0.0, progress - time / animationTime(500.0)); } -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (blurSupported && progress > 0.0) { data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; } @@ -144,7 +144,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) { if (progress > 0.0) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == KWin::OpenGLCompositing) { // In OpenGL mode we add vignetting and, if supported, a slight blur if (blurSupported) { @@ -193,13 +193,13 @@ void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (blurSupported && progress > 0.0) GLRenderTarget::pushRenderTarget(blurTarget); #endif effects->paintScreen(mask, region, data); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #ifndef KWIN_HAVE_OPENGLES if (effects->compositingType() == KWin::OpenGLCompositing && progress > 0.0) { if (!blurSupported) { @@ -295,7 +295,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) void LogoutEffect::postPaintScreen() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if ((progress != 0.0 && progress != 1.0) || frameDelay) effects->addRepaintFull(); #else @@ -334,7 +334,7 @@ void LogoutEffect::slotWindowClosed(EffectWindow* w) void LogoutEffect::slotWindowDeleted(EffectWindow* w) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL windows.removeAll(w); #endif ignoredWindows.removeAll(w); @@ -352,7 +352,7 @@ bool LogoutEffect::isLogoutDialog(EffectWindow* w) return false; } -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL void LogoutEffect::renderVignetting() { #ifndef KWIN_HAVE_OPENGLES diff --git a/effects/logout/logout.h b/effects/logout/logout.h index 555fe01d1b..a6a00f81ad 100644 --- a/effects/logout/logout.h +++ b/effects/logout/logout.h @@ -62,7 +62,7 @@ private: bool canDoPersistent; EffectWindowList ignoredWindows; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL void renderVignetting(); int frameDelay; bool blurSupported, useBlur; diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 17582552af..95ecf95e40 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -29,7 +29,7 @@ along with this program. If not, see . #include #include -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #include #endif @@ -393,7 +393,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region QPoint point(rect.x() + rect.width() * 0.95, rect.y() + rect.height() * 0.95); winData->iconFrame->setPosition(point); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) { const float a = 0.9 * data.opacity * m_decalOpacity * 0.75; data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); @@ -405,7 +405,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region QPoint point(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); winData->textFrame->setPosition(point); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) { const float a = 0.9 * data.opacity * m_decalOpacity * 0.75; data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); diff --git a/effects/resize/resize.cpp b/effects/resize/resize.cpp index 9ccca3ad95..84bdd7f7db 100644 --- a/effects/resize/resize.cpp +++ b/effects/resize/resize.cpp @@ -20,7 +20,7 @@ along with this program. If not, see . #include "resize.h" -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #include #endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING @@ -84,7 +84,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window float alpha = 0.8f; QColor color = KColorScheme(QPalette::Normal, KColorScheme::Selection).background().color(); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == OpenGLCompositing) { #ifndef KWIN_HAVE_OPENGLES glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); diff --git a/effects/showfps/showfps.cpp b/effects/showfps/showfps.cpp index 2a4703bfd6..5161401f7d 100644 --- a/effects/showfps/showfps.cpp +++ b/effects/showfps/showfps.cpp @@ -26,7 +26,7 @@ along with this program. If not, see . #include #include -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #include #endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING @@ -51,7 +51,7 @@ const int MAX_TIME = 100; ShowFpsEffect::ShowFpsEffect() : paints_pos(0) , frames_pos(0) -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL , fpsText(0) #endif { @@ -162,7 +162,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) ++fps; // count all frames in the last second if (fps > MAX_TIME) fps = MAX_TIME; // keep it the same height -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == OpenGLCompositing) { paintGL(fps); glFinish(); // make sure all rendering is done @@ -176,7 +176,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) #endif } -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL void ShowFpsEffect::paintGL(int fps) { int x = this->x; @@ -343,7 +343,7 @@ void ShowFpsEffect::paintDrawSizeGraph(int x, int y) void ShowFpsEffect::paintGraph(int x, int y, QList values, QList lines, bool colorize) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == OpenGLCompositing) { QColor color(0, 0, 0); color.setAlphaF(alpha); @@ -458,7 +458,7 @@ void ShowFpsEffect::paintFPSText(int fps) { if (!fpsTextRect.isValid()) return; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL QImage im(100, 100, QImage::Format_ARGB32); im.fill(0); QPainter painter(&im); diff --git a/effects/showfps/showfps.h b/effects/showfps/showfps.h index 44a4d809b9..a2a2ccd18d 100644 --- a/effects/showfps/showfps.h +++ b/effects/showfps/showfps.h @@ -42,7 +42,7 @@ public: virtual void postPaintScreen(); enum { INSIDE_GRAPH, NOWHERE, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT }; // fps text position private: -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL void paintGL(int fps); #endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING @@ -64,7 +64,7 @@ private: int x; int y; QRect fps_rect; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL GLTexture *fpsText; #endif int textPosition; diff --git a/effects/showpaint/showpaint.cpp b/effects/showpaint/showpaint.cpp index 7dc9ebec45..f689b1c64e 100644 --- a/effects/showpaint/showpaint.cpp +++ b/effects/showpaint/showpaint.cpp @@ -23,7 +23,7 @@ along with this program. If not, see . #include -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #include #endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING @@ -57,10 +57,8 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat { painted = QRegion(); effects->paintScreen(mask, region, data); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (effects->compositingType() == OpenGLCompositing) paintGL(); -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) paintXrender(); @@ -77,7 +75,7 @@ void ShowPaintEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win void ShowPaintEffect::paintGL() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #ifndef KWIN_HAVE_OPENGLES glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); #endif diff --git a/effects/taskbarthumbnail/taskbarthumbnail.cpp b/effects/taskbarthumbnail/taskbarthumbnail.cpp index b453c37f7e..7761ba54c4 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -23,7 +23,7 @@ along with this program. If not, see . #include -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL #include #endif @@ -88,7 +88,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi thumbData.opacity *= data.opacity; QRect r; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == KWin::OpenGLCompositing) { if (data.shader) { thumbData.shader = data.shader; diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index c522465ee6..14fe15ab35 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -112,7 +112,6 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da effects->paintScreen(mask, region, data); // paint normal screen if (!active) return; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (texture) { #ifndef KWIN_HAVE_OPENGLES glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); @@ -140,7 +139,6 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da glPopAttrib(); #endif } -#endif } void TrackMouseEffect::postPaintScreen() @@ -203,14 +201,12 @@ QRect TrackMouseEffect::starRect(int num) const void TrackMouseEffect::loadTexture() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING QString file = KGlobal::dirs()->findResource("appdata", "trackmouse.png"); if (file.isEmpty()) return; QImage im(file); texture = new GLTexture(im); textureSize = im.size(); -#endif } } // namespace diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index 99ae23ff32..4975b39555 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -133,7 +133,6 @@ ZoomEffect::~ZoomEffect() void ZoomEffect::showCursor() { -#if defined(KWIN_HAVE_OPENGL_COMPOSITING) || defined(KWIN_HAVE_XRENDER_COMPOSITING) if (isMouseHidden) { // show the previously hidden mouse-pointer again and free the loaded texture/picture. Display* display = QX11Info::display(); @@ -144,12 +143,10 @@ void ZoomEffect::showCursor() xrenderPicture = 0; isMouseHidden = false; } -#endif } void ZoomEffect::hideCursor() { -#if defined(KWIN_HAVE_OPENGL_COMPOSITING) || defined(KWIN_HAVE_XRENDER_COMPOSITING) if (!isMouseHidden) { // try to load the cursor-theme into a OpenGL texture and if successful then hide the mouse-pointer recreateTexture(); @@ -159,7 +156,6 @@ void ZoomEffect::hideCursor() isMouseHidden = true; } } -#endif } void ZoomEffect::recreateTexture() @@ -185,7 +181,7 @@ void ZoomEffect::recreateTexture() imageWidth = ximg->width; imageHeight = ximg->height; QImage img((uchar*)ximg->pixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (effects->compositingType() == OpenGLCompositing) texture = new GLTexture(img); #endif @@ -336,7 +332,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) QPoint p = QCursor::pos(); QRect rect(p.x() * zoom + data.xTranslate, p.y() * zoom + data.yTranslate, w, h); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING +#ifdef KWIN_HAVE_OPENGL if (texture) { #ifndef KWIN_HAVE_OPENGLES glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT); diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 02d9957744..7c5816a32c 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -89,12 +89,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList #define OPENGL_INDEX 0 #define XRENDER_INDEX 1 -#ifndef KWIN_HAVE_OPENGL_COMPOSITING - ui.compositingType->removeItem(OPENGL_INDEX); - ui.glGroup->setEnabled(false); -#define OPENGL_INDEX -1 -#define XRENDER_INDEX 0 -#endif #ifndef KWIN_HAVE_XRENDER_COMPOSITING ui.compositingType->removeItem(XRENDER_INDEX); ui.xrenderGroup->setEnabled(false); diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index 8f3955dfaa..7c0bad90c7 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -22,10 +22,8 @@ along with this program. If not, see . #include "lanczosfilter.h" #include "effects.h" -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #include -#endif #include #include @@ -38,21 +36,17 @@ namespace KWin LanczosFilter::LanczosFilter(QObject* parent) : QObject(parent) -#ifdef KWIN_HAVE_OPENGL_COMPOSITING , m_offscreenTex(0) , m_offscreenTarget(0) , m_shader(0) -#endif , m_inited(false) { } LanczosFilter::~LanczosFilter() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING delete m_offscreenTarget; delete m_offscreenTex; -#endif } void LanczosFilter::init() @@ -60,7 +54,6 @@ void LanczosFilter::init() if (m_inited) return; m_inited = true; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0); if (force) { kWarning(1212) << "Lanczos Filter forced on by environment variable"; @@ -81,13 +74,11 @@ void LanczosFilter::init() delete m_shader; m_shader = 0; } -#endif } void LanczosFilter::updateOffscreenSurfaces() { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING int w = displayWidth(); int h = displayHeight(); if (!GLTexture::NPOTTextureSupported()) { @@ -104,7 +95,6 @@ void LanczosFilter::updateOffscreenSurfaces() m_offscreenTex->setWrapMode(GL_CLAMP_TO_EDGE); m_offscreenTarget = new GLRenderTarget(m_offscreenTex); } -#endif } static float sinc(float x) @@ -123,7 +113,6 @@ static float lanczos(float x, float a) return sinc(x) * sinc(x / a); } -#ifdef KWIN_HAVE_OPENGL_COMPOSITING void LanczosShader::createKernel(float delta, int *size) { const float a = 2.0; @@ -163,11 +152,9 @@ void LanczosShader::createOffsets(int count, float width, Qt::Orientation direct QVector2D(i / width, 0) : QVector2D(0, i / width); } } -#endif void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (effects->compositingType() == KWin::OpenGLCompositing && (data.xScale < 0.9 || data.yScale < 0.9) && KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) { if (!m_inited) @@ -371,13 +358,11 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, return; } } // if ( effects->compositingType() == KWin::OpenGLCompositing ) -#endif w->sceneWindow()->performPaint(mask, region, data); } // End of function void LanczosFilter::timerEvent(QTimerEvent *event) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (event->timerId() == m_timer.timerId()) { m_timer.stop(); @@ -395,12 +380,10 @@ void LanczosFilter::timerEvent(QTimerEvent *event) } } } -#endif } void LanczosFilter::prepareRenderStates(GLTexture* tex, double opacity, double brightness, double saturation) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGLES const bool alpha = true; // setup blending of transparent windows @@ -509,12 +492,10 @@ void LanczosFilter::prepareRenderStates(GLTexture* tex, double opacity, double b } } #endif -#endif } void LanczosFilter::restoreRenderStates(GLTexture* tex, double opacity, double brightness, double saturation) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGLES if (opacity != 1.0 || saturation != 1.0 || brightness != 1.0f) { if (saturation != 1.0 && tex->saturationSupported()) { @@ -532,13 +513,11 @@ void LanczosFilter::restoreRenderStates(GLTexture* tex, double opacity, double b glPopAttrib(); // ENABLE_BIT #endif -#endif } /************************************************ * LanczosShader ************************************************/ -#ifdef KWIN_HAVE_OPENGL_COMPOSITING LanczosShader::LanczosShader(QObject* parent) : QObject(parent) , m_shader(0) @@ -690,7 +669,6 @@ bool LanczosShader::init() return true; #endif } -#endif } // namespace diff --git a/lanczosfilter.h b/lanczosfilter.h index ea3f34b9ab..07d67b0e84 100644 --- a/lanczosfilter.h +++ b/lanczosfilter.h @@ -38,9 +38,7 @@ class WindowPaintData; class GLTexture; class GLRenderTarget; class GLShader; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING class LanczosShader; -#endif class LanczosFilter : public QObject @@ -61,14 +59,11 @@ private: void restoreRenderStates(GLTexture* tex, double opacity, double brightness, double saturation); GLTexture *m_offscreenTex; GLRenderTarget *m_offscreenTarget; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING LanczosShader *m_shader; -#endif QBasicTimer m_timer; bool m_inited; }; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING class LanczosShader : public QObject { @@ -94,7 +89,6 @@ private: QVector4D m_kernel[16]; uint m_arbProgram; // TODO: GLuint }; -#endif } // namespace diff --git a/libkwineffects/kwinconfig.h.cmake b/libkwineffects/kwinconfig.h.cmake index a774cf05f8..a8586cc9b6 100644 --- a/libkwineffects/kwinconfig.h.cmake +++ b/libkwineffects/kwinconfig.h.cmake @@ -16,9 +16,6 @@ */ -/* KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available */ -#cmakedefine KWIN_HAVE_OPENGL_COMPOSITING - /* KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available */ #cmakedefine KWIN_HAVE_XRENDER_COMPOSITING diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 57e29db43a..857cc425b5 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -686,21 +686,17 @@ QRegion PaintClipper::paintArea() struct PaintClipper::Iterator::Data { Data() : index(0) {} int index; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING QVector< QRect > rects; -#endif }; PaintClipper::Iterator::Iterator() : data(new Data) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (clip() && effects->compositingType() == OpenGLCompositing) { data->rects = paintArea().rects(); data->index = -1; next(); // move to the first one } -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (clip() && effects->compositingType() == XRenderCompositing) { XserverRegion region = toXserverRegion(paintArea()); @@ -723,10 +719,8 @@ bool PaintClipper::Iterator::isDone() { if (!clip()) return data->index == 1; // run once -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (effects->compositingType() == OpenGLCompositing) return data->index >= data->rects.count(); // run once per each area -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) return data->index == 1; // run once @@ -743,10 +737,8 @@ QRect PaintClipper::Iterator::boundingRect() const { if (!clip()) return infiniteRegion(); -#ifdef KWIN_HAVE_OPENGL_COMPOSITING if (effects->compositingType() == OpenGLCompositing) return data->rects[ data->index ]; -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) return paintArea().boundingRect(); diff --git a/options.cpp b/options.cpp index 8cd8a87ab5..09fa0992c9 100644 --- a/options.cpp +++ b/options.cpp @@ -58,7 +58,6 @@ int currentRefreshRate() int rate = -1; if (options->refreshRate > 0) // use manually configured refresh rate rate = options->refreshRate; -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGLES else if (GLPlatform::instance()->driver() == Driver_NVidia) { QProcess nvidia_settings; @@ -75,7 +74,6 @@ int currentRefreshRate() } } #endif -#endif #ifdef HAVE_XRANDR else if (Extensions::randrAvailable()) { XRRScreenConfiguration *config = XRRGetScreenInfo(display(), rootWindow()); diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 2346a1ea77..e0fc5f7b4a 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -84,8 +84,6 @@ Sources and other compositing managers: // normally only few of them are enabled //#define CHECK_GL_ERROR -#ifdef KWIN_HAVE_OPENGL_COMPOSITING - #include #include @@ -1734,5 +1732,3 @@ bool SceneOpenGLShadow::prepareBackend() } } // namespace - -#endif diff --git a/scene_opengl.h b/scene_opengl.h index 85b2563567..52107ea8f9 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -27,8 +27,6 @@ along with this program. If not, see . #include "kwinglutils.h" -#ifdef KWIN_HAVE_OPENGL_COMPOSITING - #ifdef HAVE_XSHM #include #endif @@ -247,5 +245,3 @@ private: } // namespace #endif - -#endif diff --git a/shadow.cpp b/shadow.cpp index c47b5e9ed7..e60144b356 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -22,9 +22,7 @@ along with this program. If not, see . #include "atoms.h" #include "effects.h" #include "toplevel.h" -#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include "scene_opengl.h" -#endif #ifdef KWIN_HAVE_XRENDER_COMPOSITING #include "scene_xrender.h" #endif @@ -52,9 +50,7 @@ Shadow *Shadow::createShadow(Toplevel *toplevel) if (!data.isEmpty()) { Shadow *shadow = NULL; if (effects->compositingType() == OpenGLCompositing) { -#ifdef KWIN_HAVE_OPENGL_COMPOSITING shadow = new SceneOpenGLShadow(toplevel); -#endif } else if (effects->compositingType() == XRenderCompositing) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING shadow = new SceneXRenderShadow(toplevel);