Added the standard accessible object, added it to a few navigation-related places to make Inspect.exe's life easier, and added some more get_accName() debug stuff.

This commit is contained in:
Pietro Gagliardi 2015-01-04 01:13:35 -05:00
parent 3a9842e86c
commit 085fc00f81
3 changed files with 16 additions and 4 deletions

View File

@ -9,6 +9,7 @@
#define STRICT #define STRICT
#define STRICT_TYPED_ITEMIDS #define STRICT_TYPED_ITEMIDS
#define CINTERFACE #define CINTERFACE
#define COBJMACROS
// get Windows version right; right now Windows XP // get Windows version right; right now Windows XP
#define WINVER 0x0501 #define WINVER 0x0501
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501

View File

@ -4,7 +4,7 @@ struct tableAcc {
IAccessibleVtbl *vtbl; IAccessibleVtbl *vtbl;
ULONG refcount; ULONG refcount;
struct table *t; struct table *t;
// TODO create a standard accessible object IAccessible *std;
}; };
#define TA ((struct tableAcc *) this) #define TA ((struct tableAcc *) this)
@ -38,6 +38,7 @@ static ULONG STDMETHODCALLTYPE tableAccRelease(IAccessible *this)
{ {
TA->refcount--; TA->refcount--;
if (TA->refcount == 0) { if (TA->refcount == 0) {
IAccessible_Release(TA->std);
tableFree(TA, "error freeing Table accessibility object"); tableFree(TA, "error freeing Table accessibility object");
return 0; return 0;
} }
@ -103,12 +104,14 @@ static HRESULT STDMETHODCALLTYPE tableAccget_accName(IAccessible *this, VARIANT
printf("tableAccget_accName()\n"); printf("tableAccget_accName()\n");
// TODO check pointer // TODO check pointer
if (varChild.vt != VT_I4) { if (varChild.vt != VT_I4) {
printf("invalid arg\n");
*pszName = NULL; *pszName = NULL;
return E_INVALIDARG; return E_INVALIDARG;
} }
if (varChild.lVal == CHILDID_SELF) if (varChild.lVal == CHILDID_SELF)
; // TODO standard accessible object ; // TODO standard accessible object
// TODO actually get the real name // TODO actually get the real name
printf("returning name\n");
*pszName = SysAllocString("This is a test of the accessibility interface."); *pszName = SysAllocString("This is a test of the accessibility interface.");
// TODO check null pointer // TODO check null pointer
return S_OK; return S_OK;
@ -183,19 +186,19 @@ static HRESULT STDMETHODCALLTYPE tableAccaccSelect(IAccessible *this, long flags
static HRESULT STDMETHODCALLTYPE tableAccaccLocation(IAccessible *this, long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild) static HRESULT STDMETHODCALLTYPE tableAccaccLocation(IAccessible *this, long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild)
{ {
// TODO // TODO
return DISP_E_MEMBERNOTFOUND; return IAccessible_accLocation(TA->std, pxLeft, pyTop, pcxWidth, pcyHeight, varChild);
} }
static HRESULT STDMETHODCALLTYPE tableAccaccNavigate(IAccessible *this, long navDir, VARIANT varStart, VARIANT *pvarEndUpAt) static HRESULT STDMETHODCALLTYPE tableAccaccNavigate(IAccessible *this, long navDir, VARIANT varStart, VARIANT *pvarEndUpAt)
{ {
// TODO // TODO
return DISP_E_MEMBERNOTFOUND; return IAccessible_accNavigate(TA->std, navDir, varStart, pvarEndUpAt);
} }
static HRESULT STDMETHODCALLTYPE tableAccaccHitTest(IAccessible *this, long xLeft, long yTop, VARIANT *pvarChild) static HRESULT STDMETHODCALLTYPE tableAccaccHitTest(IAccessible *this, long xLeft, long yTop, VARIANT *pvarChild)
{ {
// TODO // TODO
return DISP_E_MEMBERNOTFOUND; return IAccessible_accHitTest(TA->std, xLeft, yTop, pvarChild);
} }
static HRESULT STDMETHODCALLTYPE tableAccaccDoDefaultAction(IAccessible *this, VARIANT varChild) static HRESULT STDMETHODCALLTYPE tableAccaccDoDefaultAction(IAccessible *this, VARIANT varChild)
@ -250,11 +253,18 @@ static const IAccessibleVtbl tableAccVtbl = {
static struct tableAcc *newTableAcc(struct table *t) static struct tableAcc *newTableAcc(struct table *t)
{ {
struct tableAcc *ta; struct tableAcc *ta;
HRESULT hr;
IAccessible *std;
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object"); ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object");
ta->vtbl = &tableAccVtbl; ta->vtbl = &tableAccVtbl;
ta->vtbl->AddRef(ta); ta->vtbl->AddRef(ta);
ta->t = t; ta->t = t;
hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, &std);
if (hr != S_OK)
// TODO panichresult
panic("error creating standard accessible object for Table");
ta->std = std;
return ta; return ta;
} }

View File

@ -4,6 +4,7 @@
#define STRICT #define STRICT
#define STRICT_TYPED_ITEMIDS #define STRICT_TYPED_ITEMIDS
#define CINTERFACE #define CINTERFACE
#define COBJMACROS
// get Windows version right; right now Windows XP // get Windows version right; right now Windows XP
#define WINVER 0x0501 #define WINVER 0x0501
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501