From b2e94802333247f64369c1164215d26583abda20 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 27 Jun 2015 23:36:53 +0300 Subject: Move environment functions into separate file. --- src/client.cpp | 51 +-------------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) (limited to 'src/client.cpp') 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((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()) -- cgit v1.2.3-60-g2f50