blob: bb50dd3c8b40ca5af992846ed280c9e06faf8f28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// 24 december 2014
struct tableAcc {
IAccessibleVtbl *vtbl;
ULONG refcount;
struct table *t;
};
static HRESULT STDMETHODCALLTYPE tableAccQueryInterface(IUnknown *this, REFIID riid, void **ppvObject)
{
if (ppvObject == NULL)
return E_POINTER;
if (IsEqualIID(riid, IID_IUnknown) ||
0)// IsEqualIID(riid, IID_IDispatch)
{// IsEqualIID(riid, IID_IAccessible) {
*ppvObject = (void *) this;
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
#define TA ((struct tableAcc *) this)
// TODO use InterlockedIncrement()/InterlockedDecrement() for these?
static ULONG STDMETHODCALLTYPE tableAccAddRef(IUnknown *this)
{
TA->refcount++;
return TA->refcount;
}
static ULONG STDMETHODCALLTYPE tableAccRelease(IUnknown *this)
{
TA->refcount--;
if (TA->refcount == 0) {
tableFree(TA, "error freeing Table accessibility object");
return 0;
}
return TA->refcount;
}
static const IAccessibleVtbl tableAccVtbl = {
.QueryInterface = tableAccQueryInterface,
.AddRef = tableAccAddRef,
.Release = tableAccRelease,
};
static struct tableAcc *newTableAcc(struct table *t)
{
struct tableAcc *ta;
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object");
ta->vtbl = &tableAccVtbl;
ta->vtbl->AddRef(vtbl);
ta->t = t;
return ta;
}
static void freeTableAcc(struct tableAcc *ta)
{
ta->t = NULL;
ta->vtbl->Release(ta);
}
HANDLER(accessibilityHandler)
{
if (uMsg != WM_GETOBJECT)
return FALSE;
if (wParam != OBJID_CLIENT)
return FALSE;
*lResult = LresultFromObject(IID_IUnknown, wParam, t->ta);
// TODO check *lResult
return TRUE;
}
|