From: Connor McAdams Subject: [PATCH v4 1/2] oleacc: Check proper GUI thread for window focus. Message-Id: <20210912190237.2222780-1-cmcadams@codeweavers.com> Date: Sun, 12 Sep 2021 15:02:36 -0400 From: Connor McAdams Check for window focus against the current foreground window's thread GUI data rather than the currently executing thread's GUI data. Signed-off-by: Connor McAdams --- -v4: Switch from checking the GUI thread data of the HWND we're checking to the foreground window's GUI thread data. dlls/oleacc/client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c index 3b33be55a21..0c2215fe62e 100644 --- a/dlls/oleacc/client.c +++ b/dlls/oleacc/client.c @@ -227,6 +227,7 @@ static HRESULT WINAPI Client_get_accRole(IAccessible *iface, VARIANT varID, VARI static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState) { Client *This = impl_from_Client(iface); + GUITHREADINFO info; LONG style; TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState); @@ -244,7 +245,9 @@ static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT varID, VAR V_I4(pvarState) |= STATE_SYSTEM_UNAVAILABLE; else if(IsWindow(This->hwnd)) V_I4(pvarState) |= STATE_SYSTEM_FOCUSABLE; - if(GetFocus() == This->hwnd) + + info.cbSize = sizeof(info); + if(GetGUIThreadInfo(0, &info) && info.hwndFocus == This->hwnd) V_I4(pvarState) |= STATE_SYSTEM_FOCUSED; if(!(style & WS_VISIBLE)) V_I4(pvarState) |= STATE_SYSTEM_INVISIBLE; -- 2.25.1