channels/rdpei: start implementing strict state machine logic

This commit is contained in:
Marc-André Moreau 2013-06-06 18:37:52 -04:00
parent 576035b0ce
commit 977191bba2
2 changed files with 21 additions and 8 deletions

View File

@ -461,7 +461,7 @@ int rdpei_touch_begin(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;
/* Create a new contact point in an empty slot */
@ -485,6 +485,9 @@ int rdpei_touch_begin(RdpeiClientContext* context, int externalId, int x, int y)
{
ZeroMemory(&contact, sizeof(RDPINPUT_CONTACT_DATA));
contactPoint->lastX = x;
contactPoint->lastY = y;
contact.x = x;
contact.y = y;
contact.contactId = (UINT32) contactId;
@ -504,7 +507,7 @@ int rdpei_touch_update(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++)
@ -525,6 +528,9 @@ int rdpei_touch_update(RdpeiClientContext* context, int externalId, int x, int y
{
ZeroMemory(&contact, sizeof(RDPINPUT_CONTACT_DATA));
contactPoint->lastX = x;
contactPoint->lastY = y;
contact.x = x;
contact.y = y;
contact.contactId = (UINT32) contactId;
@ -557,12 +563,6 @@ int rdpei_touch_end(RdpeiClientContext* context, int externalId, int x, int y)
if (contactPoint->externalId == externalId)
{
contactId = contactPoint->contactId;
contactPoint->externalId = 0;
contactPoint->active = FALSE;
contactPoint->flags = 0;
contactPoint->contactId = 0;
contactPoint->state = RDPINPUT_CONTACT_STATE_OUT_OF_RANGE;
break;
}
}
@ -571,6 +571,11 @@ int rdpei_touch_end(RdpeiClientContext* context, int externalId, int x, int y)
{
ZeroMemory(&contact, sizeof(RDPINPUT_CONTACT_DATA));
if ((contactPoint->lastX != x) && (contactPoint->lastY != y))
{
context->TouchUpdate(context, externalId, x, y);
}
contact.x = x;
contact.y = y;
contact.contactId = (UINT32) contactId;
@ -578,6 +583,12 @@ int rdpei_touch_end(RdpeiClientContext* context, int externalId, int x, int y)
contact.contactFlags |= CONTACT_FLAG_UP;
context->AddContact(context, &contact);
contactPoint->externalId = 0;
contactPoint->active = FALSE;
contactPoint->flags = 0;
contactPoint->contactId = 0;
contactPoint->state = RDPINPUT_CONTACT_STATE_OUT_OF_RANGE;
}
return contactId;

View File

@ -86,6 +86,8 @@
struct _RDPINPUT_CONTACT_POINT
{
int lastX;
int lastY;
BOOL active;
UINT32 state;
UINT32 flags;