Piotr Caban : oleacc: Add partial Window_accHitTest implementation.

Alexandre Julliard julliard at winehq.org
Thu Nov 25 16:00:26 CST 2021


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Nov 25 18:54:58 2021 +0100

oleacc: Add partial Window_accHitTest implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleacc/window.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/dlls/oleacc/window.c b/dlls/oleacc/window.c
index aa433d624cf..87f9956b49e 100644
--- a/dlls/oleacc/window.c
+++ b/dlls/oleacc/window.c
@@ -247,11 +247,38 @@ static HRESULT WINAPI Window_accNavigate(IAccessible *iface,
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI Window_accHitTest(IAccessible *iface,
-        LONG xLeft, LONG yTop, VARIANT *pvarID)
+static HRESULT WINAPI Window_accHitTest(IAccessible *iface, LONG x, LONG y, VARIANT *v)
 {
     Window *This = impl_from_Window(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, xLeft, yTop, pvarID);
+    IDispatch *disp;
+    POINT pt;
+    HRESULT hr;
+    RECT rect;
+
+    TRACE("(%p)->(%d %d %p)\n", This, x, y, v);
+
+    V_VT(v) = VT_EMPTY;
+    if (!GetClientRect(This->hwnd, &rect))
+        return E_FAIL;
+    if (!ClientToScreen(This->hwnd, (POINT*)&rect) ||
+            !ClientToScreen(This->hwnd, &((POINT*)&rect)[1]))
+        return E_FAIL;
+    pt.x = x;
+    pt.y = y;
+    if (PtInRect(&rect, pt))
+    {
+        hr = AccessibleObjectFromWindow(This->hwnd, OBJID_CLIENT, &IID_IDispatch, (void**)&disp);
+        if (FAILED(hr))
+            return hr;
+        if (!disp)
+            return E_FAIL;
+
+        V_VT(v) = VT_DISPATCH;
+        V_DISPATCH(v) = disp;
+        return S_OK;
+    }
+
+    FIXME("non-client area not handled yet\n");
     return E_NOTIMPL;
 }
 




More information about the wine-cvs mailing list