channels/rdpei: fix multitouch with Word 2013

This commit is contained in:
Marc-André Moreau 2013-07-11 11:04:20 -07:00
parent 5926fa36dd
commit a306d3f9fc
2 changed files with 15 additions and 5 deletions

View File

@ -212,7 +212,7 @@ int rdpei_send_cs_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback)
Stream_Seek(s, RDPINPUT_HEADER_LENGTH); Stream_Seek(s, RDPINPUT_HEADER_LENGTH);
Stream_Write_UINT32(s, flags); /* flags (4 bytes) */ Stream_Write_UINT32(s, flags); /* flags (4 bytes) */
Stream_Write_UINT32(s, RDPINPUT_PROTOCOL_V1); /* protocolVersion (4 bytes) */ Stream_Write_UINT32(s, RDPINPUT_PROTOCOL_V10); /* protocolVersion (4 bytes) */
Stream_Write_UINT16(s, rdpei->maxTouchContacts); /* maxTouchContacts (2 bytes) */ Stream_Write_UINT16(s, rdpei->maxTouchContacts); /* maxTouchContacts (2 bytes) */
Stream_SealLength(s); Stream_SealLength(s);
@ -249,6 +249,7 @@ void rdpei_print_contact_flags(UINT32 contactFlags)
int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame) int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
{ {
int index; int index;
int rectSize = 2;
RDPINPUT_CONTACT_DATA* contact; RDPINPUT_CONTACT_DATA* contact;
#ifdef WITH_DEBUG_RDPEI #ifdef WITH_DEBUG_RDPEI
@ -264,12 +265,18 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
*/ */
rdpei_write_8byte_unsigned(s, frame->frameOffset * 1000); /* frameOffset (EIGHT_BYTE_UNSIGNED_INTEGER) */ rdpei_write_8byte_unsigned(s, frame->frameOffset * 1000); /* frameOffset (EIGHT_BYTE_UNSIGNED_INTEGER) */
Stream_EnsureRemainingCapacity(s, frame->contactCount * 32); Stream_EnsureRemainingCapacity(s, frame->contactCount * 64);
for (index = 0; index < frame->contactCount; index++) for (index = 0; index < frame->contactCount; index++)
{ {
contact = &frame->contacts[index]; contact = &frame->contacts[index];
contact->fieldsPresent |= CONTACT_DATA_CONTACTRECT_PRESENT;
contact->contactRectLeft = contact->x - rectSize;
contact->contactRectTop = contact->y - rectSize;
contact->contactRectRight = contact->x + rectSize;
contact->contactRectBottom = contact->y + rectSize;
#ifdef WITH_DEBUG_RDPEI #ifdef WITH_DEBUG_RDPEI
printf("contact[%d].contactId: %d\n", index, contact->contactId); printf("contact[%d].contactId: %d\n", index, contact->contactId);
printf("contact[%d].fieldsPresent: %d\n", index, contact->fieldsPresent); printf("contact[%d].fieldsPresent: %d\n", index, contact->fieldsPresent);
@ -325,7 +332,7 @@ int rdpei_send_touch_event_pdu(RDPEI_CHANNEL_CALLBACK* callback, RDPINPUT_TOUCH_
wStream* s; wStream* s;
UINT32 pduLength; UINT32 pduLength;
pduLength = 64 + (frame->contactCount * 32); pduLength = 64 + (frame->contactCount * 64);
s = Stream_New(NULL, pduLength); s = Stream_New(NULL, pduLength);
Stream_Seek(s, RDPINPUT_HEADER_LENGTH); Stream_Seek(s, RDPINPUT_HEADER_LENGTH);
@ -355,11 +362,13 @@ int rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
Stream_Read_UINT32(s, protocolVersion); /* protocolVersion (4 bytes) */ Stream_Read_UINT32(s, protocolVersion); /* protocolVersion (4 bytes) */
if (protocolVersion != RDPINPUT_PROTOCOL_V1) #if 0
if (protocolVersion != RDPINPUT_PROTOCOL_V10)
{ {
fprintf(stderr, "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion); fprintf(stderr, "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion);
return -1; return -1;
} }
#endif
return 0; return 0;
} }

View File

@ -35,7 +35,8 @@
/* Protocol Version */ /* Protocol Version */
#define RDPINPUT_PROTOCOL_V1 0x00010000 #define RDPINPUT_PROTOCOL_V10 0x00010000
#define RDPINPUT_PROTOCOL_V101 0x00010001
/* Client Ready Flags */ /* Client Ready Flags */