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 00029 00030 namespace KWin 00031 { 00032 00033 class CompositingPrefs 00034 { 00035 public: 00036 CompositingPrefs(); 00037 ~CompositingPrefs(); 00038 00039 class Version : public QStringList 00040 { 00041 public: 00042 Version() : QStringList() {} 00043 Version( const QString& str ); 00044 00045 int compare( const Version& v ) const; 00046 00047 bool operator<( const Version& v ) const { return ( compare( v ) == -1 ); } 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 }; 00052 00053 static bool compositingPossible(); 00054 static QString compositingNotPossibleReason(); 00055 bool enableCompositing() const; 00056 bool enableVSync() const { return mEnableVSync; } 00057 bool enableDirectRendering() const { return mEnableDirectRendering; } 00058 bool strictBinding() const { return mStrictBinding; } 00059 00060 void detect(); 00061 00062 QString driver() const { return mDriver; } 00063 Version version() const { return mVersion; } 00064 bool xgl() const { return mXgl; } 00065 00066 00067 protected: 00068 00069 void detectDriverAndVersion(); 00070 void applyDriverSpecificOptions(); 00071 static bool detectXgl(); 00072 00073 bool initGLXContext(); 00074 void deleteGLXContext(); 00075 00076 00077 private: 00078 QString mGLVendor; 00079 QString mGLRenderer; 00080 QString mGLVersion; 00081 QString mDriver; 00082 Version mVersion; 00083 bool mXgl; 00084 00085 bool mEnableCompositing; 00086 bool mEnableVSync; 00087 bool mEnableDirectRendering; 00088 bool mStrictBinding; 00089 00090 #ifdef KWIN_HAVE_OPENGL_COMPOSITING 00091 GLXContext mGLContext; 00092 Window mGLWindow; 00093 #endif 00094 }; 00095 00096 } 00097 00098 #endif //KWIN_COMPOSITINGPREFS_H 00099 00100