forked from Mirrors/openclonk
Win32: Stop trying to steal focus from other apps
If the user switched away from OC while it was loading, there was probably a reason for that. We'll no longer assume we're the most important app in the world and steal the focus away from whatever the user was doing.shapetextures
parent
f7ed26eb9e
commit
33e2626649
|
@ -817,24 +817,8 @@ void C4Application::OnCommand(const char *szCmd)
|
|||
void C4Application::Activate()
|
||||
{
|
||||
#ifdef USE_WIN32_WINDOWS
|
||||
// Activate the application to regain focus if it has been lost during loading.
|
||||
// As this is officially not possible any more in new versions of Windows
|
||||
// (BringWindowTopTop alone won't have any effect if the calling process is
|
||||
// not in the foreground itself), we are using an ugly OS hack.
|
||||
DWORD nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0);
|
||||
DWORD nAppThread = GetCurrentThreadId();
|
||||
if (nForeThread != nAppThread)
|
||||
{
|
||||
AttachThreadInput(nForeThread, nAppThread, true);
|
||||
BringWindowToTop(FullScreen.hWindow);
|
||||
ShowWindow(FullScreen.hWindow, SW_SHOW);
|
||||
AttachThreadInput(nForeThread, nAppThread, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
BringWindowToTop(FullScreen.hWindow);
|
||||
ShowWindow(FullScreen.hWindow, SW_SHOW);
|
||||
}
|
||||
BringWindowToTop(FullScreen.hWindow);
|
||||
ShowWindow(FullScreen.hWindow, SW_SHOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue