Merge pull request #3349 from myk002/myk_background_foreground

fix fullscreen DF minimizing on startup
develop
Myk 2023-05-03 14:45:16 -07:00 committed by GitHub
commit 823119694f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

@ -40,6 +40,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes
## Misc Improvements
- Terminal console no longer appears in front of the game window on startup
## Documentation

@ -508,6 +508,7 @@ bool Console::init(bool)
inited = true;
// DOESN'T WORK - locks up DF!
// ForceForegroundWindow(d->MainWindow);
hide();
return true;
}
// FIXME: looks awfully empty, doesn't it?

@ -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);
}