Added creation of rdpei events and added processing of received 'suspend/resume touches' event from the server in the rdpei plugin.

This commit is contained in:
vworkspace 2014-02-07 13:16:41 -05:00
parent aca384992f
commit e6efe7c678
2 changed files with 88 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include <winpr/collections.h>
#include <freerdp/addin.h>
#include <freerdp/utils/svc_plugin.h>
#include "rdpei_common.h"
@ -118,6 +119,20 @@ const char* RDPEI_EVENTID_STRINGS[] =
"EVENTID_DISMISS_HOVERING_CONTACT"
};
BOOL rdpei_push_event(RDPEI_CHANNEL_CALLBACK* callback, wMessage* event)
{
int status;
status = callback->channel_mgr->PushEvent(callback->channel_mgr, event);
if (status)
{
DEBUG_WARN("response error %d", status);
return FALSE;
}
return TRUE;
}
int rdpei_add_frame(RdpeiClientContext* context)
{
int i;
@ -379,11 +394,35 @@ int rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
int rdpei_recv_suspend_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
{
wMessage* event;
BOOL status;
event = freerdp_event_new(RdpeiChannel_Class, RdpeiChannel_SuspendTouch, NULL, NULL);
status = rdpei_push_event(callback, event);
if (!status)
{
return -1;
}
return 0;
}
int rdpei_recv_resume_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
{
wMessage* event;
BOOL status;
event = freerdp_event_new(RdpeiChannel_Class, RdpeiChannel_ResumeTouch, NULL, NULL);
status = rdpei_push_event(callback, event);
if (!status)
{
return -1;
}
return 0;
}
@ -490,7 +529,7 @@ static int rdpei_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
(IWTSListenerCallback*) rdpei->listener_callback, &(rdpei->listener));
rdpei->listener->pInterface = rdpei->iface.pInterface;
InitializeCriticalSection(&rdpei->lock);
rdpei->event = CreateEvent(NULL, TRUE, FALSE, NULL);
rdpei->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@ -675,7 +714,7 @@ int rdpei_touch_end(RdpeiClientContext* context, int externalId, int x, int y)
int i;
int contactId = -1;
RDPINPUT_CONTACT_DATA contact;
RDPINPUT_CONTACT_POINT* contactPoint;
RDPINPUT_CONTACT_POINT* contactPoint = NULL;
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
for (i = 0; i < rdpei->maxTouchContacts; i++)

View File

@ -73,6 +73,30 @@ static wMessage* freerdp_cliprdr_event_new(UINT16 event_type)
ZeroMemory(event.v, sizeof(RDP_CB_CLIP_CAPS));
event.m->id = MakeMessageId(CliprdrChannel, ClipCaps);
break;
case CliprdrChannel_FileContentsRequest:
event.v = malloc(sizeof(RDP_CB_FILE_CONTENTS_REQUEST_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_FILE_CONTENTS_REQUEST_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, FileContentsRequest);
break;
case CliprdrChannel_FileContentsResponse:
event.v = malloc(sizeof(RDP_CB_FILE_CONTENTS_RESPONSE_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_FILE_CONTENTS_RESPONSE_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, FileContentsResponse);
break;
case CliprdrChannel_Capabilities:
event.v = malloc(sizeof(RDP_CB_CAPS_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_CAPS_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, Capabilities);
break;
case CliprdrChannel_TemporaryDirectory:
event.v = malloc(sizeof(RDP_CB_TEMPORARY_DIRECTORY_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_TEMPORARY_DIRECTORY_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, TemporaryDirectory);
break;
}
return event.v;
@ -115,6 +139,16 @@ static wMessage* freerdp_rail_event_new(UINT16 event_type)
return event;
}
static wMessage* freerdp_rdpei_event_new(UINT16 event_type)
{
wMessage* event;
event = (wMessage*) malloc(sizeof(wMessage));
ZeroMemory(event, sizeof(wMessage));
return event;
}
wMessage* freerdp_event_new(UINT16 event_class, UINT16 event_type,
MESSAGE_FREE_FN on_event_free_callback, void* user_data)
{
@ -138,6 +172,10 @@ wMessage* freerdp_event_new(UINT16 event_class, UINT16 event_type,
case RailChannel_Class:
event = freerdp_rail_event_new(event_type);
break;
case RdpeiChannel_Class:
event = freerdp_rdpei_event_new(event_type);
break;
}
if (event)
@ -190,6 +228,11 @@ static void freerdp_rail_event_free(wMessage* event)
}
static void freerdp_rdpei_event_free(wMessage* event)
{
}
void freerdp_event_free(wMessage* event)
{
if (event)
@ -210,6 +253,10 @@ void freerdp_event_free(wMessage* event)
case RailChannel_Class:
freerdp_rail_event_free(event);
break;
case RdpeiChannel_Class:
freerdp_rdpei_event_free(event);
break;
}
free(event);