Hi Connor,
On 9/17/21 6:37 PM, Connor McAdams wrote:
@@ -306,8 +306,26 @@ static HRESULT WINAPI Client_get_accKeyboardShortcut(IAccessible *iface, static HRESULT WINAPI Client_get_accFocus(IAccessible *iface, VARIANT *pvarID) { Client *This = impl_from_Client(iface);
- FIXME("(%p)->(%p)\n", This, pvarID);
- return E_NOTIMPL;
- GUITHREADINFO info;
- TRACE("(%p)->(%p)\n", This, pvarID);
- V_VT(pvarID) = VT_EMPTY;
- info.cbSize = sizeof(info);
- if(GetGUIThreadInfo(0, &info) && info.hwndFocus) {
if(info.hwndFocus == This->hwnd) {
V_VT(pvarID) = VT_I4;
V_I4(pvarID) = CHILDID_SELF;
}
else if(IsChild(This->hwnd, info.hwndFocus)) {
V_VT(pvarID) = VT_DISPATCH;
if(FAILED(AccessibleObjectFromWindow(info.hwndFocus, OBJID_WINDOW,
&IID_IDispatch, (void**)&V_DISPATCH(pvarID))))
V_VT(pvarID) = VT_EMPTY;
The child case seems to be not right. You should propagate error from AccessibleObjectFromWindow and check if returned interface pointer is not NULL. It should probably look like this: hr = AccessibleObjectFromWindow(info.hwndFocus, OBJID_WINDOW, &IID_IDispatch, (void**)&disp); if (FAILED(hr)) return hr; if (!disp) return E_FAIL;
V_VT(pvarID) = VT_DISPATCH; V_DISPATCH(pvarID) = disp;
It would be also nice to rename the pvarID argument to e.g. focus.
Thanks, Piotr