Skip to content

Commit

Permalink
Config: Add an option not to minimize on focus loss
Browse files Browse the repository at this point in the history
See: issue #814
  • Loading branch information
dscharrer committed May 13, 2016
1 parent 36f10c2 commit 73dec56
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/ArxGame.cpp
Expand Up @@ -427,6 +427,7 @@ bool ArxGame::initWindow(RenderWindow * window) {
}

m_MainWindow->setTitle(arx_version);
m_MainWindow->setMinimizeOnFocusLost(config.window.minimizeOnFocusLost);
m_MainWindow->setMinTextureUnits(3);
m_MainWindow->setMaxMSAALevel(config.video.antialiasing ? 8 : 1);
m_MainWindow->setVSync(config.video.vsync ? 1 : 0);
Expand Down
7 changes: 6 additions & 1 deletion src/core/Config.cpp
Expand Up @@ -86,6 +86,7 @@ const bool
colorkeyAntialiasing = true,
limitSpeechWidth = true,
hudScaleInteger = true,
minimizeOnFocusLost = true,
eax = true,
muteOnFocusLost = false,
invertMouse = false,
Expand Down Expand Up @@ -190,7 +191,8 @@ const std::string
// Window options
const std::string
windowFramework = "framework",
windowSize = "size";
windowSize = "size",
minimizeOnFocusLost = "minimize_on_focus_lost";

// Audio options
const std::string
Expand Down Expand Up @@ -432,6 +434,7 @@ bool Config::save() {
std::ostringstream oss;
oss << window.size.x << 'x' << window.size.y;
writer.writeKey(Key::windowSize, oss.str());
writer.writeKey(Key::minimizeOnFocusLost, window.minimizeOnFocusLost);

// audio
writer.beginSection(Section::Audio);
Expand Down Expand Up @@ -558,6 +561,8 @@ bool Config::init(const fs::path & file) {
window.framework = reader.getKey(Section::Window, Key::windowFramework, Default::windowFramework);
std::string windowSize = reader.getKey(Section::Window, Key::windowSize, Default::windowSize);
window.size = parseResolution(windowSize);
window.minimizeOnFocusLost = reader.getKey(Section::Window, Key::minimizeOnFocusLost,
Default::minimizeOnFocusLost);

// Get audio settings
audio.backend = reader.getKey(Section::Audio, Key::audioBackend, Default::audioBackend);
Expand Down
2 changes: 2 additions & 0 deletions src/core/Config.h
Expand Up @@ -146,6 +146,8 @@ class Config {

Vec2i size;

bool minimizeOnFocusLost;

} window;

// section 'audio'
Expand Down

0 comments on commit 73dec56

Please sign in to comment.