From 68f7504fb052758b9a5d30c6e6f0fc9f4a4f5ac8 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Wed, 26 Sep 2007 16:34:08 +0000 Subject: [PATCH] - Add CompositingPrefs::compositingPossible() to check if compositing is supported at all. - Use it in setupCompositing() svn path=/trunk/KDE/kdebase/workspace/; revision=717330 --- composite.cpp | 13 ++++--------- compositingprefs.cpp | 29 +++++++++++++++++++++++++++-- compositingprefs.h | 1 + 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/composite.cpp b/composite.cpp index 8f728e0e2f..62f2a46647 100644 --- a/composite.cpp +++ b/composite.cpp @@ -71,16 +71,11 @@ void Workspace::setupCompositing() kDebug( 1212 ) << "Compositing is turned off in options"; return; } - if( !Extensions::compositeAvailable()) - { - kDebug( 1212 ) << "No composite extension available"; + else if( !CompositingPrefs::compositingPossible() ) + { + kDebug( 1212 ) << "Compositing isn't possible"; return; - } - if( !Extensions::damageAvailable()) - { - kDebug( 1212 ) << "No damage extension available"; - return; - } + } if( scene != NULL ) return; char selection_name[ 100 ]; diff --git a/compositingprefs.cpp b/compositingprefs.cpp index b83752c698..3f9095ee82 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -10,8 +10,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "compositingprefs.h" -#include "options.h" -#include "utils.h" +#include "kwinglobals.h" #include #include @@ -30,8 +29,34 @@ CompositingPrefs::~CompositingPrefs() { } +bool CompositingPrefs::compositingPossible() + { +#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) + Extensions::init(); + if( !Extensions::compositeAvailable()) + { + kDebug( 1212 ) << "No composite extension available"; + return false; + } + if( !Extensions::damageAvailable()) + { + kDebug( 1212 ) << "No damage extension available"; + return false; + } + + return true; +#else + return false; +#endif + } + void CompositingPrefs::detect() { + if( !compositingPossible()) + { + return; + } + #ifdef HAVE_OPENGL // remember and later restore active context GLXContext oldcontext = glXGetCurrentContext(); diff --git a/compositingprefs.h b/compositingprefs.h index b8459f6634..3671f0b3e8 100644 --- a/compositingprefs.h +++ b/compositingprefs.h @@ -40,6 +40,7 @@ public: bool operator>=( const Version& v ) const { return ( compare( v ) != -1 ); } }; + static bool compositingPossible(); bool enableCompositing() const { return mEnableCompositing; } bool enableVSync() const { return mEnableVSync; } bool enableDirectRendering() const { return mEnableDirectRendering; }