From ce27936ed539872d55039b6a1b9aa54d8388659e Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 6 Jun 2022 09:32:36 -0700 Subject: [PATCH] GUACAMOLE-377: Add frame boundaries around cursor set operations if otherwise absent. --- src/protocols/rdp/pointer.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/protocols/rdp/pointer.c b/src/protocols/rdp/pointer.c index 5a72c787..7f4901e3 100644 --- a/src/protocols/rdp/pointer.c +++ b/src/protocols/rdp/pointer.c @@ -21,6 +21,7 @@ #include "common/cursor.h" #include "common/display.h" #include "common/surface.h" +#include "gdi.h" #include "pointer.h" #include "rdp.h" @@ -78,11 +79,22 @@ BOOL guac_rdp_pointer_set(rdpContext* context, const rdpPointer* pointer) { guac_client* client = ((rdp_freerdp_context*) context)->client; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; + /* Add explicit frame boundaries around cursor set operation if not already + * in a frame (the RDP protocol does not send nor expect frame boundaries + * for cursor changes, but Guacamole does expect this) */ + int in_frame = rdp_client->in_frame; + + if (rdp_client->frames_supported && !in_frame) + guac_rdp_gdi_mark_frame(context, 1); + /* Set cursor */ guac_common_cursor_set_surface(rdp_client->display->cursor, pointer->xPos, pointer->yPos, ((guac_rdp_pointer*) pointer)->layer->surface); + if (rdp_client->frames_supported && !in_frame) + guac_rdp_gdi_mark_frame(context, 0); + return TRUE; } @@ -106,9 +118,20 @@ BOOL guac_rdp_pointer_set_null(rdpContext* context) { guac_client* client = ((rdp_freerdp_context*) context)->client; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; + /* Add explicit frame boundaries around cursor set operation if not already + * in a frame (the RDP protocol does not send nor expect frame boundaries + * for cursor changes, but Guacamole does expect this) */ + int in_frame = rdp_client->in_frame; + + if (rdp_client->frames_supported && !in_frame) + guac_rdp_gdi_mark_frame(context, 1); + /* Set cursor to empty/blank graphic */ guac_common_cursor_set_blank(rdp_client->display->cursor); + if (rdp_client->frames_supported && !in_frame) + guac_rdp_gdi_mark_frame(context, 0); + return TRUE; } @@ -118,9 +141,20 @@ BOOL guac_rdp_pointer_set_default(rdpContext* context) { guac_client* client = ((rdp_freerdp_context*) context)->client; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; + /* Add explicit frame boundaries around cursor set operation if not already + * in a frame (the RDP protocol does not send nor expect frame boundaries + * for cursor changes, but Guacamole does expect this) */ + int in_frame = rdp_client->in_frame; + + if (rdp_client->frames_supported && !in_frame) + guac_rdp_gdi_mark_frame(context, 1); + /* Set cursor to embedded pointer */ guac_common_cursor_set_pointer(rdp_client->display->cursor); + if (rdp_client->frames_supported && !in_frame) + guac_rdp_gdi_mark_frame(context, 0); + return TRUE; }