From b7d2b16b8d54a51b4a07a2bb5263adaac6e2c037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 13 Aug 2011 10:36:50 +0200 Subject: [PATCH] Remove define KWIN_HAVE_COMPOSITING Building the workspaces requires to have all the build dependencies which were required for KWIN_HAVE_COMPOSITING to be set. This allows us to remove all the ifdefs for this and gives us a cleaner code. --- CMakeLists.txt | 33 +++++++------------------------ composite.cpp | 20 ------------------- compositingprefs.cpp | 9 --------- libkwineffects/kwinconfig.h.cmake | 3 --- 4 files changed, 7 insertions(+), 58 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ddd4c8610..46e9c81da9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,36 +28,19 @@ if(KWIN_PLASMA_ACTIVE) set(KWIN_BUILD_WITH_OPENGLES ON) endif(KWIN_PLASMA_ACTIVE) -# KWIN_HAVE_COMPOSITING - whether any compositing support is available -if( X11_Xcomposite_FOUND AND X11_Xdamage_FOUND ) - set( KWIN_HAVE_COMPOSITING 1 ) -endif( X11_Xcomposite_FOUND AND X11_Xdamage_FOUND ) +# KWIN_HAVE_OPENGL_COMPOSITING - always have either OpenGL or OpenGL ES +set( KWIN_HAVE_OPENGL_COMPOSITING 1 ) -# KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available -if( KWIN_HAVE_COMPOSITING AND OPENGL_FOUND ) - set( KWIN_HAVE_OPENGL_COMPOSITING 1 ) -endif( KWIN_HAVE_COMPOSITING AND OPENGL_FOUND ) - -# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available -if( KWIN_HAVE_COMPOSITING AND X11_Xrender_FOUND AND X11_Xfixes_FOUND AND KWIN_BUILD_XRENDER_COMPOSITING ) +# 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_HAVE_COMPOSITING AND X11_Xrender_FOUND AND X11_Xfixes_FOUND AND KWIN_BUILD_XRENDER_COMPOSITING ) +endif( KWIN_BUILD_XRENDER_COMPOSITING ) # KWIN_HAVE_OPENGLES_COMPOSITING - whether OpenGL ES-based compositing support is available -if( KWIN_HAVE_COMPOSITING AND OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES) - set( KWIN_HAVE_OPENGL_COMPOSITING 1) +if( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES) set( KWIN_HAVE_OPENGLES_COMPOSITING 1 ) message("Compiling KWin for mobile.") -endif( KWIN_HAVE_COMPOSITING AND OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES ) - -# safety -if( KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING ) - # ok -else( KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING ) - set( KWIN_HAVE_COMPOSITING ) # unset -endif( KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING ) - -macro_log_feature(KWIN_HAVE_COMPOSITING "Compositing support" "X11 Compositing support" "http://www.x.org/" FALSE "" "XComposite and XDamage extensions and OpenGL or XRender with XFixes are required for KWin compositing support") +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 ) @@ -101,9 +84,7 @@ if( KWIN_BUILD_DECORATIONS ) endif( KWIN_BUILD_DECORATIONS ) add_subdirectory( data ) -if( KWIN_HAVE_COMPOSITING ) add_subdirectory( effects ) -endif( KWIN_HAVE_COMPOSITING ) ########### next target ############### diff --git a/composite.cpp b/composite.cpp index edffac1be3..0675caac97 100644 --- a/composite.cpp +++ b/composite.cpp @@ -85,7 +85,6 @@ extern int currentRefreshRate(); void Workspace::setupCompositing() { -#ifdef KWIN_HAVE_COMPOSITING if (scene != NULL) return; if (compositingSuspended) { @@ -154,11 +153,7 @@ void Workspace::setupCompositing() break; #endif default: -#ifndef KWIN_HAVE_COMPOSITING - kDebug(1212) << "Compositing was not available at compile time"; -#else kDebug(1212) << "No compositing enabled"; -#endif delete cm_selection; return; } @@ -191,14 +186,10 @@ void Workspace::setupCompositing() foreach (Unmanaged * c, unmanaged) c->setupCompositing(); discardPopup(); // force re-creation of the Alt+F3 popup (opacity option) -#else - kDebug(1212) << "Compositing was not available at compile time"; -#endif } void Workspace::finishCompositing() { -#ifdef KWIN_HAVE_COMPOSITING if (scene == NULL) return; m_finishingCompositing = true; @@ -241,7 +232,6 @@ void Workspace::finishCompositing() while (!deleted.isEmpty()) deleted.first()->discard(Allowed); m_finishingCompositing = false; -#endif } // OpenGL self-check failed, fallback to XRender @@ -377,7 +367,6 @@ void Workspace::timerEvent(QTimerEvent *te) void Workspace::performCompositing() { -#ifdef KWIN_HAVE_COMPOSITING if (((repaints_region.isEmpty() && !windowRepaintsPending()) // no damage || !scene->overlayWindow()->isVisible())) { // nothing is visible anyway vBlankPadding += 3; @@ -427,7 +416,6 @@ void Workspace::performCompositing() // checkCompositeTime() would restart it again somewhen later, called from functions that // would again add something pending. checkCompositeTimer(); -#endif } void Workspace::performMousePoll() @@ -532,7 +520,6 @@ void Workspace::delayedCheckUnredirect() void Toplevel::setupCompositing() { -#ifdef KWIN_HAVE_COMPOSITING if (!compositing()) return; damageRatio = 0.0; @@ -545,12 +532,10 @@ void Toplevel::setupCompositing() unredirect = false; workspace()->checkUnredirect(true); scene->windowAdded(this); -#endif } void Toplevel::finishCompositing() { -#ifdef KWIN_HAVE_COMPOSITING damageRatio = 0.0; if (damage_handle == None) return; @@ -564,7 +549,6 @@ void Toplevel::finishCompositing() damage_region = QRegion(); repaints_region = QRegion(); effect_window = NULL; -#endif } void Toplevel::discardWindowPixmap() @@ -581,7 +565,6 @@ void Toplevel::discardWindowPixmap() Pixmap Toplevel::createWindowPixmap() { -#ifdef KWIN_HAVE_COMPOSITING assert(compositing()); if (unredirected()) return None; @@ -600,9 +583,6 @@ Pixmap Toplevel::createWindowPixmap() } ungrabXServer(); return pix; -#else - return None; -#endif } #ifdef HAVE_XDAMAGE diff --git a/compositingprefs.cpp b/compositingprefs.cpp index a6d354a891..3b952b56a4 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -69,7 +69,6 @@ bool CompositingPrefs::compositingPossible() gl_workaround_group.readEntry("OpenGLIsUnsafe", false)) return false; -#ifdef KWIN_HAVE_COMPOSITING Extensions::init(); if (!Extensions::compositeAvailable()) { kDebug(1212) << "No composite extension available"; @@ -92,14 +91,10 @@ bool CompositingPrefs::compositingPossible() #endif kDebug(1212) << "No OpenGL or XRender/XFixes support"; return false; -#else - return false; -#endif } QString CompositingPrefs::compositingNotPossibleReason() { -#ifdef KWIN_HAVE_COMPOSITING // first off, check whether we figured that we'll crash on detection because of a buggy driver KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc"); KConfigGroup gl_workaround_group(config, "Compositing"); @@ -129,10 +124,6 @@ QString CompositingPrefs::compositingNotPossibleReason() } #endif return QString(); -#else - return i18n("Compositing was disabled at compile time.\n" - "It is likely Xorg development headers were not installed."); -#endif } static bool s_glxDetected = false; diff --git a/libkwineffects/kwinconfig.h.cmake b/libkwineffects/kwinconfig.h.cmake index 381231908d..a774cf05f8 100644 --- a/libkwineffects/kwinconfig.h.cmake +++ b/libkwineffects/kwinconfig.h.cmake @@ -16,9 +16,6 @@ */ -/* KWIN_HAVE_COMPOSITING - whether any compositing support is available */ -#cmakedefine KWIN_HAVE_COMPOSITING - /* KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available */ #cmakedefine KWIN_HAVE_OPENGL_COMPOSITING