only show the terminal if requested

develop
Myk Taylor 2023-05-03 14:34:48 -07:00
parent bebf3584ba
commit ad5a0d41f5
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 4 additions and 9 deletions

@ -508,7 +508,7 @@ bool Console::init(bool)
inited = true;
// DOESN'T WORK - locks up DF!
// ForceForegroundWindow(d->MainWindow);
SetForegroundWindow(d->MainWindow);
hide();
return true;
}
// FIXME: looks awfully empty, doesn't it?
@ -609,7 +609,6 @@ void Console::msleep (unsigned int msec)
bool Console::hide()
{
ShowWindow( GetConsoleWindow(), SW_HIDE );
SetForegroundWindow(d->MainWindow);
return true;
}

@ -1304,10 +1304,6 @@ static void run_dfhack_init(color_ostream &out, Core *core)
return;
}
// if we're running on Steam Deck, hide the terminal by default
if (DFSteam::DFIsSteamRunningOnSteamDeck())
core->getConsole().hide();
// load baseline defaults
core->loadScriptFile(out, CONFIG_PATH + "init/default.dfhack.init", false);
@ -1315,13 +1311,13 @@ static void run_dfhack_init(color_ostream &out, Core *core)
std::vector<std::string> prefixes(1, "dfhack");
loadScriptFiles(core, out, prefixes, CONFIG_PATH + "init");
// if the option is set, hide the terminal
// show the terminal if requested
auto L = Lua::Core::State;
Lua::StackUnwinder top(L);
Lua::CallLuaModuleFunction(out, L, "dfhack", "getHideConsoleOnStartup", 0, 1,
Lua::DEFAULT_LUA_LAMBDA, [&](lua_State* L) {
if (lua_toboolean(L, -1))
core->getConsole().hide();
if (!lua_toboolean(L, -1))
core->getConsole().show();
}, false);
}