Module: wine Branch: master Commit: 57895ed8aeb3f32989e6f80de25ef158a2a3d6d2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=57895ed8aeb3f32989e6f80de...
Author: Connor McAdams cmcadams@codeweavers.com Date: Mon Sep 20 18:03:25 2021 +0200
oleacc: Add Client_get_accFocus implementation.
Signed-off-by: Connor McAdams cmcadams@codeweavers.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/oleacc/client.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c index 0c2215fe62e..93f6b590f78 100644 --- a/dlls/oleacc/client.c +++ b/dlls/oleacc/client.c @@ -303,11 +303,37 @@ static HRESULT WINAPI Client_get_accKeyboardShortcut(IAccessible *iface, return S_OK; }
-static HRESULT WINAPI Client_get_accFocus(IAccessible *iface, VARIANT *pvarID) +static HRESULT WINAPI Client_get_accFocus(IAccessible *iface, VARIANT *focus) { Client *This = impl_from_Client(iface); - FIXME("(%p)->(%p)\n", This, pvarID); - return E_NOTIMPL; + GUITHREADINFO info; + + TRACE("(%p)->(%p)\n", This, focus); + + V_VT(focus) = VT_EMPTY; + info.cbSize = sizeof(info); + if(GetGUIThreadInfo(0, &info) && info.hwndFocus) { + if(info.hwndFocus == This->hwnd) { + V_VT(focus) = VT_I4; + V_I4(focus) = CHILDID_SELF; + } + else if(IsChild(This->hwnd, info.hwndFocus)) { + IDispatch *disp; + HRESULT hr; + + hr = AccessibleObjectFromWindow(info.hwndFocus, OBJID_WINDOW, + &IID_IDispatch, (void**)&disp); + if(FAILED(hr)) + return hr; + if(!disp) + return E_FAIL; + + V_VT(focus) = VT_DISPATCH; + V_DISPATCH(focus) = disp; + } + } + + return S_OK; }
static HRESULT WINAPI Client_get_accSelection(IAccessible *iface, VARIANT *pvarID)