1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Added AltTabFix=noactivateapp setting

Fixes alt-tabbing in Tonic Trouble (issue #286).
This commit is contained in:
narzoul 2024-04-14 15:40:54 +02:00
parent 8e84130378
commit 5b35b3b261
2 changed files with 17 additions and 4 deletions

View File

@ -9,16 +9,23 @@ namespace Config
class AltTabFix : public EnumSetting
{
public:
enum Values { OFF, KEEPVIDMEM };
enum Values { OFF, KEEPVIDMEM, NOACTIVATEAPP };
AltTabFix()
: EnumSetting("AltTabFix", "off", { "off", "keepvidmem" })
: EnumSetting("AltTabFix", "off", { "off", "keepvidmem", "noactivateapp" })
{
}
virtual ParamInfo getParamInfo() const override
{
return KEEPVIDMEM == m_value ? ParamInfo{ "KeepPrimary", 0, 1, 1 } : ParamInfo{};
switch (m_value)
{
case KEEPVIDMEM:
return { "KeepPrimary", 0, 1, 1 };
case NOACTIVATEAPP:
return { "PassToApp", 0, 1, 1 };
}
return {};
}
};
}

View File

@ -183,12 +183,18 @@ namespace
if (origWndProc)
{
auto tagSurface = DDraw::TagSurface::findFullscreenWindow();
if (tagSurface && tagSurface->getExclusiveOwnerThreadId() != GetCurrentThreadId())
if (tagSurface && tagSurface->getExclusiveOwnerThreadId() != GetCurrentThreadId() ||
Config::Settings::AltTabFix::NOACTIVATEAPP == Config::altTabFix.get())
{
if (!wParam)
{
ShowWindow(hwnd, SW_SHOWMINNOACTIVE);
}
if (Config::Settings::AltTabFix::NOACTIVATEAPP == Config::altTabFix.get() &&
0 == Config::altTabFix.getParam())
{
return LOG_RESULT(0);
}
return LOG_RESULT(CallWindowProcA(origWndProc, hwnd, WM_ACTIVATEAPP, wParam, lParam));
}
}