Connor McAdams : oleacc: Add Client_get_accFocus implementation.

Alexandre Julliard julliard at winehq.org
Mon Sep 20 16:26:20 CDT 2021


Module: wine
Branch: master
Commit: 57895ed8aeb3f32989e6f80de25ef158a2a3d6d2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=57895ed8aeb3f32989e6f80de25ef158a2a3d6d2

Author: Connor McAdams <cmcadams at codeweavers.com>
Date:   Mon Sep 20 18:03:25 2021 +0200

oleacc: Add Client_get_accFocus implementation.

Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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)




More information about the wine-cvs mailing list