Commit 66666709 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Add support for passing WinEvents to the COM API.

parent f420b65a
......@@ -958,6 +958,12 @@ struct uia_com_event {
struct uia_event_handler_map_entry *handler_map;
};
HRESULT uia_com_win_event_callback(DWORD event_id, HWND hwnd, LONG obj_id, LONG child_id, DWORD thread_id, DWORD event_time)
{
FIXME("%ld, %p, %ld, %ld, %ld, %ld: stub\n", event_id, hwnd, obj_id, child_id, thread_id, event_time);
return S_OK;
}
static HRESULT uia_event_handlers_add_handler(IUnknown *handler_iface, SAFEARRAY *runtime_id, int event_id,
struct uia_com_event *event)
{
......@@ -3311,6 +3317,9 @@ static HRESULT uia_add_com_event_handler(IUIAutomation6 *iface, EVENTID event_id
if (FAILED(hr))
goto exit;
if (!uia_clientside_event_start_event_thread((struct uia_event *)com_event->event))
WARN("Failed to start event thread, WinEvents may not be delivered.\n");
hr = uia_event_handlers_add_handler(handler_unk, runtime_id, event_id, com_event);
exit:
......
......@@ -78,7 +78,6 @@ static BOOL CALLBACK uia_win_event_enum_top_level_hwnds(HWND hwnd, LPARAM lparam
return TRUE;
}
static BOOL uia_clientside_event_start_event_thread(struct uia_event *event);
HRESULT uia_event_add_win_event_hwnd(struct uia_event *event, HWND hwnd)
{
if (!uia_clientside_event_start_event_thread(event))
......@@ -844,6 +843,11 @@ static void uia_event_thread_process_queue(struct list *event_queue)
{
struct uia_queue_win_event *win_event = (struct uia_queue_win_event *)event;
hr = uia_com_win_event_callback(win_event->event_id, win_event->hwnd, win_event->obj_id, win_event->child_id,
win_event->thread_id, win_event->event_time);
if (FAILED(hr))
WARN("uia_com_win_event_callback failed with hr %#lx\n", hr);
hr = uia_event_for_each(win_event_to_uia_event_id(win_event->event_id), uia_win_event_for_each_callback,
(void *)win_event, TRUE);
break;
......@@ -990,7 +994,7 @@ static void uia_stop_event_thread(void)
LeaveCriticalSection(&event_thread_cs);
}
static BOOL uia_clientside_event_start_event_thread(struct uia_event *event)
BOOL uia_clientside_event_start_event_thread(struct uia_event *event)
{
if (!event->u.clientside.event_thread_started)
event->u.clientside.event_thread_started = uia_start_event_thread();
......
......@@ -223,10 +223,13 @@ HRESULT uia_condition_check(HUIANODE node, struct UiaCondition *condition) DECLS
BOOL uia_condition_matched(HRESULT hr) DECLSPEC_HIDDEN;
/* uia_com_client.c */
HRESULT uia_com_win_event_callback(DWORD event_id, HWND hwnd, LONG obj_id, LONG child_id, DWORD thread_id,
DWORD event_time) DECLSPEC_HIDDEN;
HRESULT create_uia_iface(IUnknown **iface, BOOL is_cui8) DECLSPEC_HIDDEN;
/* uia_event.c */
HRESULT uia_event_add_win_event_hwnd(struct uia_event *event, HWND hwnd) DECLSPEC_HIDDEN;
BOOL uia_clientside_event_start_event_thread(struct uia_event *event) DECLSPEC_HIDDEN;
HRESULT create_serverside_uia_event(struct uia_event **out_event, LONG process_id, LONG event_cookie) DECLSPEC_HIDDEN;
HRESULT uia_event_add_provider_event_adviser(IRawElementProviderAdviseEvents *advise_events,
struct uia_event *event) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment