Fixed Win32 requestFocus in multithreaded environment

This commit is contained in:
hobby8 2019-07-12 10:20:07 +03:00 committed by Lukas Dürrenberger
parent d29c51d82b
commit e85ed33fb2

View File

@ -430,8 +430,9 @@ void WindowImplWin32::setKeyRepeatEnabled(bool enabled)
void WindowImplWin32::requestFocus() void WindowImplWin32::requestFocus()
{ {
// Allow focus stealing only within the same process; compare PIDs of current and foreground window // Allow focus stealing only within the same process; compare PIDs of current and foreground window
DWORD thisPid = GetWindowThreadProcessId(m_handle, NULL); DWORD thisPid, foregroundPid;
DWORD foregroundPid = GetWindowThreadProcessId(GetForegroundWindow(), NULL); GetWindowThreadProcessId(m_handle, &thisPid);
GetWindowThreadProcessId(GetForegroundWindow(), &foregroundPid);
if (thisPid == foregroundPid) if (thisPid == foregroundPid)
{ {