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
4501d2c1
Commit
4501d2c1
authored
Apr 21, 2023
by
Connor McAdams
Committed by
Alexandre Julliard
Jul 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uiautomationcore: Introduce custom uia_event_args structure.
Signed-off-by:
Connor McAdams
<
cmcadams@codeweavers.com
>
parent
42e058ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
7 deletions
+45
-7
uia_event.c
dlls/uiautomationcore/uia_event.c
+45
-7
No files found.
dlls/uiautomationcore/uia_event.c
View file @
4501d2c1
...
...
@@ -200,6 +200,38 @@ static void uia_event_map_entry_release(struct uia_event_map_entry *entry)
}
/*
* Functions for struct uia_event_args, a reference counted structure
* used to store event arguments. This is necessary for serverside events
* 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
));
if
(
!
args
)
return
NULL
;
args
->
simple_args
.
Type
=
event_info
->
event_arg_type
;
args
->
simple_args
.
EventId
=
event_info
->
event_id
;
args
->
ref
=
1
;
return
args
;
}
static
void
uia_event_args_release
(
struct
uia_event_args
*
args
)
{
if
(
!
InterlockedDecrement
(
&
args
->
ref
))
heap_free
(
args
);
}
/*
* UI Automation event thread.
*/
struct
uia_event_thread
...
...
@@ -975,7 +1007,7 @@ HRESULT WINAPI UiaRemoveEvent(HUIAEVENT huiaevent)
return
S_OK
;
}
static
HRESULT
uia_event_invoke
(
HUIANODE
node
,
struct
UiaEventA
rgs
*
args
,
struct
uia_event
*
event
)
static
HRESULT
uia_event_invoke
(
HUIANODE
node
,
struct
uia_event_a
rgs
*
args
,
struct
uia_event
*
event
)
{
SAFEARRAY
*
out_req
;
BSTR
tree_struct
;
...
...
@@ -985,7 +1017,7 @@ static HRESULT uia_event_invoke(HUIANODE node, struct UiaEventArgs *args, struct
&
tree_struct
);
if
(
SUCCEEDED
(
hr
))
{
event
->
u
.
clientside
.
cback
(
args
,
out_req
,
tree_struct
);
event
->
u
.
clientside
.
cback
(
&
args
->
simple_
args
,
out_req
,
tree_struct
);
SafeArrayDestroy
(
out_req
);
SysFreeString
(
tree_struct
);
}
...
...
@@ -996,7 +1028,8 @@ static HRESULT uia_event_invoke(HUIANODE node, struct UiaEventArgs *args, struct
/*
* Check if the provider that raised the event matches this particular event.
*/
static
HRESULT
uia_event_check_match
(
HUIANODE
node
,
SAFEARRAY
*
rt_id
,
struct
UiaEventArgs
*
args
,
struct
uia_event
*
event
)
static
HRESULT
uia_event_check_match
(
HUIANODE
node
,
SAFEARRAY
*
rt_id
,
struct
uia_event_args
*
args
,
struct
uia_event
*
event
)
{
struct
UiaPropertyCondition
prop_cond
=
{
ConditionType_Property
,
UIA_RuntimeIdPropertyId
};
struct
uia_node
*
node_data
=
impl_from_IWineUiaNode
((
IWineUiaNode
*
)
node
);
...
...
@@ -1055,7 +1088,7 @@ static HRESULT uia_event_check_match(HUIANODE node, SAFEARRAY *rt_id, struct Uia
return
hr
;
}
static
HRESULT
uia_raise_event
(
IRawElementProviderSimple
*
elprov
,
struct
UiaEventA
rgs
*
args
)
static
HRESULT
uia_raise_event
(
IRawElementProviderSimple
*
elprov
,
struct
uia_event_a
rgs
*
args
)
{
struct
uia_event_map_entry
*
event_entry
;
enum
ProviderOptions
prov_opts
=
0
;
...
...
@@ -1069,7 +1102,7 @@ static HRESULT uia_raise_event(IRawElementProviderSimple *elprov, struct UiaEven
return
hr
;
EnterCriticalSection
(
&
event_map_cs
);
if
((
event_entry
=
uia_get_event_map_entry_for_event
(
args
->
EventId
)))
if
((
event_entry
=
uia_get_event_map_entry_for_event
(
args
->
simple_args
.
EventId
)))
InterlockedIncrement
(
&
event_entry
->
refs
);
LeaveCriticalSection
(
&
event_map_cs
);
...
...
@@ -1120,7 +1153,7 @@ static HRESULT uia_raise_event(IRawElementProviderSimple *elprov, struct UiaEven
HRESULT
WINAPI
UiaRaiseAutomationEvent
(
IRawElementProviderSimple
*
elprov
,
EVENTID
id
)
{
const
struct
uia_event_info
*
event_info
=
uia_event_info_from_id
(
id
);
struct
UiaEventArgs
args
=
{
EventArgsType_Simple
,
id
}
;
struct
uia_event_args
*
args
;
HRESULT
hr
;
TRACE
(
"(%p, %d)
\n
"
,
elprov
,
id
);
...
...
@@ -1138,7 +1171,12 @@ HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *elprov, EVENTI
return
S_OK
;
}
hr
=
uia_raise_event
(
elprov
,
&
args
);
args
=
create_uia_event_args
(
event_info
);
if
(
!
args
)
return
E_OUTOFMEMORY
;
hr
=
uia_raise_event
(
elprov
,
args
);
uia_event_args_release
(
args
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
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