Compatibility commit for RDPEI API
authorArmin Novak <armin.novak@thincast.com>
Thu, 11 Feb 2021 11:43:05 +0000 (12:43 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Thu, 25 Feb 2021 08:51:41 +0000 (09:51 +0100)
channels/rdpei/server/rdpei_main.c
include/freerdp/channels/rdpei.h
include/freerdp/client/rdpei.h

index c046d1f..80ab4b6 100644 (file)
@@ -207,6 +207,7 @@ static UINT read_cs_ready_message(RdpeiServerContext* context, wStream* s)
 static UINT read_touch_contact_data(RdpeiServerContext* context, wStream* s,
                                     RDPINPUT_CONTACT_DATA* contactData)
 {
+       UINT16 tmp;
        WINPR_UNUSED(context);
        if (Stream_GetRemainingLength(s) < 1)
        {
@@ -215,25 +216,28 @@ static UINT read_touch_contact_data(RdpeiServerContext* context, wStream* s,
        }
 
        Stream_Read_UINT8(s, contactData->contactId);
-       if (!rdpei_read_2byte_unsigned(s, &contactData->fieldsPresent) ||
-           !rdpei_read_4byte_signed(s, &contactData->x) ||
+       if (!rdpei_read_2byte_unsigned(s, &tmp) || !rdpei_read_4byte_signed(s, &contactData->x) ||
            !rdpei_read_4byte_signed(s, &contactData->y) ||
            !rdpei_read_4byte_unsigned(s, &contactData->contactFlags))
        {
                WLog_ERR(TAG, "rdpei_read_ failed!");
                return ERROR_INTERNAL_ERROR;
        }
+       contactData->fieldsPresent = tmp;
 
        if (contactData->fieldsPresent & CONTACT_DATA_CONTACTRECT_PRESENT)
        {
-               if (!rdpei_read_2byte_signed(s, &contactData->contactRectLeft) ||
-                   !rdpei_read_2byte_signed(s, &contactData->contactRectTop) ||
-                   !rdpei_read_2byte_signed(s, &contactData->contactRectRight) ||
-                   !rdpei_read_2byte_signed(s, &contactData->contactRectBottom))
+               INT16 tmp[4] = { 0 };
+               if (!rdpei_read_2byte_signed(s, &tmp[0]) || !rdpei_read_2byte_signed(s, &tmp[1]) ||
+                   !rdpei_read_2byte_signed(s, &tmp[2]) || !rdpei_read_2byte_signed(s, &tmp[3]))
                {
                        WLog_ERR(TAG, "rdpei_read_ failed!");
                        return ERROR_INTERNAL_ERROR;
                }
+               contactData->contactRectLeft = tmp[0];
+               contactData->contactRectTop = tmp[1];
+               contactData->contactRectRight = tmp[2];
+               contactData->contactRectBottom = tmp[3];
        }
 
        if ((contactData->fieldsPresent & CONTACT_DATA_ORIENTATION_PRESENT) &&
@@ -310,15 +314,16 @@ static UINT read_pen_contact(RdpeiServerContext* context, wStream* s,
 static UINT read_touch_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_TOUCH_FRAME* frame)
 {
        UINT32 i;
+       UINT16 tmp;
        RDPINPUT_CONTACT_DATA* contact;
        UINT error;
 
-       if (!rdpei_read_2byte_unsigned(s, &frame->contactCount) ||
-           !rdpei_read_8byte_unsigned(s, &frame->frameOffset))
+       if (!rdpei_read_2byte_unsigned(s, &tmp) || !rdpei_read_8byte_unsigned(s, &frame->frameOffset))
        {
                WLog_ERR(TAG, "rdpei_read_ failed!");
                return ERROR_INTERNAL_ERROR;
        }
+       frame->contactCount = tmp;
 
        frame->contacts = contact = calloc(frame->contactCount, sizeof(RDPINPUT_CONTACT_DATA));
        if (!frame->contacts)
index edb6d6b..03bb3e8 100644 (file)
@@ -38,6 +38,9 @@ enum
 };
 
 /* Client Ready Flags */
+#define READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001          /* Deprecated */
+#define READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002 /* Deprecated */
+
 #define CS_READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001
 #define CS_READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002
 #define CS_READY_FLAGS_ENABLE_MULTIPEN_INJECTION 0x00000004
@@ -76,14 +79,14 @@ typedef enum
 struct _RDPINPUT_CONTACT_DATA
 {
        UINT32 contactId;
-       UINT16 fieldsPresent;
+       UINT32 fieldsPresent;
        INT32 x;
        INT32 y;
        UINT32 contactFlags;
-       INT16 contactRectLeft;
-       INT16 contactRectTop;
-       INT16 contactRectRight;
-       INT16 contactRectBottom;
+       INT32 contactRectLeft;
+       INT32 contactRectTop;
+       INT32 contactRectRight;
+       INT32 contactRectBottom;
        UINT32 orientation;
        UINT32 pressure;
 };
@@ -92,7 +95,7 @@ typedef struct _RDPINPUT_CONTACT_DATA RDPINPUT_CONTACT_DATA;
 /** @brief a frame containing contact points */
 struct _RDPINPUT_TOUCH_FRAME
 {
-       UINT16 contactCount;
+       UINT32 contactCount;
        UINT64 frameOffset;
        RDPINPUT_CONTACT_DATA* contacts;
 };
index 7c350cf..e635ffd 100644 (file)
@@ -57,7 +57,6 @@ struct _rdpei_client_context
        void* custom;
 
        pcRdpeiGetVersion GetVersion;
-       pcRdpeiGetFeatures GetFeatures;
 
        pcRdpeiAddContact AddContact;
 
@@ -65,14 +64,15 @@ struct _rdpei_client_context
        pcRdpeiTouchUpdate TouchUpdate;
        pcRdpeiTouchEnd TouchEnd;
 
+       pcRdpeiSuspendTouch SuspendTouch;
+       pcRdpeiResumeTouch ResumeTouch;
+
+       pcRdpeiGetFeatures GetFeatures;
        pcRdpeiAddPen AddPen;
 
        pcRdpeiPen PenBegin;
        pcRdpeiPen PenUpdate;
        pcRdpeiPen PenEnd;
-
-       pcRdpeiSuspendTouch SuspendTouch;
-       pcRdpeiResumeTouch ResumeTouch;
 };
 
 #endif /* FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H */