From: Piotr Caban Subject: [PATCH 1/2 v5] oleacc: Check proper GUI thread for window focus. Message-Id: <629a4844-8765-cdd0-6973-fbfc2ae09717@codeweavers.com> Date: Thu, 16 Sep 2021 13:54:17 +0200 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 Signed-off-by: Piotr Caban --- v5: - cleaned up the tests 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;