KWin
nvidiahack.cpp
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 Lubos Lunak <l.lunak@kde.org> 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 /* 00022 00023 The only purpose of this file is to be later in the link order than 00024 (nvidia's) libGL, thus being initialized by the dynamic linker before it, 00025 allowing it to set __GL_YIELD=NOTHING soon enough for libGL to notice it. 00026 00027 */ 00028 00029 #include <stdlib.h> 00030 #include <kdefakes.h> 00031 00032 class kwinnvidiahack 00033 { 00034 public: 00035 kwinnvidiahack(); 00036 }; 00037 00038 kwinnvidiahack::kwinnvidiahack() 00039 { 00040 const char* env = getenv( "KWIN_NVIDIA_HACK" ); 00041 #if 1 // turned on by default 00042 if( env == NULL || env[ 0 ] != '0' ) 00043 setenv( "__GL_YIELD", "NOTHING", true ); 00044 #else // turned off by default 00045 if( env != NULL && env[ 0 ] != '0' ) 00046 setenv( "__GL_YIELD", "NOTHING", true ); 00047 #endif 00048 } 00049 00050 kwinnvidiahack kwinnvidiahackinst;