From 6ee31384d7a64931a7b648cf040e33dcb349a565 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 18 Jul 2018 14:25:04 -0400 Subject: [PATCH] Add option to disable the console key (closes 655) --- include/openspace/engine/configuration.h | 1 + openspace.cfg | 1 + src/engine/configuration.cpp | 2 ++ src/engine/openspaceengine.cpp | 8 +++++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/openspace/engine/configuration.h b/include/openspace/engine/configuration.h index c6471e08e3..51c97c87c8 100644 --- a/include/openspace/engine/configuration.h +++ b/include/openspace/engine/configuration.h @@ -88,6 +88,7 @@ struct Configuration { bool isRenderingOnMasterDisabled = false; bool isSceneTranslationOnMasterDisabled = false; + bool isConsoleDisabled = false; std::map moduleConfigurations; diff --git a/openspace.cfg b/openspace.cfg index 246881fd16..d8094baa96 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -111,6 +111,7 @@ ScreenshotUseDate = true -- PerSceneCache = true -- DisableRenderingOnMaster = true -- DisableSceneOnMaster = true +-- DisableInGameConsole = true ModuleConfigurations = { Sync = { SynchronizationRoot = "${SYNC}", diff --git a/src/engine/configuration.cpp b/src/engine/configuration.cpp index f1dbf323b7..f774bd0065 100644 --- a/src/engine/configuration.cpp +++ b/src/engine/configuration.cpp @@ -67,6 +67,7 @@ namespace { constexpr const char* KeyRenderingMethod = "RenderingMethod"; constexpr const char* KeyDisableRenderingOnMaster = "DisableRenderingOnMaster"; constexpr const char* KeyDisableSceneOnMaster = "DisableSceneOnMaster"; + constexpr const char* KeyDisableInGameConsole = "DisableInGameConsole"; constexpr const char* KeyScreenshotUseDate = "ScreenshotUseDate"; constexpr const char* KeyHttpProxy = "HttpProxy"; constexpr const char* KeyAddress = "Address"; @@ -284,6 +285,7 @@ void parseLuaState(Configuration& configuration) { getValue(s, KeyPerSceneCache, c.usePerSceneCache); getValue(s, KeyDisableRenderingOnMaster, c.isRenderingOnMasterDisabled); getValue(s, KeyDisableSceneOnMaster, c.isSceneTranslationOnMasterDisabled); + getValue(s, KeyDisableInGameConsole, c.isConsoleDisabled); getValue(s, KeyRenderingMethod, c.renderingMethod); getValue(s, KeyServerPasskey, c.serverPasskey); getValue(s, KeyRequireSocketAuthentication, c.doesRequireSocketAuthentication); diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 13e1e50297..5430462847 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1367,9 +1367,11 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio } } - const bool isConsoleConsumed = _console->keyboardCallback(key, mod, action); - if (isConsoleConsumed) { - return; + if (!_configuration->isConsoleDisabled) { + const bool isConsoleConsumed = _console->keyboardCallback(key, mod, action); + if (isConsoleConsumed) { + return; + } } _navigationHandler->keyboardCallback(key, mod, action);