From ff6ebfe14faee0aaca86fa8e8f38eae8e996a4cd Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Wed, 22 Sep 2021 16:12:35 -0400 Subject: [PATCH 2/3] oleacc: Add get_accRole implementation for edit client accessible object. To: wine-devel Signed-off-by: Connor McAdams --- dlls/oleacc/client.c | 32 ++++++++++++++++++++++++++++---- dlls/oleacc/oleacc_private.h | 1 + 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c index 333a95dc388..4a0471a2657 100644 --- a/dlls/oleacc/client.c +++ b/dlls/oleacc/client.c @@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(oleacc); +typedef struct win_class_vtbl win_class_vtbl; typedef struct { IAccessible IAccessible_iface; IOleWindow IOleWindow_iface; @@ -35,8 +36,15 @@ typedef struct { HWND hwnd; HWND enum_pos; + INT role; + + const win_class_vtbl *vtbl; } Client; +struct win_class_vtbl { + void (*init)(Client*); +}; + static inline Client* impl_from_Client(IAccessible *iface) { return CONTAINING_RECORD(iface, Client, IAccessible_iface); @@ -221,7 +229,7 @@ static HRESULT WINAPI Client_get_accRole(IAccessible *iface, VARIANT varID, VARI } V_VT(pvarRole) = VT_I4; - V_I4(pvarRole) = ROLE_SYSTEM_CLIENT; + V_I4(pvarRole) = This->role; return S_OK; } @@ -651,12 +659,21 @@ static const IEnumVARIANTVtbl ClientEnumVARIANTVtbl = { Client_EnumVARIANT_Clone }; +static void edit_init(Client *client) +{ + client->role = ROLE_SYSTEM_TEXT; +} + +static const win_class_vtbl edit_vtbl = { + edit_init, +}; + static const struct win_class_data classes[] = { {WC_LISTBOXW, 0x10000, TRUE}, {L"#32768", 0x10001, TRUE}, /* menu */ {WC_BUTTONW, 0x10002, TRUE}, {WC_STATICW, 0x10003, TRUE}, - {WC_EDITW, 0x10004, TRUE}, + {WC_EDITW, 0x10004, TRUE, &edit_vtbl}, {WC_COMBOBOXW, 0x10005, TRUE}, {L"#32770", 0x10006, TRUE}, /* dialog */ {L"#32771", 0x10007, TRUE}, /* winswitcher */ @@ -686,8 +703,9 @@ static const struct win_class_data classes[] = { HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj) { + const struct win_class_data *data; Client *client; - HRESULT hres; + HRESULT hres = S_OK; if(!IsWindow(hwnd)) return E_FAIL; @@ -696,7 +714,7 @@ HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj) if(!client) return E_OUTOFMEMORY; - find_class_data(hwnd, classes); + data = find_class_data(hwnd, classes); client->IAccessible_iface.lpVtbl = &ClientVtbl; client->IOleWindow_iface.lpVtbl = &ClientOleWindowVtbl; @@ -704,6 +722,12 @@ HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj) client->ref = 1; client->hwnd = hwnd; client->enum_pos = 0; + client->role = ROLE_SYSTEM_CLIENT; + + if(data) + client->vtbl = data->vtbl; + if(client->vtbl && client->vtbl->init) + client->vtbl->init(client); hres = IAccessible_QueryInterface(&client->IAccessible_iface, iid, obj); IAccessible_Release(&client->IAccessible_iface); diff --git a/dlls/oleacc/oleacc_private.h b/dlls/oleacc/oleacc_private.h index 64926b6abb7..a01fc3615fe 100644 --- a/dlls/oleacc/oleacc_private.h +++ b/dlls/oleacc/oleacc_private.h @@ -22,6 +22,7 @@ struct win_class_data { const WCHAR *name; DWORD idx; BOOL stub; + const void *vtbl; }; const struct win_class_data* find_class_data(HWND, const struct win_class_data*) DECLSPEC_HIDDEN; -- 2.32.0