Connor McAdams : oleacc: Add get_accState function for edit client accessible object.
Alexandre Julliard
julliard at winehq.org
Mon Sep 27 15:21:45 CDT 2021
Module: wine
Branch: master
Commit: 44fba34992ee4a7fbd0f4e18267304f7bb42e5d2
URL: https://source.winehq.org/git/wine.git/?a=commit;h=44fba34992ee4a7fbd0f4e18267304f7bb42e5d2
Author: Connor McAdams <cmcadams at codeweavers.com>
Date: Mon Sep 27 16:10:59 2021 +0200
oleacc: Add get_accState function for edit client accessible object.
Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/oleacc/client.c | 60 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 15 deletions(-)
diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c
index fe9026e5bc1..c94be37df0f 100644
--- a/dlls/oleacc/client.c
+++ b/dlls/oleacc/client.c
@@ -18,6 +18,7 @@
#define COBJMACROS
+#include <assert.h>
#include "oleacc_private.h"
#include "commctrl.h"
@@ -43,6 +44,7 @@ typedef struct {
struct win_class_vtbl {
void (*init)(Client*);
+ HRESULT (*get_state)(Client*, VARIANT, VARIANT*);
};
static inline Client* impl_from_Client(IAccessible *iface)
@@ -233,36 +235,44 @@ static HRESULT WINAPI Client_get_accRole(IAccessible *iface, VARIANT varID, VARI
return S_OK;
}
-static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState)
+static HRESULT client_get_state(Client *client, VARIANT id, VARIANT *state)
{
- Client *This = impl_from_Client(iface);
GUITHREADINFO info;
LONG style;
- TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState);
-
- if(convert_child_id(&varID) != CHILDID_SELF) {
- V_VT(pvarState) = VT_EMPTY;
+ if(convert_child_id(&id) != CHILDID_SELF) {
+ V_VT(state) = VT_EMPTY;
return E_INVALIDARG;
}
- V_VT(pvarState) = VT_I4;
- V_I4(pvarState) = 0;
+ V_VT(state) = VT_I4;
+ V_I4(state) = 0;
- style = GetWindowLongW(This->hwnd, GWL_STYLE);
+ style = GetWindowLongW(client->hwnd, GWL_STYLE);
if(style & WS_DISABLED)
- V_I4(pvarState) |= STATE_SYSTEM_UNAVAILABLE;
- else if(IsWindow(This->hwnd))
- V_I4(pvarState) |= STATE_SYSTEM_FOCUSABLE;
+ V_I4(state) |= STATE_SYSTEM_UNAVAILABLE;
+ else if(IsWindow(client->hwnd))
+ V_I4(state) |= STATE_SYSTEM_FOCUSABLE;
info.cbSize = sizeof(info);
- if(GetGUIThreadInfo(0, &info) && info.hwndFocus == This->hwnd)
- V_I4(pvarState) |= STATE_SYSTEM_FOCUSED;
+ if(GetGUIThreadInfo(0, &info) && info.hwndFocus == client->hwnd)
+ V_I4(state) |= STATE_SYSTEM_FOCUSED;
if(!(style & WS_VISIBLE))
- V_I4(pvarState) |= STATE_SYSTEM_INVISIBLE;
+ V_I4(state) |= STATE_SYSTEM_INVISIBLE;
return S_OK;
}
+static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT id, VARIANT *state)
+{
+ Client *This = impl_from_Client(iface);
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&id), state);
+
+ if(This->vtbl && This->vtbl->get_state)
+ return This->vtbl->get_state(This, id, state);
+ return client_get_state(This, id, state);
+}
+
static HRESULT WINAPI Client_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
{
Client *This = impl_from_Client(iface);
@@ -664,8 +674,28 @@ static void edit_init(Client *client)
client->role = ROLE_SYSTEM_TEXT;
}
+static HRESULT edit_get_state(Client *client, VARIANT id, VARIANT *state)
+{
+ HRESULT hres;
+ LONG style;
+
+ hres = client_get_state(client, id, state);
+ if(FAILED(hres))
+ return hres;
+
+ assert(V_VT(state) == VT_I4);
+
+ style = GetWindowLongW(client->hwnd, GWL_STYLE);
+ if(style & ES_READONLY)
+ V_I4(state) |= STATE_SYSTEM_READONLY;
+ if(style & ES_PASSWORD)
+ V_I4(state) |= STATE_SYSTEM_PROTECTED;
+ return S_OK;
+}
+
static const win_class_vtbl edit_vtbl = {
edit_init,
+ edit_get_state,
};
static const struct win_class_data classes[] = {
More information about the wine-cvs
mailing list