Windows: Don't use the foreground setting code if the window is already foreground

This commit is contained in:
Mounir IDRASSI 2016-03-23 22:50:28 +01:00
parent ece26c7481
commit 1e204da223

View File

@ -6954,6 +6954,8 @@ void BringToForeground(HWND hWnd)
DWORD dwThisTID = ::GetCurrentThreadId(), DWORD dwThisTID = ::GetCurrentThreadId(),
dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0); dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0);
if (hCurrWnd != hWnd)
{
if(dwThisTID != dwCurrTID) if(dwThisTID != dwCurrTID)
{ {
::AttachThreadInput(dwThisTID, dwCurrTID, TRUE); ::AttachThreadInput(dwThisTID, dwCurrTID, TRUE);
@ -6971,6 +6973,7 @@ void BringToForeground(HWND hWnd)
::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE); ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
::AttachThreadInput(dwThisTID, dwCurrTID, FALSE); ::AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
} }
}
#ifdef TCMOUNT #ifdef TCMOUNT
if (hWnd == MainDlg) if (hWnd == MainDlg)