KWin
compositingprefs.h
Go to the documentation of this file.00001 /******************************************************************** 00002 KWin - the KDE window manager 00003 This file is part of the KDE project. 00004 00005 Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee> 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 *********************************************************************/ 00020 00021 #ifndef KWIN_COMPOSITINGPREFS_H 00022 #define KWIN_COMPOSITINGPREFS_H 00023 00024 #include <QString> 00025 #include <QStringList> 00026 00027 #include "kwinglutils.h" 00028 #include "kwinglobals.h" 00029 00030 00031 namespace KWin 00032 { 00033 00034 class CompositingPrefs 00035 { 00036 public: 00037 CompositingPrefs(); 00038 ~CompositingPrefs(); 00039 00040 class Version : public QStringList 00041 { 00042 public: 00043 Version() : QStringList() {} 00044 Version( const QString& str ); 00045 00046 int compare( const Version& v ) const; 00047 00048 bool operator<( const Version& v ) const { return ( compare( v ) == -1 ); } 00049 bool operator<=( const Version& v ) const { return ( compare( v ) != 1 ); } 00050 bool operator>( const Version& v ) const { return ( compare( v ) == 1 ); } 00051 bool operator>=( const Version& v ) const { return ( compare( v ) != -1 ); } 00052 }; 00053 00054 static bool compositingPossible(); 00055 static QString compositingNotPossibleReason(); 00056 bool validateSetup( CompositingType compositingType ) const; 00057 bool enableCompositing() const; 00058 bool enableVSync() const { return mEnableVSync; } 00059 bool enableDirectRendering() const { return mEnableDirectRendering; } 00060 bool strictBinding() const { return mStrictBinding; } 00061 00062 void detect(); 00063 00064 QString driver() const { return mDriver; } 00065 Version version() const { return mVersion; } 00066 bool xgl() const { return mXgl; } 00067 00068 00069 protected: 00070 00071 void detectDriverAndVersion(); 00072 void applyDriverSpecificOptions(); 00073 static bool detectXgl(); 00074 00075 bool initGLXContext(); 00076 void deleteGLXContext(); 00077 00078 00079 private: 00080 QString mGLVendor; 00081 QString mGLRenderer; 00082 QString mGLVersion; 00083 QString mDriver; 00084 Version mVersion; 00085 bool mXgl; 00086 00087 bool mEnableCompositing; 00088 bool mEnableVSync; 00089 bool mEnableDirectRendering; 00090 bool mStrictBinding; 00091 00092 #ifdef KWIN_HAVE_OPENGL_COMPOSITING 00093 GLXContext mGLContext; 00094 Window mGLWindow; 00095 #endif 00096 }; 00097 00098 } 00099 00100 #endif //KWIN_COMPOSITINGPREFS_H 00101 00102