Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fotios Valasiadis
wine
Commits
9ab915a7
Commit
9ab915a7
authored
1 year ago
by
Connor McAdams
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
uiautomationcore: Introduce custom clientside event callback function.
Signed-off-by:
Connor McAdams
<
cmcadams@codeweavers.com
>
parent
7844a544
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/uiautomationcore/uia_event.c
+59
-34
59 additions, 34 deletions
dlls/uiautomationcore/uia_event.c
dlls/uiautomationcore/uia_private.h
+10
-1
10 additions, 1 deletion
dlls/uiautomationcore/uia_private.h
with
69 additions
and
35 deletions
dlls/uiautomationcore/uia_event.c
+
59
−
34
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
all
back
,
sa
);
hr
=
create_clientside_uia_event
(
&
event
,
event_id
,
scope
,
cback
,
cback_data
,
sa
);
if
(
FAILED
(
hr
))
{
SafeArrayDestroy
(
sa
);
...
...
@@ -1198,6 +1184,43 @@ 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
)
{
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.@)
*/
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
dlls/uiautomationcore/uia_private.h
+
10
−
1
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment