Better handling of window focus when compiling for live code.

* Console window is made visible and brought to the front when a compile is triggered.
* Patched application window is brought to the front once patching is complete.

#rb none
#jira UE-71128

#ROBOMERGE-OWNER: ryan.gerleve
#ROBOMERGE-AUTHOR: ben.marsh
#ROBOMERGE-SOURCE: CL 5337696 in //UE4/Release-4.22/... via CL 5338036
#ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking)

[CL 5401218 by ben marsh in Dev-Networking branch]
This commit is contained in:
ben marsh
2019-03-14 16:57:01 -04:00
parent 69e9d698f2
commit 37468fe6fb
3 changed files with 23 additions and 3 deletions

View File

@@ -566,6 +566,23 @@ unsigned int __stdcall ServerCommandThread::CompileThreadProxy(void* context)
return instance->CompileThread();
}
// BEGIN EPIC MOD - Focus application windows on patch complete
BOOL CALLBACK FocusApplicationWindows(HWND WindowHandle, LPARAM Lparam)
{
DWORD WindowProcessId;
GetWindowThreadProcessId(WindowHandle, &WindowProcessId);
const types::vector<LiveProcess*>& Processes = *(const types::vector<LiveProcess*>*)Lparam;
for (LiveProcess* Process : Processes)
{
if (Process->GetProcessId() == WindowProcessId && IsWindowVisible(WindowHandle))
{
SetForegroundWindow(WindowHandle);
}
}
return Windows::TRUE;
}
// END EPIC MOD
void ServerCommandThread::CompileChanges(bool didAllProcessesMakeProgress)
{
@@ -765,6 +782,7 @@ void ServerCommandThread::CompileChanges(bool didAllProcessesMakeProgress)
case LiveModule::ErrorType::SUCCESS:
GLiveCodingServer->GetCompileFinishedDelegate().ExecuteIfBound(ELiveCodingResult::Success, L"Patch creation successful.");
EnumWindows(FocusApplicationWindows, (LPARAM)&m_liveProcesses);
break;
default: