diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-27 23:36:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-27 23:36:53 +0300 |
commit | b2e94802333247f64369c1164215d26583abda20 (patch) | |
tree | 1721dc1f97f6c27f8b3d2bcae81a854573a281c5 /src/client.cpp | |
parent | 610b13d188cd3faf99b971eea58594b336a57edd (diff) | |
download | plus-b2e94802333247f64369c1164215d26583abda20.tar.gz plus-b2e94802333247f64369c1164215d26583abda20.tar.bz2 plus-b2e94802333247f64369c1164215d26583abda20.tar.xz plus-b2e94802333247f64369c1164215d26583abda20.zip |
Move environment functions into separate file.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/src/client.cpp b/src/client.cpp index d23ec9586..4028856bf 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -118,6 +118,7 @@ #include "utils/cpu.h" #include "utils/delete2.h" +#include "utils/env.h" #include "utils/fuzzer.h" #include "utils/gettext.h" #include "utils/gettexthelper.h" @@ -505,41 +506,6 @@ void Client::initSoundManager() "loginMusic", "Magick - Real.ogg")); } -void Client::updateEnv() -{ -#if defined(WIN32) || defined(__APPLE__) - if (config.getBoolValue("centerwindow")) - setEnv("SDL_VIDEO_CENTERED", "1"); - else - setEnv("SDL_VIDEO_CENTERED", "0"); -#endif - - if (config.getBoolValue("allowscreensaver")) - setEnv("SDL_VIDEO_ALLOW_SCREENSAVER", "1"); - else - setEnv("SDL_VIDEO_ALLOW_SCREENSAVER", "0"); - -#ifndef WIN32 - const int vsync = settings.options.test.empty() - ? config.getIntValue("vsync") : 1; - // __GL_SYNC_TO_VBLANK is nvidia variable. - // vblank_mode is MESA variable. - switch (vsync) - { - case 1: - Client::setEnv("__GL_SYNC_TO_VBLANK", "0"); - Client::setEnv("vblank_mode", "0"); - break; - case 2: - Client::setEnv("__GL_SYNC_TO_VBLANK", "1"); - Client::setEnv("vblank_mode", "1"); - break; - default: - break; - } -#endif -} - void Client::initGraphics() { WindowManager::applyVSync(); @@ -555,21 +521,6 @@ void Client::initGraphics() mainGraphics->beginDraw(); } -void Client::setEnv(const char *const name, const char *const value) -{ - if (!name || !value) - return; -#ifdef WIN32 - if (putenv(const_cast<char*>((std::string(name) - + "=" + value).c_str()))) -#else - if (setenv(name, value, 1)) -#endif - { - logger->log("setenv failed: %s=%s", name, value); - } -} - void Client::testsClear() { if (!settings.options.test.empty()) |