From 2a6c9e1b8742306097c9940ba3f7d3b18efbcfb7 Mon Sep 17 00:00:00 2001 From: David Fort Date: Tue, 19 Dec 2017 09:38:24 +0100 Subject: [PATCH] Add an activated event and a Timer event Added an event that is triggered when the activation sequence is finished. We also define a timer event that is neat to have for regular operation. --- include/freerdp/event.h | 8 ++++++++ libfreerdp/core/freerdp.c | 2 ++ libfreerdp/core/rdp.c | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/include/freerdp/event.h b/include/freerdp/event.h index 30f5c0386..947349db6 100644 --- a/include/freerdp/event.h +++ b/include/freerdp/event.h @@ -66,6 +66,10 @@ DEFINE_EVENT_BEGIN(ErrorInfo) UINT32 code; DEFINE_EVENT_END(ErrorInfo) +DEFINE_EVENT_BEGIN(Activated) +BOOL firstActivation; +DEFINE_EVENT_END(Activated) + DEFINE_EVENT_BEGIN(Terminate) int code; DEFINE_EVENT_END(Terminate) @@ -100,6 +104,10 @@ UINT16 x; UINT16 y; DEFINE_EVENT_END(MouseEvent) +DEFINE_EVENT_BEGIN(Timer) +UINT64 now; +DEFINE_EVENT_END(Timer) + #ifdef __cplusplus } #endif diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 483c3bc72..c3d89cdb8 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -600,6 +600,8 @@ static wEventType FreeRDP_Events[] = DEFINE_EVENT_ENTRY(ChannelConnected) DEFINE_EVENT_ENTRY(ChannelDisconnected) DEFINE_EVENT_ENTRY(MouseEvent) + DEFINE_EVENT_ENTRY(Activated) + DEFINE_EVENT_ENTRY(Timer) }; /** Allocator function for a rdp context. diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index ebd6de5c4..921267646 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -1438,7 +1438,15 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra) if ((status >= 0) && (rdp->finalize_sc_pdus == FINALIZE_SC_COMPLETE)) { + ActivatedEventArgs activatedEvent; + rdpContext *context = rdp->context; + rdp_client_transition_to_state(rdp, CONNECTION_STATE_ACTIVE); + + EventArgsInit(&activatedEvent, "xfreerdp"); + activatedEvent.firstActivation = !rdp->deactivation_reactivation; + PubSub_OnActivated(context->pubSub, context, &activatedEvent); + return 2; } if (status < 0)