Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9ab915a7
Commit
9ab915a7
authored
Jun 27, 2023
by
Connor McAdams
Committed by
Alexandre Julliard
Jul 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uiautomationcore: Introduce custom clientside event callback function.
Signed-off-by:
Connor McAdams
<
cmcadams@codeweavers.com
>
parent
7844a544
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
35 deletions
+69
-35
uia_event.c
dlls/uiautomationcore/uia_event.c
+59
-34
uia_private.h
dlls/uiautomationcore/uia_private.h
+10
-1
No files found.
dlls/uiautomationcore/uia_event.c
View file @
9ab915a7
...
...
@@ -217,12 +217,6 @@ static void uia_event_map_entry_release(struct uia_event_map_entry *entry)
* as they're raised on a background thread after the event raising
* function has returned.
*/
struct
uia_event_args
{
struct
UiaEventArgs
simple_args
;
LONG
ref
;
};
static
struct
uia_event_args
*
create_uia_event_args
(
const
struct
uia_event_info
*
event_info
)
{
struct
uia_event_args
*
args
=
heap_alloc_zero
(
sizeof
(
*
args
));
...
...
@@ -733,8 +727,8 @@ static HRESULT create_uia_event(struct uia_event **out_event, LONG event_cookie,
return
S_OK
;
}
static
HRESULT
create_clientside_uia_event
(
struct
uia_event
**
out_event
,
int
event_id
,
int
scope
,
UiaEventCallback
*
cback
,
SAFEARRAY
*
runtime_id
)
static
HRESULT
create_clientside_uia_event
(
struct
uia_event
**
out_event
,
int
event_id
,
int
scope
,
UiaWineEventCallback
*
cback
,
void
*
cback_data
,
SAFEARRAY
*
runtime_id
)
{
struct
uia_event
*
event
=
NULL
;
static
LONG
next_event_cookie
;
...
...
@@ -748,7 +742,8 @@ static HRESULT create_clientside_uia_event(struct uia_event **out_event, int eve
event
->
runtime_id
=
runtime_id
;
event
->
event_id
=
event_id
;
event
->
scope
=
scope
;
event
->
u
.
clientside
.
cback
=
cback
;
event
->
u
.
clientside
.
event_callback
=
cback
;
event
->
u
.
clientside
.
callback_data
=
cback_data
;
*
out_event
=
event
;
return
S_OK
;
...
...
@@ -1135,38 +1130,29 @@ exit:
return
hr
;
}
/***********************************************************************
* UiaAddEvent (uiautomationcore.@)
*/
HRESULT
WINAPI
UiaAddEvent
(
HUIANODE
huianode
,
EVENTID
event_id
,
UiaEventCallback
*
callback
,
enum
TreeScope
scope
,
PROPERTYID
*
prop_ids
,
int
prop_ids_count
,
struct
UiaCacheRequest
*
cache_req
,
HUIAEVENT
*
huiaevent
)
static
HRESULT
uia_clientside_event_callback
(
struct
uia_event
*
event
,
struct
uia_event_args
*
args
,
SAFEARRAY
*
cache_req
,
BSTR
tree_struct
)
{
const
struct
uia_event_info
*
event_info
=
uia_event_info_from_id
(
event_id
);
struct
uia_event
*
event
;
SAFEARRAY
*
sa
;
HRESULT
hr
;
UiaEventCallback
*
event_callback
=
(
UiaEventCallback
*
)
event
->
u
.
clientside
.
callback_data
;
TRACE
(
"(%p, %d, %p, %#x, %p, %d, %p, %p)
\n
"
,
huianode
,
event_id
,
callback
,
scope
,
prop_ids
,
prop_ids_count
,
cache_req
,
huiaevent
);
if
(
!
huianode
||
!
callback
||
!
cache_req
||
!
huiaevent
)
return
E_INVALIDARG
;
event_callback
(
&
args
->
simple_args
,
cache_req
,
tree_struct
);
if
(
!
event_info
)
WARN
(
"No event information for event ID %d
\n
"
,
event_id
);
return
S_OK
;
}
*
huiaevent
=
NULL
;
if
(
event_info
&&
(
event_info
->
event_arg_type
==
EventArgsType_PropertyChanged
))
{
FIXME
(
"Property changed event registration currently unimplemented
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
uia_add_clientside_event
(
HUIANODE
huianode
,
EVENTID
event_id
,
enum
TreeScope
scope
,
PROPERTYID
*
prop_ids
,
int
prop_ids_count
,
struct
UiaCacheRequest
*
cache_req
,
SAFEARRAY
*
rt_id
,
UiaWineEventCallback
*
cback
,
void
*
cback_data
,
HUIAEVENT
*
huiaevent
)
{
struct
uia_event
*
event
;
SAFEARRAY
*
sa
;
HRESULT
hr
;
hr
=
UiaGetRuntimeId
(
huianode
,
&
sa
);
hr
=
SafeArrayCopy
(
rt_id
,
&
sa
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
create_clientside_uia_event
(
&
event
,
event_id
,
scope
,
c
allback
,
sa
);
hr
=
create_clientside_uia_event
(
&
event
,
event_id
,
scope
,
c
back
,
cback_data
,
sa
);
if
(
FAILED
(
hr
))
{
SafeArrayDestroy
(
sa
);
...
...
@@ -1199,6 +1185,43 @@ exit:
}
/***********************************************************************
* UiaAddEvent (uiautomationcore.@)
*/
HRESULT
WINAPI
UiaAddEvent
(
HUIANODE
huianode
,
EVENTID
event_id
,
UiaEventCallback
*
callback
,
enum
TreeScope
scope
,
PROPERTYID
*
prop_ids
,
int
prop_ids_count
,
struct
UiaCacheRequest
*
cache_req
,
HUIAEVENT
*
huiaevent
)
{
const
struct
uia_event_info
*
event_info
=
uia_event_info_from_id
(
event_id
);
SAFEARRAY
*
sa
;
HRESULT
hr
;
TRACE
(
"(%p, %d, %p, %#x, %p, %d, %p, %p)
\n
"
,
huianode
,
event_id
,
callback
,
scope
,
prop_ids
,
prop_ids_count
,
cache_req
,
huiaevent
);
if
(
!
huianode
||
!
callback
||
!
cache_req
||
!
huiaevent
)
return
E_INVALIDARG
;
if
(
!
event_info
)
WARN
(
"No event information for event ID %d
\n
"
,
event_id
);
*
huiaevent
=
NULL
;
if
(
event_info
&&
(
event_info
->
event_arg_type
==
EventArgsType_PropertyChanged
))
{
FIXME
(
"Property changed event registration currently unimplemented
\n
"
);
return
E_NOTIMPL
;
}
hr
=
UiaGetRuntimeId
(
huianode
,
&
sa
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
uia_add_clientside_event
(
huianode
,
event_id
,
scope
,
prop_ids
,
prop_ids_count
,
cache_req
,
sa
,
uia_clientside_event_callback
,
(
void
*
)
callback
,
huiaevent
);
SafeArrayDestroy
(
sa
);
return
hr
;
}
/***********************************************************************
* UiaRemoveEvent (uiautomationcore.@)
*/
HRESULT
WINAPI
UiaRemoveEvent
(
HUIAEVENT
huiaevent
)
...
...
@@ -1245,7 +1268,9 @@ static HRESULT uia_event_invoke(HUIANODE node, HUIANODE nav_start_node, struct u
&
tree_struct
);
if
(
SUCCEEDED
(
hr
))
{
event
->
u
.
clientside
.
cback
(
&
args
->
simple_args
,
out_req
,
tree_struct
);
hr
=
event
->
u
.
clientside
.
event_callback
(
event
,
args
,
out_req
,
tree_struct
);
if
(
FAILED
(
hr
))
WARN
(
"Event callback failed with hr %#lx
\n
"
,
hr
);
SafeArrayDestroy
(
out_req
);
SysFreeString
(
tree_struct
);
}
...
...
dlls/uiautomationcore/uia_private.h
View file @
9ab915a7
...
...
@@ -95,6 +95,12 @@ static inline struct uia_provider *impl_from_IWineUiaProvider(IWineUiaProvider *
return
CONTAINING_RECORD
(
iface
,
struct
uia_provider
,
IWineUiaProvider_iface
);
}
struct
uia_event_args
{
struct
UiaEventArgs
simple_args
;
LONG
ref
;
};
enum
uia_event_type
{
EVENT_TYPE_CLIENTSIDE
,
EVENT_TYPE_SERVERSIDE
,
...
...
@@ -124,7 +130,8 @@ struct uia_event
{
struct
{
struct
UiaCacheRequest
cache_req
;
UiaEventCallback
*
cback
;
HRESULT
(
*
event_callback
)(
struct
uia_event
*
,
struct
uia_event_args
*
,
SAFEARRAY
*
,
BSTR
);
void
*
callback_data
;
DWORD
git_cookie
;
}
clientside
;
...
...
@@ -137,6 +144,8 @@ struct uia_event
}
u
;
};
typedef
HRESULT
UiaWineEventCallback
(
struct
uia_event
*
,
struct
uia_event_args
*
,
SAFEARRAY
*
,
BSTR
);
static
inline
void
variant_init_bool
(
VARIANT
*
v
,
BOOL
val
)
{
V_VT
(
v
)
=
VT_BOOL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment