[PATCH v2 1/2] oleacc: Add Client_get_accFocus implementation.

Connor McAdams cmcadams at codeweavers.com
Sat Sep 18 12:27:49 CDT 2021


Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
---
 dlls/oleacc/client.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c
index 0c2215fe62e..38611520b38 100644
--- a/dlls/oleacc/client.c
+++ b/dlls/oleacc/client.c
@@ -303,11 +303,35 @@ 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;
+    HRESULT hr;
+
+    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;
+
+            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)
-- 
2.25.1




More information about the wine-devel mailing list