From e85ed33fb2970f23559bb3b51ec22be7acc00d21 Mon Sep 17 00:00:00 2001 From: hobby8 Date: Fri, 12 Jul 2019 10:20:07 +0300 Subject: [PATCH] Fixed Win32 requestFocus in multithreaded environment --- src/SFML/Window/Win32/WindowImplWin32.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index e6f5668e6..a424843e2 100755 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -430,8 +430,9 @@ void WindowImplWin32::setKeyRepeatEnabled(bool enabled) void WindowImplWin32::requestFocus() { // Allow focus stealing only within the same process; compare PIDs of current and foreground window - DWORD thisPid = GetWindowThreadProcessId(m_handle, NULL); - DWORD foregroundPid = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + DWORD thisPid, foregroundPid; + GetWindowThreadProcessId(m_handle, &thisPid); + GetWindowThreadProcessId(GetForegroundWindow(), &foregroundPid); if (thisPid == foregroundPid) {